mirror of
https://github.com/chibicitiberiu/rainmeter-studio.git
synced 2024-02-24 04:33:31 +00:00
Additional change for r852,r856. Improved reading the network statistics from Rainmeter.stats.
Some cosmetic changes.
This commit is contained in:
parent
6c0ea88266
commit
c2e3b6292d
@ -744,6 +744,13 @@ int CConfigParser::ReadInt(LPCTSTR section, LPCTSTR key, int defValue)
|
|||||||
return (m_LastDefaultUsed) ? defValue : (int)ParseDouble(result, defValue, true);
|
return (m_LastDefaultUsed) ? defValue : (int)ParseDouble(result, defValue, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsigned int CConfigParser::ReadUInt(LPCTSTR section, LPCTSTR key, unsigned int defValue)
|
||||||
|
{
|
||||||
|
const std::wstring& result = ReadString(section, key, L"");
|
||||||
|
|
||||||
|
return (m_LastDefaultUsed) ? defValue : (unsigned int)ParseDouble(result, defValue, true);
|
||||||
|
}
|
||||||
|
|
||||||
// Works as ReadFloat except if the value is surrounded by parenthesis in which case it tries to evaluate the formula
|
// Works as ReadFloat except if the value is surrounded by parenthesis in which case it tries to evaluate the formula
|
||||||
double CConfigParser::ReadFormula(LPCTSTR section, LPCTSTR key, double defValue)
|
double CConfigParser::ReadFormula(LPCTSTR section, LPCTSTR key, double defValue)
|
||||||
{
|
{
|
||||||
@ -1056,7 +1063,7 @@ void CConfigParser::ReadIniFile(const std::vector<std::wstring>& iniFileMappings
|
|||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
items[0] = 0;
|
items[0] = 0;
|
||||||
DWORD res = GetPrivateProfileString(NULL, NULL, NULL, items, itemsSize, iniRead.c_str());
|
DWORD res = GetPrivateProfileSectionNames(items, itemsSize, iniRead.c_str());
|
||||||
if (res == 0) // File not found
|
if (res == 0) // File not found
|
||||||
{
|
{
|
||||||
delete [] items;
|
delete [] items;
|
||||||
|
@ -62,6 +62,7 @@ public:
|
|||||||
double ReadFloat(LPCTSTR section, LPCTSTR key, double defValue);
|
double ReadFloat(LPCTSTR section, LPCTSTR key, double defValue);
|
||||||
double ReadFormula(LPCTSTR section, LPCTSTR key, double defValue);
|
double ReadFormula(LPCTSTR section, LPCTSTR key, double defValue);
|
||||||
int ReadInt(LPCTSTR section, LPCTSTR key, int defValue);
|
int ReadInt(LPCTSTR section, LPCTSTR key, int defValue);
|
||||||
|
unsigned int ReadUInt(LPCTSTR section, LPCTSTR key, unsigned int defValue);
|
||||||
Gdiplus::Color ReadColor(LPCTSTR section, LPCTSTR key, const Gdiplus::Color& defValue);
|
Gdiplus::Color ReadColor(LPCTSTR section, LPCTSTR key, const Gdiplus::Color& defValue);
|
||||||
Gdiplus::Rect ReadRect(LPCTSTR section, LPCTSTR key, const Gdiplus::Rect& defValue);
|
Gdiplus::Rect ReadRect(LPCTSTR section, LPCTSTR key, const Gdiplus::Rect& defValue);
|
||||||
RECT ReadRECT(LPCTSTR section, LPCTSTR key, const RECT& defValue);
|
RECT ReadRECT(LPCTSTR section, LPCTSTR key, const RECT& defValue);
|
||||||
|
@ -161,7 +161,7 @@ void CMeasure::ReadConfig(CConfigParser& parser, const WCHAR* section)
|
|||||||
m_IfEqualValue = parser.ReadFloat(section, L"IfEqualValue", 0.0);
|
m_IfEqualValue = parser.ReadFloat(section, L"IfEqualValue", 0.0);
|
||||||
m_IfEqualAction = parser.ReadString(section, L"IfEqualAction", L"", false);
|
m_IfEqualAction = parser.ReadString(section, L"IfEqualAction", L"", false);
|
||||||
|
|
||||||
m_AverageSize = parser.ReadInt(section, L"AverageSize", 0);
|
m_AverageSize = parser.ReadUInt(section, L"AverageSize", 0);
|
||||||
|
|
||||||
m_DynamicVariables = 0!=parser.ReadInt(section, L"DynamicVariables", 0);
|
m_DynamicVariables = 0!=parser.ReadInt(section, L"DynamicVariables", 0);
|
||||||
|
|
||||||
|
@ -584,7 +584,11 @@ void CMeasureNet::ResetStats()
|
|||||||
void CMeasureNet::ReadStats(const WCHAR* iniFile)
|
void CMeasureNet::ReadStats(const WCHAR* iniFile)
|
||||||
{
|
{
|
||||||
WCHAR buffer[64];
|
WCHAR buffer[64];
|
||||||
int count = GetPrivateProfileInt(L"Statistics", L"NetStatsCount", 0, iniFile);
|
|
||||||
|
CConfigParser parser;
|
||||||
|
parser.Initialize(iniFile, NULL, NULL, L"Statistics");
|
||||||
|
|
||||||
|
int count = parser.ReadInt(L"Statistics", L"NetStatsCount", 0);
|
||||||
|
|
||||||
c_StatValues.clear();
|
c_StatValues.clear();
|
||||||
|
|
||||||
@ -593,18 +597,18 @@ void CMeasureNet::ReadStats(const WCHAR* iniFile)
|
|||||||
ULARGE_INTEGER value;
|
ULARGE_INTEGER value;
|
||||||
|
|
||||||
_snwprintf_s(buffer, _TRUNCATE, L"NetStatsInHigh%i", i);
|
_snwprintf_s(buffer, _TRUNCATE, L"NetStatsInHigh%i", i);
|
||||||
value.HighPart = (DWORD)GetPrivateProfileInt(L"Statistics", buffer, 0, iniFile);
|
value.HighPart = (DWORD)parser.ReadUInt(L"Statistics", buffer, 0);
|
||||||
|
|
||||||
_snwprintf_s(buffer, _TRUNCATE, L"NetStatsInLow%i", i);
|
_snwprintf_s(buffer, _TRUNCATE, L"NetStatsInLow%i", i);
|
||||||
value.LowPart = (DWORD)GetPrivateProfileInt(L"Statistics", buffer, 0, iniFile);
|
value.LowPart = (DWORD)parser.ReadUInt(L"Statistics", buffer, 0);
|
||||||
|
|
||||||
c_StatValues.push_back(value.QuadPart);
|
c_StatValues.push_back(value.QuadPart);
|
||||||
|
|
||||||
_snwprintf_s(buffer, _TRUNCATE, L"NetStatsOutHigh%i", i);
|
_snwprintf_s(buffer, _TRUNCATE, L"NetStatsOutHigh%i", i);
|
||||||
value.HighPart = (DWORD)GetPrivateProfileInt(L"Statistics", buffer, 0, iniFile);
|
value.HighPart = (DWORD)parser.ReadUInt(L"Statistics", buffer, 0);
|
||||||
|
|
||||||
_snwprintf_s(buffer, _TRUNCATE, L"NetStatsOutLow%i", i);
|
_snwprintf_s(buffer, _TRUNCATE, L"NetStatsOutLow%i", i);
|
||||||
value.LowPart = (DWORD)GetPrivateProfileInt(L"Statistics", buffer, 0, iniFile);
|
value.LowPart = (DWORD)parser.ReadUInt(L"Statistics", buffer, 0);
|
||||||
|
|
||||||
c_StatValues.push_back(value.QuadPart);
|
c_StatValues.push_back(value.QuadPart);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user