| Line 294... |
Line 294... |
| 294 |
|
294 |
|
| 295 |
if (packed)
|
295 |
if (packed)
|
| 296 |
{
|
296 |
{
|
| 297 |
if (newfile->PCKFile())
|
297 |
if (newfile->PCKFile())
|
| 298 |
{
|
298 |
{
|
| 299 |
newfile->setFilename(CFileIO(newfile->filePointer()).changeFileExtension("pck"));
|
299 |
newfile->setFilename(CFileIO(newfile->filePointer()).changeFileExtension(L"pck").toString());
|
| 300 |
}
|
300 |
}
|
| 301 |
}
|
301 |
}
|
| 302 |
|
302 |
|
| 303 |
// first check if the file already exists
|
303 |
// first check if the file already exists
|
| 304 |
for ( CListNode<C_File> *node = m_lFiles.Front(); node; node = node->next() )
|
304 |
for ( CListNode<C_File> *node = m_lFiles.Front(); node; node = node->next() )
|
| Line 431... |
Line 431... |
| 431 |
return NULL;
|
431 |
return NULL;
|
| 432 |
}
|
432 |
}
|
| 433 |
|
433 |
|
| 434 |
C_File* CBaseFile::findFile(const Utils::String &filename, FileType type, const Utils::String &dir, int game) const
|
434 |
C_File* CBaseFile::findFile(const Utils::String &filename, FileType type, const Utils::String &dir, int game) const
|
| 435 |
{
|
435 |
{
|
| 436 |
Utils::String lfile = CFileIO(filename.lower()).filename();
|
436 |
Utils::String lfile = CFileIO(filename.lower()).filename().toString();
|
| 437 |
|
437 |
|
| 438 |
CListNode<C_File>* node = m_lFiles.Front();
|
438 |
CListNode<C_File>* node = m_lFiles.Front();
|
| 439 |
while (node)
|
439 |
while (node)
|
| 440 |
{
|
440 |
{
|
| 441 |
C_File* f = node->Data();
|
441 |
C_File* f = node->Data();
|
| Line 857... |
Line 857... |
| 857 |
void CBaseFile::_updateTextDB(C_File *file)
|
857 |
void CBaseFile::_updateTextDB(C_File *file)
|
| 858 |
{
|
858 |
{
|
| 859 |
if ( !_pTextDB ) _pTextDB = new CTextDB();
|
859 |
if ( !_pTextDB ) _pTextDB = new CTextDB();
|
| 860 |
|
860 |
|
| 861 |
if ( file->GetFileType() == FILETYPE_TEXT ) {
|
861 |
if ( file->GetFileType() == FILETYPE_TEXT ) {
|
| 862 |
Utils::String baseFile = CFileIO(file->filePointer()).baseName();
|
862 |
Utils::WString baseFile = CFileIO(file->filePointer()).baseName();
|
| 863 |
int lang = (baseFile.isin("-L")) ? baseFile.right(3) : baseFile.truncate(-4);
|
863 |
int lang = (baseFile.contains(L"-L")) ? baseFile.right(3) : baseFile.truncate(-4);
|
| 864 |
|
864 |
|
| 865 |
// read in the text file to the database
|
865 |
// read in the text file to the database
|
| 866 |
_pTextDB->parseTextFile(0, 0, file->filePointer(), lang);
|
866 |
_pTextDB->parseTextFile(0, 0, file->filePointer(), lang);
|
| 867 |
}
|
867 |
}
|
| 868 |
}
|
868 |
}
|
| Line 1079... |
Line 1079... |
| 1079 |
}
|
1079 |
}
|
| 1080 |
|
1080 |
|
| 1081 |
bool CBaseFile::_install_checkFileEnable(C_File *pCheckFile, C_File *fit, const Utils::String &sDestination, bool bEnabled, Utils::CStringList *errorStr)
|
1081 |
bool CBaseFile::_install_checkFileEnable(C_File *pCheckFile, C_File *fit, const Utils::String &sDestination, bool bEnabled, Utils::CStringList *errorStr)
|
| 1082 |
{
|
1082 |
{
|
| 1083 |
// found a file, check if its in the disabled directory
|
1083 |
// found a file, check if its in the disabled directory
|
| 1084 |
Utils::String dir = CFileIO(pCheckFile->filePointer()).dir();
|
1084 |
Utils::WString dir = CFileIO(pCheckFile->filePointer()).dir();
|
| 1085 |
Utils::String lastDir = CDirIO(dir).topDir().lower();
|
1085 |
Utils::WString lastDir = CDirIO(dir).topDir().lower();
|
| 1086 |
|
1086 |
|
| 1087 |
// if its disabled, rename it so its enabled
|
1087 |
// if its disabled, rename it so its enabled
|
| 1088 |
if ( ((pCheckFile->IsDisabled()) || (lastDir == "disabled") || (dir.lower().isin("/disabled/"))) && (bEnabled) )
|
1088 |
if ( ((pCheckFile->IsDisabled()) || (lastDir == L"disabled") || (dir.lower().contains(L"/disabled/"))) && (bEnabled) )
|
| 1089 |
{
|
1089 |
{
|
| 1090 |
CLog::logf(CLog::Log_Install, 2, "Existing file, %s, is disabled, re-enabling it", pCheckFile->filePointer().c_str());
|
1090 |
CLog::logf(CLog::Log_Install, 2, "Existing file, %s, is disabled, re-enabling it", pCheckFile->filePointer().c_str());
|
| 1091 |
// first check if the directory exists
|
1091 |
// first check if the directory exists
|
| 1092 |
if ( pCheckFile->isInMod() ) {
|
1092 |
if ( pCheckFile->isInMod() ) {
|
| 1093 |
Utils::String tofile = pCheckFile->filePointer().token("::", 2);
|
1093 |
Utils::String tofile = pCheckFile->filePointer().token("::", 2);
|
| Line 1326... |
Line 1326... |
| 1326 |
CLog::log(CLog::Log_Install, 2, "Copying data into existing file");
|
1326 |
CLog::log(CLog::Log_Install, 2, "Copying data into existing file");
|
| 1327 |
}
|
1327 |
}
|
| 1328 |
|
1328 |
|
| 1329 |
Utils::String fpointer = fit->filePointer();
|
1329 |
Utils::String fpointer = fit->filePointer();
|
| 1330 |
_iLastError = SPKERR_CREATEDIRECTORY;
|
1330 |
_iLastError = SPKERR_CREATEDIRECTORY;
|
| 1331 |
Utils::String dir = CFileIO(fit->filePointer()).dir();
|
1331 |
Utils::String dir = CFileIO(fit->filePointer()).dir().toString();
|
| 1332 |
|
1332 |
|
| 1333 |
dir = dir.findRemove(destdir);
|
1333 |
dir = dir.findRemove(destdir);
|
| 1334 |
if (!dir.empty() && (dir[0] == '/' || dir[0] == '\\'))
|
1334 |
if (!dir.empty() && (dir[0] == '/' || dir[0] == '\\'))
|
| 1335 |
dir.erase(0, 1);
|
1335 |
dir.erase(0, 1);
|
| 1336 |
|
1336 |
|
| Line 2152... |
Line 2152... |
| 2152 |
if (!data)
|
2152 |
if (!data)
|
| 2153 |
{
|
2153 |
{
|
| 2154 |
// attempt a file decompress
|
2154 |
// attempt a file decompress
|
| 2155 |
if (file->GetCompressionType() == SPKCOMPRESS_7ZIP)
|
2155 |
if (file->GetCompressionType() == SPKCOMPRESS_7ZIP)
|
| 2156 |
{
|
2156 |
{
|
| 2157 |
if (file->uncompressToFile(Dir.dir(), this, includedir, progress))
|
2157 |
if (file->uncompressToFile(Dir.dir().toString(), this, includedir, progress))
|
| 2158 |
return true;
|
2158 |
return true;
|
| 2159 |
}
|
2159 |
}
|
| 2160 |
return false;
|
2160 |
return false;
|
| 2161 |
}
|
2161 |
}
|
| 2162 |
|
2162 |
|
| 2163 |
if (!file->writeToDir(Dir.dir(), this, includedir, Utils::String::Null(), data, len))
|
2163 |
if (!file->writeToDir(Dir.dir().toString(), this, includedir, Utils::String::Null(), data, len))
|
| 2164 |
return false;
|
2164 |
return false;
|
| 2165 |
|
2165 |
|
| 2166 |
return true;
|
2166 |
return true;
|
| 2167 |
|
2167 |
|
| 2168 |
}
|
2168 |
}
|
| Line 2248... |
Line 2248... |
| 2248 |
Dir.create(fit->getDirectory(this));
|
2248 |
Dir.create(fit->getDirectory(this));
|
| 2249 |
|
2249 |
|
| 2250 |
long size = 0;
|
2250 |
long size = 0;
|
| 2251 |
unsigned char *data = fit->UncompressData(&size, progress);
|
2251 |
unsigned char *data = fit->UncompressData(&size, progress);
|
| 2252 |
if ((!data) && (fit->GetCompressionType() == SPKCOMPRESS_7ZIP)) {
|
2252 |
if ((!data) && (fit->GetCompressionType() == SPKCOMPRESS_7ZIP)) {
|
| 2253 |
if (!fit->uncompressToFile(Dir.dir(), this, includedir, progress)) return false;
|
2253 |
if (!fit->uncompressToFile(Dir.dir().toString(), this, includedir, progress)) return false;
|
| 2254 |
}
|
2254 |
}
|
| 2255 |
else if ((!data) || (!fit->writeToDir(Dir.dir(), this, includedir, Utils::String::Null(), data, size))) return false;
|
2255 |
else if ((!data) || (!fit->writeToDir(Dir.dir().toString(), this, includedir, Utils::String::Null(), data, size))) return false;
|
| 2256 |
}
|
2256 |
}
|
| 2257 |
|
2257 |
|
| 2258 |
delete File;
|
2258 |
delete File;
|
| 2259 |
return true;
|
2259 |
return true;
|
| 2260 |
}
|
2260 |
}
|
| Line 2748... |
Line 2748... |
| 2748 |
else
|
2748 |
else
|
| 2749 |
Found->iVersion = version;
|
2749 |
Found->iVersion = version;
|
| 2750 |
_changed();
|
2750 |
_changed();
|
| 2751 |
}
|
2751 |
}
|
| 2752 |
|
2752 |
|
| 2753 |
Utils::String CBaseFile::_replaceFilename(const Utils::String &fname)
|
2753 |
Utils::WString CBaseFile::_replaceFilename(const Utils::WString &fname)
|
| 2754 |
{
|
2754 |
{
|
| 2755 |
Utils::String filename = fname;
|
2755 |
Utils::WString filename = fname;
|
| 2756 |
Utils::String cdate = this->creationDate().findReplace("/", ".").remove(' ');
|
2756 |
Utils::WString cdate = this->creationDate().findReplace("/", ".").remove(' ');
|
| 2757 |
if (filename.isin("$AUTOSAVE"))
|
2757 |
if (filename.contains(L"$AUTOSAVE"))
|
| 2758 |
{
|
2758 |
{
|
| 2759 |
if (this->GetType() == TYPE_XSP)
|
2759 |
if (this->GetType() == TYPE_XSP)
|
| 2760 |
filename = filename.findReplace("$AUTOSAVE", "$NAME-V$VERSION-$CDATE.xsp");
|
2760 |
filename = filename.findReplace(L"$AUTOSAVE", L"$NAME-V$VERSION-$CDATE.xsp");
|
| 2761 |
else
|
2761 |
else
|
| 2762 |
filename = filename.findReplace("$AUTOSAVE", "$NAME-V$VERSION-$CDATE.spk");
|
2762 |
filename = filename.findReplace(L"$AUTOSAVE", L"$NAME-V$VERSION-$CDATE.spk");
|
| 2763 |
}
|
2763 |
}
|
| 2764 |
filename = filename.findReplace("$NAME", this->name().remove(' '));
|
2764 |
filename = filename.findReplace("L$NAME", this->name().remove(' '));
|
| 2765 |
filename = filename.findReplace("$AUTHOR", this->author().remove(' '));
|
2765 |
filename = filename.findReplace("L$AUTHOR", this->author().remove(' '));
|
| 2766 |
filename = filename.findReplace("$DATE", cdate);
|
2766 |
filename = filename.findReplace("L$DATE", cdate);
|
| 2767 |
filename = filename.findReplace("$CDATE", cdate);
|
2767 |
filename = filename.findReplace("L$CDATE", cdate);
|
| 2768 |
filename = filename.findReplace("$VERSION", this->version());
|
2768 |
filename = filename.findReplace("L$VERSION", this->version());
|
| 2769 |
|
2769 |
|
| 2770 |
return filename;
|
2770 |
return filename;
|
| 2771 |
}
|
2771 |
}
|
| 2772 |
bool CBaseFile::LoadPackageData(const Utils::String &sFirst, const Utils::String &sRest, const Utils::String &sMainGame, Utils::CStringList &otherGames, Utils::CStringList &gameAddons, CProgressInfo *progress)
|
2772 |
bool CBaseFile::LoadPackageData(const Utils::String &sFirst, const Utils::String &sRest, const Utils::String &sMainGame, Utils::CStringList &otherGames, Utils::CStringList &gameAddons, CProgressInfo *progress)
|
| 2773 |
{
|
2773 |
{
|
| Line 2799... |
Line 2799... |
| 2799 |
this->AddGameCompatability(CBaseFile::GetGameFromString(sGame), sRest.token(" ", 2));
|
2799 |
this->AddGameCompatability(CBaseFile::GetGameFromString(sGame), sRest.token(" ", 2));
|
| 2800 |
}
|
2800 |
}
|
| 2801 |
else if (sFirst.Compare("Description")) this->setDescription(sRest);
|
2801 |
else if (sFirst.Compare("Description")) this->setDescription(sRest);
|
| 2802 |
else if (sFirst.Compare("AutoSave") || sFirst.Compare("AutoExport") || sFirst.Compare("AutoRarExport") || sFirst.Compare("AutoZipExport"))
|
2802 |
else if (sFirst.Compare("AutoSave") || sFirst.Compare("AutoExport") || sFirst.Compare("AutoRarExport") || sFirst.Compare("AutoZipExport"))
|
| 2803 |
{
|
2803 |
{
|
| 2804 |
Utils::String filename = _replaceFilename(sRest);
|
2804 |
Utils::WString filename = _replaceFilename(sRest);
|
| 2805 |
|
2805 |
|
| 2806 |
if (sFirst.Compare("AutoZipExport") || sFirst.Compare("AutoExport"))
|
2806 |
if (sFirst.Compare("AutoZipExport") || sFirst.Compare("AutoExport"))
|
| 2807 |
this->setExportFilename(CFileIO(filename).changeFileExtension("zip"));
|
2807 |
this->setExportFilename(CFileIO(filename).changeFileExtension(L"zip").toString());
|
| 2808 |
else if (sFirst.Compare("AutoRarExport"))
|
2808 |
else if (sFirst.Compare("AutoRarExport"))
|
| 2809 |
this->setExportFilename(CFileIO(filename).changeFileExtension("rar"));
|
2809 |
this->setExportFilename(CFileIO(filename).changeFileExtension(L"rar").toString());
|
| 2810 |
else
|
2810 |
else
|
| 2811 |
this->setFilename(filename);
|
2811 |
this->setFilename(filename.toString());
|
| 2812 |
}
|
2812 |
}
|
| 2813 |
else if (sFirst.Compare("WebSite")) this->setWebSite(sRest);
|
2813 |
else if (sFirst.Compare("WebSite")) this->setWebSite(sRest);
|
| 2814 |
else if (sFirst.Compare("ForumLink") || sFirst.Compare("Forum")) this->setForumLink(sRest);
|
2814 |
else if (sFirst.Compare("ForumLink") || sFirst.Compare("Forum")) this->setForumLink(sRest);
|
| 2815 |
else if (sFirst.Compare("Email")) this->setEmail(sRest);
|
2815 |
else if (sFirst.Compare("Email")) this->setEmail(sRest);
|
| 2816 |
else if (sFirst.Compare("WebAddress")) this->setWebAddress(sRest);
|
2816 |
else if (sFirst.Compare("WebAddress")) this->setWebAddress(sRest);
|
| Line 2846... |
Line 2846... |
| 2846 |
}
|
2846 |
}
|
| 2847 |
else if (sFirst.Compare("Icon"))
|
2847 |
else if (sFirst.Compare("Icon"))
|
| 2848 |
{
|
2848 |
{
|
| 2849 |
C_File *icon = new C_File(sRest.c_str());
|
2849 |
C_File *icon = new C_File(sRest.c_str());
|
| 2850 |
if (icon->ReadFromFile())
|
2850 |
if (icon->ReadFromFile())
|
| 2851 |
this->setIcon(icon, CFileIO(sRest).extension());
|
2851 |
this->setIcon(icon, CFileIO(sRest).extension().toString());
|
| 2852 |
}
|
2852 |
}
|
| 2853 |
else if (sFirst.Compare("CombineGameFiles"))
|
2853 |
else if (sFirst.Compare("CombineGameFiles"))
|
| 2854 |
_bCombineFiles = sRest.Compare("true") || sRest.Compare("yes") || sRest.toInt();
|
2854 |
_bCombineFiles = sRest.Compare("true") || sRest.Compare("yes") || sRest.toInt();
|
| 2855 |
else if (sFirst.Compare("UpdateFile"))
|
2855 |
else if (sFirst.Compare("UpdateFile"))
|
| 2856 |
this->createUpdateFile(sRest);
|
2856 |
this->createUpdateFile(sRest);
|
| 2857 |
else if (sFirst.Compare("ExportZip"))
|
2857 |
else if (sFirst.Compare("ExportZip"))
|
| 2858 |
{
|
2858 |
{
|
| 2859 |
Utils::String ext = "zip";
|
2859 |
Utils::WString ext = L"zip";
|
| 2860 |
Utils::String game = sRest.word(1);
|
2860 |
Utils::String game = sRest.word(1);
|
| 2861 |
Utils::String file = _replaceFilename(CFileIO(sRest.words(2)).fullFilename());
|
2861 |
Utils::WString file = _replaceFilename(CFileIO(sRest.words(2)).fullFilename());
|
| 2862 |
if (game.contains("|"))
|
2862 |
if (game.contains("|"))
|
| 2863 |
{
|
2863 |
{
|
| 2864 |
int max;
|
2864 |
int max;
|
| 2865 |
Utils::String *games = game.tokenise("|", &max);
|
2865 |
Utils::String *games = game.tokenise("|", &max);
|
| 2866 |
if (games)
|
2866 |
if (games)
|
| 2867 |
{
|
2867 |
{
|
| 2868 |
for (int i = 0; i < max; ++i)
|
2868 |
for (int i = 0; i < max; ++i)
|
| 2869 |
{
|
2869 |
{
|
| 2870 |
unsigned int g = CBaseFile::GetGameFromString(games[i]);
|
2870 |
unsigned int g = CBaseFile::GetGameFromString(games[i]);
|
| 2871 |
Utils::String filename = CFileIO(file).dir() + "/" + CFileIO(file).baseName() + "_" + CBaseFile::ConvertGameToString(g) + "." + ext;
|
2871 |
Utils::WString filename = CFileIO(file).dir() + L"/" + CFileIO(file).baseName() + L"_" + CBaseFile::ConvertGameToString(g).toWString() + L"." + ext;
|
| 2872 |
this->addAutoExport(g, filename);
|
2872 |
this->addAutoExport(g, filename.toString());
|
| 2873 |
}
|
2873 |
}
|
| 2874 |
CLEANSPLIT(games, max);
|
2874 |
CLEANSPLIT(games, max);
|
| 2875 |
}
|
2875 |
}
|
| 2876 |
}
|
2876 |
}
|
| 2877 |
else
|
2877 |
else
|
| 2878 |
{
|
2878 |
{
|
| 2879 |
unsigned int g = CBaseFile::GetGameFromString(game);
|
2879 |
unsigned int g = CBaseFile::GetGameFromString(game);
|
| 2880 |
Utils::String filename = CFileIO(file).dir() + "/" + CFileIO(file).baseName() + "_" + CBaseFile::ConvertGameToString(g) + "." + ext;
|
2880 |
Utils::WString filename = CFileIO(file).dir() + L"/" + CFileIO(file).baseName() + L"_" + CBaseFile::ConvertGameToString(g).toWString() + L"." + ext;
|
| 2881 |
this->addAutoExport(g, filename);
|
2881 |
this->addAutoExport(g, filename.toString());
|
| 2882 |
}
|
2882 |
}
|
| 2883 |
}
|
2883 |
}
|
| 2884 |
else if (sFirst.Compare("Extract"))
|
2884 |
else if (sFirst.Compare("Extract"))
|
| 2885 |
{
|
2885 |
{
|
| 2886 |
Utils::String game = sRest.word(1);
|
2886 |
Utils::String game = sRest.word(1);
|
| 2887 |
Utils::String dir = CDirIO(sRest.words(2)).dir();
|
2887 |
Utils::WString dir = CDirIO(sRest.words(2)).dir();
|
| 2888 |
if (game.contains("|"))
|
2888 |
if (game.contains("|"))
|
| 2889 |
{
|
2889 |
{
|
| 2890 |
int max;
|
2890 |
int max;
|
| 2891 |
Utils::String *games = game.tokenise("|", &max);
|
2891 |
Utils::String *games = game.tokenise("|", &max);
|
| 2892 |
if (games)
|
2892 |
if (games)
|
| 2893 |
{
|
2893 |
{
|
| 2894 |
for(int i = 0; i < max; ++i)
|
2894 |
for(int i = 0; i < max; ++i)
|
| 2895 |
this->addAutoExtract(CBaseFile::GetGameFromString(games[i]), dir);
|
2895 |
this->addAutoExtract(CBaseFile::GetGameFromString(games[i]), dir.toString());
|
| 2896 |
CLEANSPLIT(games, max);
|
2896 |
CLEANSPLIT(games, max);
|
| 2897 |
}
|
2897 |
}
|
| 2898 |
}
|
2898 |
}
|
| 2899 |
else
|
2899 |
else
|
| 2900 |
this->addAutoExtract(CBaseFile::GetGameFromString(game), dir);
|
2900 |
this->addAutoExtract(CBaseFile::GetGameFromString(game), dir.toString());
|
| 2901 |
}
|
2901 |
}
|
| 2902 |
else
|
2902 |
else
|
| 2903 |
{
|
2903 |
{
|
| 2904 |
Utils::String checkType = sFirst;
|
2904 |
Utils::String checkType = sFirst;
|
| 2905 |
bool shared = false;
|
2905 |
bool shared = false;
|
| Line 2973... |
Line 2973... |
| 2973 |
Utils::CStringList dirList;
|
2973 |
Utils::CStringList dirList;
|
| 2974 |
if(Dir.dirList(dirList))
|
2974 |
if(Dir.dirList(dirList))
|
| 2975 |
{
|
2975 |
{
|
| 2976 |
for(auto itr = dirList.begin(); itr != dirList.end(); itr++)
|
2976 |
for(auto itr = dirList.begin(); itr != dirList.end(); itr++)
|
| 2977 |
{
|
2977 |
{
|
| 2978 |
Utils::String file = Dir.file((*itr)->str);
|
2978 |
Utils::WString file = Dir.file((*itr)->str);
|
| 2979 |
if (file.match(rest))
|
2979 |
if (file.match(rest))
|
| 2980 |
{
|
2980 |
{
|
| 2981 |
int addGame = game;
|
2981 |
int addGame = game;
|
| 2982 |
// check if the file exists in the subdirectory too, if it does, add for each game
|
2982 |
// check if the file exists in the subdirectory too, if it does, add for each game
|
| 2983 |
if ( game == GAME_ALL && !sMainGame.empty() && !otherGames.empty() ) {
|
2983 |
if ( game == GAME_ALL && !sMainGame.empty() && !otherGames.empty() ) {
|
| 2984 |
CFileIO F(file);
|
2984 |
CFileIO F(file);
|
| 2985 |
for(Utils::String g = otherGames.firstString(); !g.empty(); g = otherGames.nextString()) {
|
2985 |
for(Utils::String g = otherGames.firstString(); !g.empty(); g = otherGames.nextString()) {
|
| 2986 |
Utils::String checkDir = F.dir() + "/" + g;
|
2986 |
Utils::WString checkDir = F.dir() + L"/" + g.toWString();
|
| 2987 |
if ( CDirIO(checkDir).exists(F.filename()) ) {
|
2987 |
if ( CDirIO(checkDir).exists(F.filename()) ) {
|
| 2988 |
addGame = mainGame;
|
2988 |
addGame = mainGame;
|
| 2989 |
C_File *newfile = this->appendFile(CDirIO(checkDir).file(F.filename()), filetype, CBaseFile::GetGameFromString(g), packed, dir);
|
2989 |
C_File *newfile = this->appendFile(CDirIO(checkDir).file(F.filename()).toString(), filetype, CBaseFile::GetGameFromString(g), packed, dir);
|
| 2990 |
if (newfile && progress)
|
2990 |
if (newfile && progress)
|
| 2991 |
progress->UpdateFile(newfile);
|
2991 |
progress->UpdateFile(newfile);
|
| 2992 |
if ( newfile ) newfile->SetShared(shared);
|
2992 |
if ( newfile ) newfile->SetShared(shared);
|
| 2993 |
}
|
2993 |
}
|
| 2994 |
}
|
2994 |
}
|
| 2995 |
}
|
2995 |
}
|
| 2996 |
|
2996 |
|
| 2997 |
C_File *newfile = this->appendFile(file, filetype, addGame, packed, dir);
|
2997 |
C_File *newfile = this->appendFile(file.toString(), filetype, addGame, packed, dir);
|
| 2998 |
if (newfile && progress)
|
2998 |
if (newfile && progress)
|
| 2999 |
progress->UpdateFile(newfile);
|
2999 |
progress->UpdateFile(newfile);
|
| 3000 |
if ( newfile )
|
3000 |
if ( newfile )
|
| 3001 |
newfile->SetShared(shared);
|
3001 |
newfile->SetShared(shared);
|
| 3002 |
}
|
3002 |
}
|
| Line 3008... |
Line 3008... |
| 3008 |
unsigned int addGame = game;
|
3008 |
unsigned int addGame = game;
|
| 3009 |
// check if the file exists in the subdirectory too, if it does, add for each game
|
3009 |
// check if the file exists in the subdirectory too, if it does, add for each game
|
| 3010 |
if ( game == GAME_ALL && !sMainGame.empty() && !otherGames.empty() ) {
|
3010 |
if ( game == GAME_ALL && !sMainGame.empty() && !otherGames.empty() ) {
|
| 3011 |
CFileIO F(rest);
|
3011 |
CFileIO F(rest);
|
| 3012 |
for(Utils::String g = otherGames.firstString(); !g.empty(); g = otherGames.nextString()) {
|
3012 |
for(Utils::String g = otherGames.firstString(); !g.empty(); g = otherGames.nextString()) {
|
| 3013 |
Utils::String checkDir = F.dir() + "/" + g;
|
3013 |
Utils::WString checkDir = F.dir() + L"/" + g.toWString();
|
| 3014 |
if ( CDirIO(checkDir).exists(F.filename()) ) {
|
3014 |
if ( CDirIO(checkDir).exists(F.filename()) ) {
|
| 3015 |
addGame = mainGame;
|
3015 |
addGame = mainGame;
|
| 3016 |
C_File *newfile = this->appendFile(CDirIO(checkDir).file(F.filename()), filetype, CBaseFile::GetGameFromString(g), packed, dir);
|
3016 |
C_File *newfile = this->appendFile(CDirIO(checkDir).file(F.filename()).toString(), filetype, CBaseFile::GetGameFromString(g), packed, dir);
|
| 3017 |
if (newfile && progress)
|
3017 |
if (newfile && progress)
|
| 3018 |
progress->UpdateFile(newfile);
|
3018 |
progress->UpdateFile(newfile);
|
| 3019 |
if ( newfile ) newfile->SetShared(shared);
|
3019 |
if ( newfile ) newfile->SetShared(shared);
|
| 3020 |
}
|
3020 |
}
|
| 3021 |
}
|
3021 |
}
|
| Line 3196... |
Line 3196... |
| 3196 |
{
|
3196 |
{
|
| 3197 |
_lMirrors.remove(str, true);
|
3197 |
_lMirrors.remove(str, true);
|
| 3198 |
_changed();
|
3198 |
_changed();
|
| 3199 |
}
|
3199 |
}
|
| 3200 |
|
3200 |
|
| 3201 |
Utils::String CBaseFile::createUpdateFile(const Utils::String &dir) const
|
3201 |
Utils::WString CBaseFile::createUpdateFile(const Utils::WString &dir) const
|
| 3202 |
{
|
3202 |
{
|
| 3203 |
Utils::String file = this->getNameValidFile() + "_" + this->author() + ".dat";
|
3203 |
Utils::WString file = this->getNameValidFile() + "_" + this->author() + ".dat";
|
| 3204 |
file.removeChar(' ');
|
3204 |
file.removeChar(' ');
|
| 3205 |
|
3205 |
|
| 3206 |
Utils::CStringList write;
|
3206 |
Utils::CStringList write;
|
| 3207 |
write.pushBack("Package: " + this->name());
|
3207 |
write.pushBack("Package: " + this->name());
|
| 3208 |
write.pushBack("Author: " + this->author());
|
3208 |
write.pushBack("Author: " + this->author());
|
| 3209 |
write.pushBack("Version: " + this->version());
|
3209 |
write.pushBack("Version: " + this->version());
|
| 3210 |
write.pushBack("File: " + CFileIO(this->filename()).filename());
|
3210 |
write.pushBack("File: " + CFileIO(this->filename()).filename().toString());
|
| 3211 |
|
3211 |
|
| 3212 |
CFileIO File(dir + "/" + file);
|
3212 |
CFileIO File(dir + "/" + file);
|
| 3213 |
if (File.writeFile(&write))
|
3213 |
if (File.writeFile(&write))
|
| 3214 |
return File.fullFilename();
|
3214 |
return File.fullFilename();
|
| 3215 |
return Utils::String::Null();
|
3215 |
return Utils::WString::Null();
|
| 3216 |
}
|
3216 |
}
|
| 3217 |
|
3217 |
|
| 3218 |
Utils::String CBaseFile::ErrorString(int error, const Utils::String &errorStr)
|
3218 |
Utils::String CBaseFile::ErrorString(int error, const Utils::String &errorStr)
|
| 3219 |
{
|
3219 |
{
|
| 3220 |
if (error == SPKERR_NONE) return Utils::String::Null();
|
3220 |
if (error == SPKERR_NONE) return Utils::String::Null();
|