mirror of
https://github.com/chibicitiberiu/rainmeter-studio.git
synced 2024-02-24 04:33:31 +00:00
Statistics now saved in Rainmeter.stats file in same folder as Rainmeter.ini
This commit is contained in:
parent
355a5fc7b1
commit
f66791253a
@ -1790,15 +1790,18 @@ int CRainmeter::Initialize(HWND Parent, HINSTANCE Instance, LPCSTR szPath)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Set the log file location
|
// Set the log file location
|
||||||
m_LogFile = m_IniFile;
|
m_LogFile = m_StatsFile = m_IniFile;
|
||||||
size_t logFileLen = m_LogFile.length();
|
size_t logFileLen = m_LogFile.length();
|
||||||
if (logFileLen > 4 && _wcsicmp(m_LogFile.substr(logFileLen - 4).c_str(), L".ini") == 0)
|
if (logFileLen > 4 && _wcsicmp(m_LogFile.substr(logFileLen - 4).c_str(), L".ini") == 0)
|
||||||
{
|
{
|
||||||
m_LogFile.replace(logFileLen - 4, 4, L".log");
|
m_LogFile.replace(logFileLen - 4, 4, L".log");
|
||||||
|
m_StatsFile.replace(logFileLen - 4, 4, L".sta");
|
||||||
|
m_StatsFile += L"ts";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_LogFile += L".log"; // Append the extension so that we don't accidentally overwrite the ini file
|
m_LogFile += L".log"; // Append the extension so that we don't accidentally overwrite the ini file
|
||||||
|
m_StatsFile += L".stats";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read Logging settings beforehand
|
// Read Logging settings beforehand
|
||||||
@ -2245,8 +2248,7 @@ int CRainmeter::CompareVersions(const std::wstring& strA, const std::wstring& st
|
|||||||
/*
|
/*
|
||||||
** CreateDefaultConfigFile
|
** CreateDefaultConfigFile
|
||||||
**
|
**
|
||||||
** Creates the default Rainmeter.ini file.
|
** Creates the default Rainmeter.ini file with illustro\System enabled.
|
||||||
** illustro\System is enabled.
|
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CRainmeter::CreateDefaultConfigFile(const std::wstring& strFile)
|
void CRainmeter::CreateDefaultConfigFile(const std::wstring& strFile)
|
||||||
@ -3687,9 +3689,23 @@ void CRainmeter::UpdateDesktopWorkArea(bool reset)
|
|||||||
*/
|
*/
|
||||||
void CRainmeter::ReadStats()
|
void CRainmeter::ReadStats()
|
||||||
{
|
{
|
||||||
|
// If m_StatsFile doesn't exist, create it and copy the stats section from m_IniFile
|
||||||
|
if (_waccess(m_StatsFile.c_str(), 0) == -1)
|
||||||
|
{
|
||||||
|
WCHAR* tmpSz = new WCHAR[SHRT_MAX]; // Max size returned by GetPrivateProfileSection()
|
||||||
|
|
||||||
|
if (GetPrivateProfileSection(L"Statistics", tmpSz, SHRT_MAX, m_IniFile.c_str()) > 0)
|
||||||
|
{
|
||||||
|
WritePrivateProfileSection(L"Statistics", tmpSz, m_StatsFile.c_str());
|
||||||
|
WritePrivateProfileString(L"Statistics", NULL, NULL, m_IniFile.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
delete [] tmpSz;
|
||||||
|
}
|
||||||
|
|
||||||
WCHAR* tmpSz = new WCHAR[MAX_LINE_LENGTH];
|
WCHAR* tmpSz = new WCHAR[MAX_LINE_LENGTH];
|
||||||
|
|
||||||
if (GetPrivateProfileString(L"Statistics", L"Since", L"", tmpSz, MAX_LINE_LENGTH, m_IniFile.c_str()) > 0)
|
if (GetPrivateProfileString(L"Statistics", L"Since", L"", tmpSz, MAX_LINE_LENGTH, m_StatsFile.c_str()) > 0)
|
||||||
{
|
{
|
||||||
m_StatsDate = tmpSz;
|
m_StatsDate = tmpSz;
|
||||||
}
|
}
|
||||||
@ -3697,7 +3713,7 @@ void CRainmeter::ReadStats()
|
|||||||
delete [] tmpSz;
|
delete [] tmpSz;
|
||||||
|
|
||||||
// Only Net measure has stats at the moment
|
// Only Net measure has stats at the moment
|
||||||
CMeasureNet::ReadStats(m_IniFile);
|
CMeasureNet::ReadStats(m_StatsFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -3715,12 +3731,12 @@ void CRainmeter::WriteStats(bool bForce)
|
|||||||
lastWrite = GetTickCount();
|
lastWrite = GetTickCount();
|
||||||
|
|
||||||
// Write the date for statistics
|
// Write the date for statistics
|
||||||
WritePrivateProfileString(L"Statistics", L"Since", m_StatsDate.c_str(), m_IniFile.c_str());
|
WritePrivateProfileString(L"Statistics", L"Since", m_StatsDate.c_str(), m_StatsFile.c_str());
|
||||||
|
|
||||||
// Only Net measure has stats at the moment
|
// Only Net measure has stats at the moment
|
||||||
CMeasureNet::WriteStats(m_IniFile);
|
CMeasureNet::WriteStats(m_StatsFile);
|
||||||
|
|
||||||
WritePrivateProfileString(NULL, NULL, NULL, m_IniFile.c_str());
|
WritePrivateProfileString(NULL, NULL, NULL, m_StatsFile.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -170,10 +170,6 @@ public:
|
|||||||
CTrayWindow* GetTrayWindow() { return m_TrayWindow; }
|
CTrayWindow* GetTrayWindow() { return m_TrayWindow; }
|
||||||
|
|
||||||
CMeterWindow* GetMeterWindow(const std::wstring& config);
|
CMeterWindow* GetMeterWindow(const std::wstring& config);
|
||||||
|
|
||||||
// Added by Peter Souza IV / psouza4 / 2010.12.13
|
|
||||||
//
|
|
||||||
// Read comments in Rainmeter.cpp for details.
|
|
||||||
CMeterWindow* GetMeterWindowByINI(const std::wstring& ini_searching);
|
CMeterWindow* GetMeterWindowByINI(const std::wstring& ini_searching);
|
||||||
|
|
||||||
CMeterWindow* GetMeterWindow(HWND hwnd);
|
CMeterWindow* GetMeterWindow(HWND hwnd);
|
||||||
@ -292,6 +288,7 @@ private:
|
|||||||
|
|
||||||
std::wstring m_Path; // Path to the main folder
|
std::wstring m_Path; // Path to the main folder
|
||||||
std::wstring m_IniFile; // The main ini file
|
std::wstring m_IniFile; // The main ini file
|
||||||
|
std::wstring m_StatsFile; // The statistics ini file
|
||||||
std::wstring m_LogFile; // The log file
|
std::wstring m_LogFile; // The log file
|
||||||
std::wstring m_SkinPath; // Path to the folder where the skins are
|
std::wstring m_SkinPath; // Path to the folder where the skins are
|
||||||
std::wstring m_PluginPath; // Path to the folder where the plugins are
|
std::wstring m_PluginPath; // Path to the folder where the plugins are
|
||||||
|
Loading…
Reference in New Issue
Block a user