mirror of
https://github.com/chibicitiberiu/rainmeter-studio.git
synced 2024-02-24 04:33:31 +00:00
Skin Installer: Fixed custom header bitmap with new format .rmskin
This commit is contained in:
parent
4647c44d92
commit
54fcd21e03
@ -373,13 +373,14 @@ bool CDialogInstall::ReadPackage()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Temporary file to extract the options file and header bitmap
|
|
||||||
WCHAR tempFile[MAX_PATH];
|
|
||||||
GetTempPath(MAX_PATH, tempFile);
|
|
||||||
GetTempFileName(tempFile, L"dat", 0, tempFile);
|
|
||||||
|
|
||||||
WCHAR buffer[MAX_PATH];
|
WCHAR buffer[MAX_PATH];
|
||||||
|
|
||||||
|
// Get temporary file to extract the options file and header bitmap
|
||||||
|
GetTempPath(MAX_PATH, buffer);
|
||||||
|
GetTempFileName(buffer, L"dat", 0, buffer);
|
||||||
|
std::wstring tempFile = buffer;
|
||||||
|
const WCHAR* tempFileSz = tempFile.c_str();
|
||||||
|
|
||||||
// Helper to sets buffer with current file name
|
// Helper to sets buffer with current file name
|
||||||
auto getFileInfo = [&]()->bool
|
auto getFileInfo = [&]()->bool
|
||||||
{
|
{
|
||||||
@ -421,26 +422,19 @@ bool CDialogInstall::ReadPackage()
|
|||||||
++path; // Skip slash
|
++path; // Skip slash
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_wcsicmp(path, m_PackageFormat == PackageFormat::New ? L"RMSKIN.bmp" : L"Rainstaller.bmp") == 0)
|
if (_wcsicmp(path, m_PackageFormat == PackageFormat::New ? L"RMSKIN.ini" : L"Rainstaller.cfg") == 0)
|
||||||
{
|
{
|
||||||
if (!ExtractCurrentFile(tempFile))
|
if (ExtractCurrentFile(tempFile))
|
||||||
{
|
{
|
||||||
break;
|
optionsFound = ReadOptions(tempFileSz);
|
||||||
|
DeleteFile(tempFileSz);
|
||||||
}
|
}
|
||||||
|
|
||||||
HBITMAP header = (HBITMAP)LoadImage(NULL, tempFile, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
|
|
||||||
SendMessage(GetDlgItem(m_Window, IDC_INSTALL_HEADER_BITMAP), STM_SETIMAGE, (WPARAM)IMAGE_BITMAP, (LPARAM)header);
|
|
||||||
}
|
|
||||||
else if (_wcsicmp(path, m_PackageFormat == PackageFormat::New ? L"RMSKIN.ini" : L"Rainstaller.cfg") == 0)
|
|
||||||
{
|
|
||||||
optionsFound = ExtractCurrentFile(tempFile) && ReadOptions(tempFile);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
while (unzGoToNextFile(m_PackageUnzFile) == UNZ_OK);
|
while (unzGoToNextFile(m_PackageUnzFile) == UNZ_OK);
|
||||||
|
|
||||||
DeleteFile(tempFile);
|
|
||||||
|
|
||||||
if (!optionsFound)
|
if (!optionsFound)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
@ -473,6 +467,19 @@ bool CDialogInstall::ReadPackage()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
if (_wcsicmp(component, m_PackageFormat == PackageFormat::New ? L"RMSKIN.bmp" : L"Rainstaller.bmp") == 0)
|
||||||
|
{
|
||||||
|
if (!ExtractCurrentFile(tempFile))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
HBITMAP bitmap = (HBITMAP)LoadImage(NULL, tempFileSz, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
|
||||||
|
HWND header = GetDlgItem(m_Window, IDC_INSTALL_HEADER_BITMAP);
|
||||||
|
SendMessage(header, STM_SETIMAGE, (WPARAM)IMAGE_BITMAP, (LPARAM)bitmap);
|
||||||
|
DeleteFile(tempFileSz);
|
||||||
|
}
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -258,8 +258,8 @@ bool CDialogPackage::CreatePackage()
|
|||||||
};
|
};
|
||||||
|
|
||||||
if (!m_ZipFile ||
|
if (!m_ZipFile ||
|
||||||
!AddFileToPackage(tempFile, L"RMSKIN.ini") ||
|
(!c_Dialog->m_HeaderFile.empty() && !AddFileToPackage(c_Dialog->m_HeaderFile.c_str(), L"RMSKIN.bmp")) ||
|
||||||
(!c_Dialog->m_HeaderFile.empty() && !AddFileToPackage(c_Dialog->m_HeaderFile.c_str(), L"RMSKIN.bmp")))
|
!AddFileToPackage(tempFile, L"RMSKIN.ini"))
|
||||||
{
|
{
|
||||||
std::wstring error = L"Unable to create package.";
|
std::wstring error = L"Unable to create package.";
|
||||||
error += L"\n\nClick OK to close Packager.";
|
error += L"\n\nClick OK to close Packager.";
|
||||||
|
Loading…
Reference in New Issue
Block a user