Merge branch 'release/v7.5.0' into develop

This commit is contained in:
SimplestStudio
2023-10-18 16:35:21 +03:00
90 changed files with 4606 additions and 3504 deletions

View File

@ -164,6 +164,15 @@ auto restartService()->void
CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);
}
auto verToAppVer(const wstring &ver)->wstring
{
size_t pos = ver.find(L'.');
if (pos == std::wstring::npos)
return ver;
pos = ver.find(L'.', pos + 1);
return (pos == std::wstring::npos) ? ver : ver.substr(0, pos);
}
#endif
CSvcManager::CSvcManager():
@ -310,8 +319,7 @@ void CSvcManager::onCompleteUnzip(const int error)
} else
if (error == UNZIP_ERROR) {
tstring error(_T("An error occured while unpacking the archive"));
if (!m_socket->sendMessage(MSG_OtherError, error))
if (!m_socket->sendMessage(MSG_OtherError, _T("SVC_TXT_ERR_UNPACKING")))
NS_Logger::WriteLog(DEFAULT_ERROR_MESSAGE);
} else
@ -339,18 +347,18 @@ void CSvcManager::onCompleteSlot(const int error, const tstring &filePath)
// Pause or Stop
} else
if (error == -1) {
m_socket->sendMessage(MSG_OtherError, _T("Update download failed: out of memory!"));
m_socket->sendMessage(MSG_OtherError, _T("SVC_TXT_ERR_DNL_OUT_MEM"));
} else
if (error == -2) {
m_socket->sendMessage(MSG_OtherError, _T("Update download failed: server connection error!"));
m_socket->sendMessage(MSG_OtherError, _T("SVC_TXT_ERR_DNL_CONN"));
} else
if (error == -3) {
m_socket->sendMessage(MSG_OtherError, _T("Update download failed: wrong URL!"));
m_socket->sendMessage(MSG_OtherError, _T("SVC_TXT_ERR_DNL_URL"));
} else
if (error == -4) {
m_socket->sendMessage(MSG_OtherError, _T("Update download failed: unable to create file!"));
m_socket->sendMessage(MSG_OtherError, _T("SVC_TXT_ERR_DNL_CREAT"));
} else {
m_socket->sendMessage(MSG_OtherError, _T("Update download failed: network error!"));
m_socket->sendMessage(MSG_OtherError, _T("SVC_TXT_ERR_DNL_INET"));
}
}
@ -536,7 +544,7 @@ void CSvcManager::startReplacingFiles(const tstring &packageType, const bool res
wstring app_key(app_name);
app_key += (packageType == TEXT("iss")) ? L"_is1" : L"";
if (RegOpenKeyEx(hKey, app_key.c_str(), 0, KEY_ALL_ACCESS, &hAppKey) == ERROR_SUCCESS) {
wstring disp_name = app_name + L" " + ver + L" (" + currentArch().substr(1) + L")";
wstring disp_name = app_name + L" " + verToAppVer(ver) + L" (" + currentArch().substr(1) + L")";
if (RegSetValueEx(hAppKey, TEXT("DisplayName"), 0, REG_SZ, (const BYTE*)disp_name.c_str(), (DWORD)(disp_name.length() + 1) * sizeof(WCHAR)) != ERROR_SUCCESS)
NS_Logger::WriteLog(L"Can't update DisplayName in registry!");
if (RegSetValueEx(hAppKey, TEXT("DisplayVersion"), 0, REG_SZ, (const BYTE*)ver.c_str(), (DWORD)(ver.length() + 1) * sizeof(WCHAR)) != ERROR_SUCCESS)