develop
kaetemi 4 years ago
parent c069b70ce8
commit 298e912949

@ -698,7 +698,7 @@ void CItemGroupManager::listGroup()
{
CItemGroup group = _Groups[i];
string msg = NLMISC::CI18N::get("cmdListGroupLine");
//Use ucstring because group name can contain accentued characters (and stuff like that)
//Use utf-8 string because group name can contain accentued characters (and stuff like that)
string nameUC = group.name;
NLMISC::strFindReplace(msg, "%name", nameUC);
NLMISC::strFindReplace(msg, "%size", NLMISC::toString(group.Items.size()));

@ -199,7 +199,7 @@ void setLoginFinished( bool f )
// ***************************************************************************
// Pop a fatal error message box, giving the option to 'quit' the client, plus a help button
static void fatalMessageBox(const ucstring &msg)
static void fatalMessageBox(const std::string &msg)
{
CInterfaceManager *im = CInterfaceManager::getInstance();
im->messageBoxWithHelp(msg, "ui:login", "login_quit");
@ -207,7 +207,7 @@ static void fatalMessageBox(const ucstring &msg)
// ***************************************************************************
// Pop an error message box, giving the option to go back to main menu, plus a help button
static void errorMessageBox(const ucstring &msg)
static void errorMessageBox(const std::string &msg)
{
CInterfaceManager *im = CInterfaceManager::getInstance();
im->messageBoxWithHelp(msg, "ui:login", "on_back_to_login");
@ -281,25 +281,25 @@ void initEula()
}
// ***************************************************************************
static void setDataScanLog(const ucstring &text)
static void setDataScanLog(const std::string &text)
{
CInterfaceManager *pIM= CInterfaceManager::getInstance();
CViewText *pVT = dynamic_cast<CViewText*>(CWidgetManager::getInstance()->getElementFromId("ui:login:datascan:content:log_txt:log"));
if (pVT != NULL)
{
pVT->setText(text.toUtf8());
pVT->setText(text);
}
}
// ***************************************************************************
static void setDataScanState(const ucstring &text, ucstring progress= ucstring())
static void setDataScanState(const std::string &text, const std::string &progress = string())
{
CInterfaceManager *pIM= CInterfaceManager::getInstance();
CViewText *pVT = dynamic_cast<CViewText*>(CWidgetManager::getInstance()->getElementFromId("ui:login:datascan:content:state"));
if (pVT != NULL) pVT->setText(text.toUtf8());
if (pVT != NULL) pVT->setText(text);
pVT = dynamic_cast<CViewText*>(CWidgetManager::getInstance()->getElementFromId("ui:login:datascan:content:progress"));
if (pVT != NULL) pVT->setText(progress.toUtf8());
if (pVT != NULL) pVT->setText(progress);
}
void initCatDisplay()
@ -332,24 +332,24 @@ void initReboot()
// ***************************************************************************
static void setPatcherStateText(const std::string &baseUIPath, const ucstring &str)
static void setPatcherStateText(const std::string &baseUIPath, const std::string &str)
{
CInterfaceManager *pIM = CInterfaceManager::getInstance();
CViewText *pVT = dynamic_cast<CViewText*>(CWidgetManager::getInstance()->getElementFromId(baseUIPath + ":content:state"));
if (pVT != NULL)
{
pVT->setText(str.toUtf8());
pVT->setText(str);
}
}
// ***************************************************************************
static void setPatcherProgressText(const std::string &baseUIPath, const ucstring &str)
static void setPatcherProgressText(const std::string &baseUIPath, const std::string &str)
{
CInterfaceManager *pIM = CInterfaceManager::getInstance();
CViewText *pVT = dynamic_cast<CViewText*>(CWidgetManager::getInstance()->getElementFromId(baseUIPath + ":content:progress"));
if (pVT != NULL)
{
pVT->setText(str.toUtf8());
pVT->setText(str);
}
}
@ -365,7 +365,7 @@ static void updatePatchingInfoText(const std::string &baseUIPath)
if (bgDownloader.getDownloadThreadPriority() == BGDownloader::ThreadPriority_Paused)
{
setPatcherStateText(baseUIPath, CI18N::get("uiBGD_Paused"));
setPatcherProgressText(baseUIPath, ucstring());
setPatcherProgressText(baseUIPath, string());
}
else
{
@ -376,15 +376,15 @@ static void updatePatchingInfoText(const std::string &baseUIPath)
}
else
{
setPatcherProgressText(baseUIPath, ucstring());
setPatcherProgressText(baseUIPath, string());
}
}
}
else
#endif
{
ucstring state;
vector<ucstring> log;
string state;
vector<string> log;
if(pPM->getThreadState(state, log))
{
setPatcherStateText(baseUIPath, state);
@ -394,7 +394,7 @@ static void updatePatchingInfoText(const std::string &baseUIPath)
}
else
{
setPatcherProgressText(baseUIPath, ucstring());
setPatcherProgressText(baseUIPath, string());
}
}
}
@ -481,8 +481,8 @@ void loginMainLoop()
if (finished)
{
setPatcherStateText("ui:login:checking", ucstring());
setPatcherProgressText("ui:login:checking", ucstring());
setPatcherStateText("ui:login:checking", string());
setPatcherProgressText("ui:login:checking", string());
#ifdef RYZOM_BG_DOWNLOADER
if (isBGDownloadEnabled())
@ -561,7 +561,7 @@ void loginMainLoop()
}
else
{
ucstring errMsg = CI18N::get("uiErrChecking");
string errMsg = CI18N::get("uiErrChecking");
if (!pPM->getLastErrorMessage().empty())
{
errMsg = pPM->getLastErrorMessage();
@ -604,14 +604,14 @@ void loginMainLoop()
setDataScanState(CI18N::get("uiScanDataSucess"));
else
{
ucstring fmt= CI18N::get("uiScanDataErrors");
string fmt= CI18N::get("uiScanDataErrors");
strFindReplace(fmt, "%d", toString(numFiles));
setDataScanState(fmt);
}
}
else
{
ucstring errMsg = CI18N::get("uiErrDataScanning");
string errMsg = CI18N::get("uiErrDataScanning");
if (!pPM->getLastErrorMessage().empty())
{
errMsg = pPM->getLastErrorMessage();
@ -620,7 +620,7 @@ void loginMainLoop()
}
// the log may have changed
ucstring dsLog;
string dsLog;
if(pPM->getDataScanLog(dsLog))
setDataScanLog(dsLog);
}
@ -628,8 +628,8 @@ void loginMainLoop()
else
{
// update inteface content
ucstring state;
vector<ucstring> log;
string state;
vector<string> log;
// get state
if(pPM->getThreadState(state, log))
{
@ -637,7 +637,7 @@ void loginMainLoop()
setDataScanState(state, toString("%d/%d", pPM->getCurrentFilesToGet(), pPM->getTotalFilesToGet()));
}
// set special data scan log
ucstring dsLog;
string dsLog;
if(pPM->getDataScanLog(dsLog))
setDataScanLog(dsLog);
}
@ -704,7 +704,7 @@ void loginMainLoop()
}
else
{
ucstring errMsg = CI18N::get("uiErrPatchApply");
string errMsg = CI18N::get("uiErrPatchApply");
if (!pPM->getLastErrorMessage().empty())
{
errMsg = pPM->getLastErrorMessage();
@ -1157,8 +1157,8 @@ void initPatchCheck()
#endif
NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:SCREEN")->setValue32(UI_VARIABLES_SCREEN_CHECKING);
setPatcherStateText("ui:login:checking", ucstring());
setPatcherProgressText("ui:login:checking", ucstring());
setPatcherStateText("ui:login:checking", string());
setPatcherProgressText("ui:login:checking", string());
}
void initShardDisplay()
@ -1717,8 +1717,8 @@ void initPatch()
if (closeBtn)
closeBtn->setActive(false);
setPatcherStateText("ui:login:patching", ucstring());
setPatcherProgressText("ui:login:patching", ucstring());
setPatcherStateText("ui:login:patching", string());
setPatcherProgressText("ui:login:patching", string());
}
// ***************************************************************************
@ -2274,7 +2274,7 @@ void initDataScan()
CPatchManager *pPM = CPatchManager::getInstance();
// reset the log
setDataScanLog(ucstring());
setDataScanLog(string());
// Start Scanning
pPM->startScanDataThread();
@ -2442,26 +2442,26 @@ bool initCreateAccount()
if(!CurlHttpClient.sendGet(url, params, pPM->isVerboseLog()))
{
ucstring errorMessage("Can't send (error code 60)");
string errorMessage("Can't send (error code 60)");
errorMessageBox(errorMessage);
nlwarning(errorMessage.toString().c_str());
nlwarning(errorMessage.c_str());
return false;
}
string res;
if(!CurlHttpClient.receive(res, pPM->isVerboseLog()))
{
ucstring errorMessage("Can't receive (error code 61)");
string errorMessage("Can't receive (error code 61)");
errorMessageBox(errorMessage);
nlwarning(errorMessage.toString().c_str());
nlwarning(errorMessage.c_str());
return false;
}
if(res.empty())
{
ucstring errorMessage("Empty result (error code 13)");
string errorMessage("Empty result (error code 13)");
errorMessageBox(errorMessage);
nlwarning(errorMessage.toString().c_str());
nlwarning(errorMessage.c_str());
return false;
}
@ -2618,9 +2618,9 @@ class CAHOnCreateAccountSubmit : public IActionHandler
if (!CurlHttpClient.connect(url))
{
ucstring errorMessage("Can't connect");
string errorMessage("Can't connect");
errorMessageBox(errorMessage);
nlwarning(errorMessage.toString().c_str());
nlwarning(errorMessage.c_str());
return;
}
@ -2645,26 +2645,26 @@ class CAHOnCreateAccountSubmit : public IActionHandler
if(!CurlHttpClient.sendPost(url, params, pPM->isVerboseLog()))
{
ucstring errorMessage("Can't send (error code 60)");
string errorMessage("Can't send (error code 60)");
errorMessageBox(errorMessage);
nlwarning(errorMessage.toString().c_str());
nlwarning(errorMessage.c_str());
return;
}
string res;
if(!CurlHttpClient.receive(res, pPM->isVerboseLog()))
{
ucstring errorMessage("Can't receive (error code 61)");
string errorMessage("Can't receive (error code 61)");
errorMessageBox(errorMessage);
nlwarning(errorMessage.toString().c_str());
nlwarning(errorMessage.c_str());
return;
}
if(res.empty())
{
ucstring errorMessage("Empty result (error code 13)");
string errorMessage("Empty result (error code 13)");
errorMessageBox(errorMessage);
nlwarning(errorMessage.toString().c_str());
nlwarning(errorMessage.c_str());
return;
}

@ -189,7 +189,7 @@ void CPatchManager::setClientRootPath(const std::string& clientRootPath)
}
// ****************************************************************************
void CPatchManager::setErrorMessage(const ucstring &message)
void CPatchManager::setErrorMessage(const std::string &message)
{
_ErrorMessage = message;
}
@ -656,7 +656,7 @@ bool CPatchManager::isPatchThreadEnded (bool &ok)
// ****************************************************************************
// Called in main thread
bool CPatchManager::getThreadState (ucstring &stateOut, vector<ucstring> &stateLogOut)
bool CPatchManager::getThreadState (std::string &stateOut, vector<string> &stateLogOut)
{
if ((PatchThread == NULL) && (CheckThread == NULL) && (ScanDataThread==NULL))
return false;
@ -685,7 +685,7 @@ bool CPatchManager::getThreadState (ucstring &stateOut, vector<ucstring> &stateL
// verbose log
if (isVerboseLog() && !stateLogOut.empty())
for (uint32 i = 0; i < stateLogOut.size(); ++i)
nlinfo("%s", stateLogOut[i].toUtf8().c_str());
nlinfo("%s", stateLogOut[i].c_str());
return changed;
}
@ -1120,28 +1120,28 @@ float CPatchManager::getCurrentFileProgress() const
// ****************************************************************************
void CPatchManager::setRWAccess (const string &filename, bool bThrowException)
{
ucstring s = CI18N::get("uiSetAttrib") + " " + CFile::getFilename(filename);
string s = CI18N::get("uiSetAttrib") + " " + CFile::getFilename(filename);
setState(true, s);
if (!NLMISC::CFile::setRWAccess(filename) && bThrowException)
{
s = CI18N::get("uiAttribErr") + " " + CFile::getFilename(filename) + " (" + toString(errno) + "," + strerror(errno) + ")";
setState(true, s);
throw Exception (s.toUtf8());
throw Exception (s);
}
}
// ****************************************************************************
string CPatchManager::deleteFile (const string &filename, bool bThrowException, bool bWarning)
{
ucstring s = CI18N::get("uiDelFile") + " " + CFile::getFilename(filename);
string s = CI18N::get("uiDelFile") + " " + CFile::getFilename(filename);
setState(true, s);
if (!NLMISC::CFile::fileExists(filename))
{
s = CI18N::get("uiDelNoFile");
setState(true, s);
return s.toUtf8();
return s;
}
if (!NLMISC::CFile::deleteFile(filename))
@ -1150,8 +1150,8 @@ string CPatchManager::deleteFile (const string &filename, bool bThrowException,
if(bWarning)
setState(true, s);
if(bThrowException)
throw Exception (s.toUtf8());
return s.toUtf8();
throw Exception (s);
return s;
}
return "";
}
@ -1159,20 +1159,20 @@ string CPatchManager::deleteFile (const string &filename, bool bThrowException,
// ****************************************************************************
void CPatchManager::renameFile (const string &src, const string &dst)
{
ucstring s = CI18N::get("uiRenameFile") + " " + NLMISC::CFile::getFilename(src);
string s = CI18N::get("uiRenameFile") + " " + NLMISC::CFile::getFilename(src);
setState(true, s);
if (!NLMISC::CFile::moveFile(dst, src))
{
s = CI18N::get("uiRenameErr") + " " + src + " -> " + dst + " (" + toString(errno) + "," + strerror(errno) + ")";
setState(true, s);
throw Exception (s.toUtf8());
throw Exception (s);
}
}
// ****************************************************************************
// Take care this function is called by the thread
void CPatchManager::setState (bool bOutputToLog, const ucstring &ucsNewState)
void CPatchManager::setState (bool bOutputToLog, const string &ucsNewState)
{
{
CSynchronized<CState>::CAccessor as(&State);
@ -1342,7 +1342,7 @@ void CPatchManager::getServerFile (const std::string &name, bool bZipped, const
try
{
ucstring s = CI18N::get("uiLoginGetFile") + " " + NLMISC::CFile::getFilename(srcName);
string s = CI18N::get("uiLoginGetFile") + " " + NLMISC::CFile::getFilename(srcName);
setState(true, s);
// get the new file
@ -1364,13 +1364,13 @@ void CPatchManager::getServerFile (const std::string &name, bool bZipped, const
// if emergency patch server, this is a real issue, rethrow exception
if (UsedServer < 0)
{
ucstring s = CI18N::get("uiDLFailed");
string s = CI18N::get("uiDLFailed");
setState(true, s);
throw Exception(e.what());
}
ucstring s = CI18N::get("uiDLURIFailed") + " " + serverDisplayPath;
string s = CI18N::get("uiDLURIFailed") + " " + serverDisplayPath;
setState(true, s);
// this server is unavailable
@ -1384,7 +1384,7 @@ void CPatchManager::getServerFile (const std::string &name, bool bZipped, const
// scanned all servers? use alternative
if (nextServer == UsedServer)
{
ucstring s = CI18N::get("uiNoMoreURI");
string s = CI18N::get("uiNoMoreURI");
setState(true, s);
UsedServer = -1;
nlwarning("EXCEPTION CATCH: getServerFile() failed - no alternative found");
@ -1409,7 +1409,7 @@ void CPatchManager::downloadFileWithCurl (const string &source, const string &de
try
{
#ifdef USE_CURL
ucstring s = CI18N::get("uiDLWithCurl") + " " + CFile::getFilename(dest);
string s = CI18N::get("uiDLWithCurl") + " " + CFile::getFilename(dest);
setState(true, s);
// user agent = nel_launcher
@ -1417,7 +1417,7 @@ void CPatchManager::downloadFileWithCurl (const string &source, const string &de
CURL *curl;
CURLcode res;
ucstring sTranslate = CI18N::get("uiLoginGetFile") + " " + NLMISC::CFile::getFilename (source);
string sTranslate = CI18N::get("uiLoginGetFile") + " " + NLMISC::CFile::getFilename (source);
setState(true, sTranslate);
CurrentFile = NLMISC::CFile::getFilename (source);
@ -1566,7 +1566,7 @@ void CPatchManager::downloadFile (const string &source, const string &dest, NLMI
void CPatchManager::decompressFile (const string &filename)
{
ucstring sTranslate = CI18N::get("uiDecompressing") + " " + NLMISC::CFile::getFilename(filename);
string sTranslate = CI18N::get("uiDecompressing") + " " + NLMISC::CFile::getFilename(filename);
setState(true, sTranslate);
//if(isVerboseLog()) nlinfo("Calling gzopen('%s','rb')", filename.c_str());
@ -1664,7 +1664,7 @@ void CPatchManager::applyDate (const string &sFilename, uint32 nDate)
if(nDate != 0)
{
setRWAccess(sFilename, false);
ucstring s = CI18N::get("uiChangeDate") + " " + NLMISC::CFile::getFilename(sFilename) + " " + timestampToHumanReadable(NLMISC::CFile::getFileModificationDate (sFilename)) +
string s = CI18N::get("uiChangeDate") + " " + NLMISC::CFile::getFilename(sFilename) + " " + timestampToHumanReadable(NLMISC::CFile::getFileModificationDate (sFilename)) +
" -> " + timestampToHumanReadable(nDate);
setState(true,s);
@ -1786,7 +1786,7 @@ void CPatchManager::getPatchFromDesc(SFileToPatch &ftpOut, const CBNPFile &fIn,
// If the version cannot be found with size and time try with sha1
if (nVersionFound == 0xFFFFFFFF)
{
ucstring sTranslate = CI18N::get("uiCheckInt") + " " + rFilename;
string sTranslate = CI18N::get("uiCheckInt") + " " + rFilename;
setState(true, sTranslate);
CHashKey hkLocalSHA1 = getSHA1(sFilePath);
for (j = 0; j < rFile.versionCount(); ++j)
@ -1806,7 +1806,7 @@ void CPatchManager::getPatchFromDesc(SFileToPatch &ftpOut, const CBNPFile &fIn,
// No version available found
if (nVersionFound == 0xFFFFFFFF)
{
ucstring sTranslate = CI18N::get("uiNoVersionFound");
string sTranslate = CI18N::get("uiNoVersionFound");
setState(true, sTranslate);
// Get all patches from beginning (first patch is reference file)
ftpOut.FileName = rFilename;
@ -1827,7 +1827,7 @@ void CPatchManager::getPatchFromDesc(SFileToPatch &ftpOut, const CBNPFile &fIn,
}
else // A version of the file has been found
{
ucstring sTranslate = CI18N::get("uiVersionFound") + " " + toString(nVersionFound);
string sTranslate = CI18N::get("uiVersionFound") + " " + toString(nVersionFound);
setState(true, sTranslate);
// Get All patches from this version !
ftpOut.FileName = rFilename;
@ -1883,7 +1883,7 @@ bool CPatchManager::bnpUnpack(const string &srcBigfile, const string &dstPath, v
else
DestPath = CPath::standardizePath (dstPath);
ucstring s = CI18N::get("uiUnpack") + " " + NLMISC::CFile::getFilename(SourceName);
string s = CI18N::get("uiUnpack") + " " + NLMISC::CFile::getFilename(SourceName);
setState(true,s);
// Read Header of the BNP File
@ -1892,7 +1892,7 @@ bool CPatchManager::bnpUnpack(const string &srcBigfile, const string &dstPath, v
if (!bnpFile.readHeader())
{
ucstring s = CI18N::get("uiUnpackErrHead") + " " + CFile::getFilename(SourceName);
string s = CI18N::get("uiUnpackErrHead") + " " + CFile::getFilename(SourceName);
setState(true,s);
return false;
}
@ -1938,8 +1938,8 @@ int CPatchManager::validateProgress(void *foo, double t, double d, double /* ult
CPatchManager *pPM = CPatchManager::getInstance();
double pour1 = t!=0.0?d*100.0/t:0.0;
ucstring sTranslate = CI18N::get("uiLoginGetFile") + ucstring::makeFromUtf8(toString(" %s : %s / %s (%.02f %%)", NLMISC::CFile::getFilename(pPM->CurrentFile).c_str(),
NLMISC::bytesToHumanReadableUnits((uint64)d, units).c_str(), NLMISC::bytesToHumanReadableUnits((uint64)t, units).c_str(), pour1));
string sTranslate = CI18N::get("uiLoginGetFile") + toString(" %s : %s / %s (%.02f %%)", NLMISC::CFile::getFilename(pPM->CurrentFile).c_str(),
NLMISC::bytesToHumanReadableUnits((uint64)d, units).c_str(), NLMISC::bytesToHumanReadableUnits((uint64)t, units).c_str(), pour1);
pPM->setState(false, sTranslate);
if (foo)
{
@ -1953,7 +1953,7 @@ void CPatchManager::MyPatchingCB::progress(float f)
{
CPatchManager *pPM = CPatchManager::getInstance();
double p = 100.0*f;
ucstring sTranslate = CI18N::get("uiApplyingDelta") + ucstring::makeFromUtf8(toString(" %s (%.02f %%)", CFile::getFilename(patchFilename).c_str(), p));
string sTranslate = CI18N::get("uiApplyingDelta") + toString(" %s (%.02f %%)", CFile::getFilename(patchFilename).c_str(), p);
pPM->setState(false, sTranslate);
}
@ -2079,7 +2079,7 @@ uint CPatchManager::applyScanDataResult()
}
// ***************************************************************************
bool CPatchManager::getDataScanLog(ucstring &text)
bool CPatchManager::getDataScanLog(string &text)
{
text.clear();
bool changed= false;
@ -2092,7 +2092,7 @@ bool CPatchManager::getDataScanLog(ucstring &text)
{
for(uint i=0;i<val.FilesWithScanDataError.size();i++)
{
ucstring str;
string str;
getCorruptedFileInfo(val.FilesWithScanDataError[i], str);
text+= str + "\n";
}
@ -2127,9 +2127,9 @@ void CPatchManager::clearDataScanLog()
}
// ***************************************************************************
void CPatchManager::getCorruptedFileInfo(const SFileToPatch &ftp, ucstring &sTranslate)
void CPatchManager::getCorruptedFileInfo(const SFileToPatch &ftp, string &sTranslate)
{
sTranslate = CI18N::get("uiCorruptedFile") + " " + ucstring::makeFromUtf8(ftp.FileName) + " (" +
sTranslate = CI18N::get("uiCorruptedFile") + " " + ftp.FileName + " (" +
toString("%.1f ", (float)ftp.FinalFileSize/1000000.f) + CI18N::get("uiMb") + ")";
}
@ -2167,7 +2167,7 @@ void CCheckThread::run ()
// Check if the client version is the same as the server version
string sClientVersion = pPM->getClientVersion();
string sServerVersion = pPM->getServerVersion();
ucstring sTranslate = CI18N::get("uiClientVersion") + " (" + sClientVersion + ") ";
string sTranslate = CI18N::get("uiClientVersion") + " (" + sClientVersion + ") ";
sTranslate += CI18N::get("uiServerVersion") + " (" + sServerVersion + ")";
pPM->setState(true, sTranslate);
@ -2216,7 +2216,7 @@ void CCheckThread::run ()
for (i = 0; i < rDescFiles.fileCount(); ++i)
{
CPatchManager::SFileToPatch ftp;
sTranslate = CI18N::get("uiCheckingFile") + " " + ucstring::makeFromUtf8(rDescFiles.getFile(i).getFileName());
sTranslate = CI18N::get("uiCheckingFile") + " " + rDescFiles.getFile(i).getFileName();
pPM->setState(true, sTranslate);
// get list of patch to apply to this file. don't to a full checksum test if possible
nlwarning(rDescFiles.getFile(i).getFileName().c_str());
@ -2408,7 +2408,7 @@ void CCheckThread::run ()
catch (const Exception &e)
{
nlwarning("EXCEPTION CATCH: CCheckThread::run() failed");
ucstring sTranslate = CI18N::get("uiCheckEndWithErr") + " " + e.what();
string sTranslate = CI18N::get("uiCheckEndWithErr") + " " + e.what();
pPM->setState(true, CI18N::get("uiCheckEndWithErr"));
pPM->setErrorMessage(sTranslate);
CheckOk = false;
@ -2478,7 +2478,7 @@ void CPatchThread::run()
CurrentFilePatched = 0.f;
ucstring sTranslate;
string sTranslate;
try
{
// First do all ref files
@ -2536,7 +2536,7 @@ void CPatchThread::run()
catch(const Exception &e)
{
nlwarning("EXCEPTION CATCH: CPatchThread::run() failed");
pPM->setState(true, ucstring(e.what()));
pPM->setState(true, string(e.what()));
sTranslate = CI18N::get("uiPatchEndWithErr");
bErr = true;
}
@ -2649,7 +2649,7 @@ void CPatchThread::processFile (CPatchManager::SFileToPatch &rFTP)
rFTP.LocalFileExists = false;
}
ucstring sTranslate;
string sTranslate;
sTranslate = CI18N::get("uiProcessing") + " " + rFTP.FileName;
pPM->setState(true, sTranslate);
@ -2984,7 +2984,7 @@ void CScanDataThread::run ()
uint32 i;
// Check if the client version is the same as the server version
string sClientVersion = pPM->getClientVersion();
ucstring sTranslate = CI18N::get("uiClientVersion") + " (" + sClientVersion + ") ";
string sTranslate = CI18N::get("uiClientVersion") + " (" + sClientVersion + ") ";
pPM->setState(true, sTranslate);
// For all bnp in the description file get all patches to apply
@ -3023,7 +3023,7 @@ void CScanDataThread::run ()
catch (const Exception &e)
{
nlwarning("EXCEPTION CATCH: CScanDataThread::run() failed");
ucstring sTranslate = CI18N::get("uiCheckEndWithErr") + " " + e.what();
string sTranslate = CI18N::get("uiCheckEndWithErr") + " " + e.what();
pPM->setState(true, sTranslate);
CheckOk = false;
Ended = true;
@ -3157,7 +3157,7 @@ bool CPatchManager::download(const std::string& patchFullname, const std::string
catch ( const std::exception& e)
{
nlwarning("%s", e.what());
pPM->setState(true, ucstring(e.what()) );
pPM->setState(true, string(e.what()) );
return false;
}
@ -3408,7 +3408,7 @@ void CDownloadThread::run()
catch ( const std::exception& e)
{
nlwarning("%s", e.what());
pPM->setState(true, ucstring(e.what()) );
pPM->setState(true, string(e.what()) );
pPM->fatalError("uiCanNotDownload", patchName.c_str(), "");
}
catch (...)
@ -3525,7 +3525,7 @@ void CInstallThread::run()
catch ( const std::exception& e)
{
nlwarning("%s", e.what());
pPM->setState(true, ucstring(e.what()) );
pPM->setState(true, string(e.what()) );
pPM->fatalError("uiCanNotInstall", patchName.c_str(), "");
return;

@ -56,7 +56,7 @@ public:
class IPatchManagerStateListener
{
public:
virtual void setState (bool /* bOutputToLog */, const ucstring &/* ucsNewState */){}
virtual void setState (bool /* bOutputToLog */, const std::string &/* ucsNewState */){}
};
// Get Info of file to install
@ -154,12 +154,12 @@ public:
// Get the string information about what the threads are doing
// Return true if the state has changed
bool getThreadState (ucstring &state, std::vector<ucstring> &stateLog);
bool getThreadState (std::string &state, std::vector<std::string> &stateLog);
/** Get the error message (filled after a patch of check)
* May be empty if the cause of error is unknown or unhandled
*/
const ucstring &getLastErrorMessage() { return _ErrorMessage; }
const std::string &getLastErrorMessage() { return _ErrorMessage; }
// ---------------------
// First Part : Checking
@ -235,7 +235,7 @@ public:
uint applyScanDataResult();
// get the current info Log for data Scan (true if some change from last get, else text is not filled)
bool getDataScanLog(ucstring &text);
bool getDataScanLog(std::string &text);
CProductDescriptionForClient &getDescFile() { return DescFile; }
@ -284,7 +284,7 @@ private:
friend class CPatchThreadDownloadProgress;
// Set the thread state (called by threads to let us know what they are doing)
void setState (bool bOutputToLog, const ucstring &ucsState);
void setState (bool bOutputToLog, const std::string &ucsState);
void touchState();
/// Get the version of the server given during init()
@ -330,7 +330,7 @@ private:
// add a file to the scan data log
void addDataScanLogCorruptedFile(const SFileToPatch &ftp);
void clearDataScanLog();
static void getCorruptedFileInfo(const SFileToPatch &ftp, ucstring &sTranslate);
static void getCorruptedFileInfo(const SFileToPatch &ftp, std::string &sTranslate);
static bool downloadAndUnpack(const std::string& patchPath, const std::string& sourceFilename, const std::string& extractPath, const std::string& tmpDirectory, uint32 timestamp);
// Forward message to Installation Software
@ -404,7 +404,7 @@ private:
std::vector<SFileToPatch> FilesToPatch;
std::vector<std::string> OptionalCat;
ucstring _ErrorMessage;
std::string _ErrorMessage;
// Threads
CPatchThread *PatchThread;
@ -417,8 +417,8 @@ private:
// State
struct CState
{
ucstring State;
std::vector<ucstring> StateLog;
std::string State;
std::vector<std::string> StateLog;
bool StateChanged;
CState()
{
@ -470,7 +470,7 @@ private:
bool _StartRyzomAtEnd;
public:
// used by threads to signal error at the end of execution
void setErrorMessage(const ucstring &message);
void setErrorMessage(const std::string &message);
};
/**

@ -252,8 +252,8 @@ int main(int argc, char *argv[])
pPM->init(patchURLs, PatchUrl, "");
pPM->startCheckThread(true /* include background patchs */);
ucstring state;
vector<ucstring> log;
string state;
vector<string> log;
bool res = false;
bool finished = false;

Loading…
Cancel
Save