PerfMon.dll: Fixed incorrect measure value (http://rainmeter.net/forum/viewtopic.php?f=14&t=11599)

This commit is contained in:
Birunthan Mohanathas 2012-03-25 17:15:59 +03:00
parent 2f2f5e6efa
commit fb5a425eb8
2 changed files with 12 additions and 10 deletions

View File

@ -39,7 +39,6 @@ CMeasurePlugin::CMeasurePlugin(CMeterWindow* meterWindow, const WCHAR* name) : C
m_GetStringFunc(),
m_ExecuteBangFunc()
{
m_MaxValue = 0.0;
}
/*
@ -206,24 +205,25 @@ void CMeasurePlugin::ReadConfig(CConfigParser& parser, const WCHAR* section)
m_Update2 = true;
}
double maxValue = 0;
double oldMaxValue = m_MaxValue;
if (initializeFunc)
{
maxValue = ((INITIALIZE)initializeFunc)(m_Plugin, parser.GetFilename().c_str(), section, m_ID);
m_MaxValue = ((INITIALIZE)initializeFunc)(m_Plugin, parser.GetFilename().c_str(), section, m_ID);
}
const std::wstring& szMaxValue = parser.ReadString(section, L"MaxValue", L"");
if (szMaxValue.empty())
if (!szMaxValue.empty())
{
m_MaxValue = maxValue;
m_MaxValue = oldMaxValue;
}
}
if (m_MaxValue == 0)
if (m_MaxValue == 0.0)
{
m_MaxValue = 1;
m_MaxValue = 1.0;
m_LogMaxValue = true;
}
}
// Reset to default
SetDllDirectory(L"");

View File

@ -54,6 +54,8 @@ PLUGIN_EXPORT void Reload(void* data, void* rm, double* maxValue)
measure->counterName = RmReadString(rm, L"PerfMonCounter", L"");
measure->instanceName = RmReadString(rm, L"PerfMonInstance", L"");
measure->difference = RmReadInt(rm, L"PerfMonDifference", 1) == 1;
*maxValue = 0.0;
}
PLUGIN_EXPORT double Update(void* data)