SkinInstaller: Remove "UseD2D" in installed themes

This commit is contained in:
Birunthan Mohanathas 2013-10-06 17:25:03 +03:00
parent 6248f07634
commit 9085f2ae20
2 changed files with 22 additions and 2 deletions

View File

@ -808,8 +808,7 @@ bool DialogInstall::InstallPackage()
error = !ExtractCurrentFile(targetPath); error = !ExtractCurrentFile(targetPath);
if (!error) if (!error)
{ {
// Clear the [Rainmeter] section. CleanLayoutFile(targetPath.c_str());
WritePrivateProfileSection(L"Rainmeter", L"", targetPath.c_str());
} }
} }
} }
@ -1043,6 +1042,25 @@ void DialogInstall::LaunchRainmeter()
} }
} }
void DialogInstall::CleanLayoutFile(const WCHAR* file)
{
// Clear the [Rainmeter] section.
WritePrivateProfileSection(L"Rainmeter", L"", file);
// Remove the UseD2D key from all sections.
WCHAR buffer[4096];
if (GetPrivateProfileSectionNames(buffer, _countof(buffer), file) > 0)
{
const WCHAR* section = buffer;
size_t sectionLength = 0;
while ((sectionLength = wcslen(section)) > 0)
{
WritePrivateProfileString(section, L"UseD2D", nullptr, file);
section += sectionLength + 1;
}
}
}
// Helper for the IsIgnore... functions. // Helper for the IsIgnore... functions.
bool IsIgnoredName(const WCHAR* name, const WCHAR* names[], int namesCount) bool IsIgnoredName(const WCHAR* name, const WCHAR* names[], int namesCount)
{ {

View File

@ -88,6 +88,8 @@ private:
void LaunchRainmeter(); void LaunchRainmeter();
void KeepVariables(); void KeepVariables();
static void CleanLayoutFile(const WCHAR* file);
static bool IsIgnoredSkin(const WCHAR* name); static bool IsIgnoredSkin(const WCHAR* name);
static bool IsIgnoredLayout(const WCHAR* name); static bool IsIgnoredLayout(const WCHAR* name);
static bool IsIgnoredAddon(const WCHAR* name); static bool IsIgnoredAddon(const WCHAR* name);