This commit is contained in:
Birunthan Mohanathas 2012-04-06 20:54:45 +03:00
parent 873b67571a
commit 8c3fd63ffb
3 changed files with 14 additions and 32 deletions

View File

@ -752,7 +752,6 @@ CRainmeter::~CRainmeter()
/*
** The main initialization function for the module.
** May throw CErrors !!!!
**
*/
int CRainmeter::Initialize(LPCWSTR szPath)
@ -1019,7 +1018,7 @@ int CRainmeter::Initialize(LPCWSTR szPath)
if (m_Debug)
{
Log(LOG_DEBUG, L"Enumerating installed font families...");
Log(LOG_DEBUG, L"Enumerating font families...");
CMeterString::EnumerateInstalledFontFamilies();
}
@ -2030,8 +2029,7 @@ void CRainmeter::ExecuteBang(const std::wstring& name, std::wstring& arg, CMeter
}
else
{
std::wstring error = L"Unknown bang: " + name;
Log(LOG_ERROR, error.c_str());
LogWithArgs(LOG_ERROR, L"Invalid bang: ", name.c_str());
}
}

View File

@ -186,7 +186,7 @@ public:
bool GetDisableVersionCheck() { return m_DisableVersionCheck; }
void SetDisableVersionCheck(bool check);
bool GetNewVersion() { return m_NewVersion; }
void SetNewVersion(bool newver) { m_NewVersion = newver; }
void SetNewVersion() { m_NewVersion = true; }
bool GetLogging() { return m_Logging; }
void StartLogging();

View File

@ -25,8 +25,6 @@ extern CRainmeter* Rainmeter;
void CheckVersion(void* dummy)
{
int version = 0;
HINTERNET hRootHandle = InternetOpen(
L"Rainmeter",
INTERNET_OPEN_TYPE_PRECONFIG,
@ -46,38 +44,24 @@ void CheckVersion(void* dummy)
char buffer[16] = {0}; // 16 should be enough for the version number
if (InternetReadFile(hUrlDump, (LPVOID)buffer, 15, &dwSize))
{
std::string verStr = buffer;
size_t pos = verStr.find('.');
if (pos != std::wstring::npos)
int version = atoi(buffer) * 1000000;
char* pos = strchr(buffer, '.');
if (pos)
{
std::string verMajor = verStr.substr(0, pos);
std::string verMinor = verStr.substr(pos + 1);
++pos; // Skip .
version += atoi(pos) * 1000;
version = atoi(verMajor.c_str()) * 1000000;
pos = verMinor.find('.');
if (pos != std::wstring::npos)
pos = strchr(pos, '.');
if (pos)
{
std::string verMinor1 = verMinor.substr(0, pos);
std::string verMinor2 = verMinor.substr(pos + 1);
version += atoi(verMinor1.c_str()) * 1000;
version += atoi(verMinor2.c_str());
}
else
{
version += atoi(verMinor.c_str()) * 1000;
++pos; // Skip .
version += atoi(pos);
}
}
if (version > RAINMETER_VERSION)
{
Rainmeter->SetNewVersion(true);
Log(LOG_NOTICE, L"CheckUpdate: Update available");
}
else
{
Rainmeter->SetNewVersion(false);
Rainmeter->SetNewVersion();
}
}
InternetCloseHandle(hUrlDump);