Subversion Repositories spk

Rev

Rev 210 | Rev 213 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 210 Rev 212
Line 220... Line 220...
220
	}
220
	}
221
	else
221
	else
222
		m_pGameVFS.LoadFilesystem(m_sCurrentDir, 0);
222
		m_pGameVFS.LoadFilesystem(m_sCurrentDir, 0);
223
}
223
}
224
 
224
 
225
bool CPackages::isOldDir(const Utils::String &dir)
225
bool CPackages::isOldDir(const Utils::WString &dir)
226
{
226
{
227
	bool oldPlugin = false;
227
	bool oldPlugin = false;
228
 
228
 
229
	CFileIO datFile(dir + "/PluginManager/pluginmanager.dat");
229
	CFileIO datFile(dir + L"/PluginManager/pluginmanager.dat");
230
	if ( datFile.exists() )
230
	if ( datFile.exists() )
231
	{
231
	{
232
		std::vector<Utils::String> *readFile = datFile.readLines();
232
		std::vector<Utils::WString> readFile;
233
		if ( readFile )
233
		if(datFile.readLines(readFile))
234
		{
234
		{
235
			for ( int i = 0; i < (int)readFile->size(); i++ )
235
			for ( int i = 0; i < (int)readFile.size(); i++ )
236
			{
236
			{
237
				Utils::String line(readFile->at(i));
237
				Utils::WString line(readFile.at(i));
238
				Utils::String cmd = line.token(":", 1);
238
				Utils::WString cmd = line.token(L":", 1);
239
				if ( cmd.Compare("<script>") || cmd.Compare("</scripts>") )
239
				if ( cmd.Compare(L"<script>") || cmd.Compare(L"</scripts>") )
240
					break;
240
					break;
241
				else if ( cmd.Compare("spkinstaller") || cmd.Compare("globalfiles") )
241
				else if ( cmd.Compare(L"spkinstaller") || cmd.Compare(L"globalfiles") )
242
					break;
242
					break;
243
				else if ( cmd.Compare("pluginmanager") )
243
				else if ( cmd.Compare(L"pluginmanager") )
244
				{
244
				{
245
					oldPlugin = true;
245
					oldPlugin = true;
246
					break;
246
					break;
247
				}
247
				}
248
			}
248
			}
249
 
-
 
250
			delete readFile;
-
 
251
		}
249
		}
252
	}
250
	}
253
 
251
 
254
	return oldPlugin;
252
	return oldPlugin;
255
}
253
}
Line 651... Line 649...
651
	Utils::WString logDir = logDirectory();
649
	Utils::WString logDir = logDirectory();
652
	CFileIO LogFile(logDir + L"/log0" + Utils::WString::PadNumber(PMTEXTFILE, 4) + L".txt");
650
	CFileIO LogFile(logDir + L"/log0" + Utils::WString::PadNumber(PMTEXTFILE, 4) + L".txt");
653
	if ( LogFile.exists() )
651
	if ( LogFile.exists() )
654
	{
652
	{
655
		// read the log file to memory
653
		// read the log file to memory
656
		std::vector<Utils::String> *lines = LogFile.readLines();
654
		std::vector<Utils::WString> lines;
657
		if ( lines )
655
		if(LogFile.readLines(lines))
658
		{
656
		{
659
			for ( int i = 0; i < (int)lines->size(); i++ )
657
			for ( int i = 0; i < (int)lines.size(); i++ )
660
			{
658
			{
661
				Utils::String line(lines->at(i));
659
				Utils::WString line(lines.at(i));
662
				Utils::String start = line.token(":", 1).toLower();
660
				Utils::WString start = line.token(L":", 1).toLower();
663
				Utils::String rest = line.token(":", 2).removeFirstSpace();
661
				Utils::WString rest = line.token(L":", 2).removeFirstSpace();
664
				if ( start.Compare("purged") )
662
				if ( start.Compare(L"purged") )
665
				{
663
				{
666
					long time = rest.toLong();
664
					long time = rest.toLong();
667
					if ( time == m_iLastUpdated )
665
					if ( time == m_iLastUpdated )
668
					{
666
					{
669
						this->PurgeWares();
667
						this->PurgeWares();
670
						this->PurgeShips();
668
						this->PurgeShips();
671
						this->removeUninstallScripts();
669
						this->removeUninstallScripts();
672
					}
670
					}
673
				}
671
				}
674
			}
672
			}
675
 
-
 
676
			delete lines;
-
 
677
		}
673
		}
678
		// remove the log file
674
		// remove the log file
679
		LogFile.remove();
675
		LogFile.remove();
680
	}
676
	}
681
}
677
}
Line 2595... Line 2591...
2595
		if ( !file.empty() )
2591
		if ( !file.empty() )
2596
			file += L"/";
2592
			file += L"/";
2597
		file += L"pluginmanagerfake.txt";
2593
		file += L"pluginmanagerfake.txt";
2598
		file = file.findReplace(L"\\", L"/");
2594
		file = file.findReplace(L"\\", L"/");
2599
		CFileIO fakeFile(file);
2595
		CFileIO fakeFile(file);
2600
		std::vector<Utils::String> lines;
2596
		std::vector<Utils::WString> lines;
2601
		lines.push_back("//pluginmanager fake patch");
2597
		lines.push_back(L"//pluginmanager fake patch");
2602
		CLog::log(CLog::Log_Directory, 3, "Writing pluginmanagerfake.txt file to add to Fake Patch");
2598
		CLog::log(CLog::Log_Directory, 3, L"Writing pluginmanagerfake.txt file to add to Fake Patch");
2603
		if ( !fakeFile.writeFile(&lines) ) {
2599
		if ( !fakeFile.writeFile(lines) ) {
2604
			CLog::log(CLog::Log_Directory, 3, "Writing pluginmanagerfake.txt failed!!");
2600
			CLog::log(CLog::Log_Directory, 3, L"Writing pluginmanagerfake.txt failed!!");
2605
		}
2601
		}
2606
		else {
2602
		else {
2607
/*
2603
/*
2608
			CLog::log(CLog::Log_Directory, 2, "Adding TFake.pck file into FakePatch");
2604
			CLog::log(CLog::Log_Directory, 2, "Adding TFake.pck file into FakePatch");
2609
			CCatFile fakePatch;
2605
			CCatFile fakePatch;
Line 6476... Line 6472...
6476
 
6472
 
6477
	if ( !found )
6473
	if ( !found )
6478
		return;
6474
		return;
6479
 
6475
 
6480
	Utils::CStringList aniList;
6476
	Utils::CStringList aniList;
6481
	int e = extractGameFile("types/Animations.pck", m_sTempDir + "/Animations.txt");
6477
	int e = extractGameFile(L"types/Animations.pck", m_sTempDir + L"/Animations.txt");
6482
	if ( e )
6478
	if ( e )
6483
	{
6479
	{
6484
		CFileIO File;
6480
		CFileIO File;
6485
		if ( File.open((e == -1) ? "Animations.txt" : m_sTempDir + "/Animations.txt") )
6481
		if ( File.open((e == -1) ? L"Animations.txt" : m_sTempDir + L"/Animations.txt") )
6486
		{
6482
		{
6487
			std::vector<Utils::String> *lines = File.readLines();
6483
			std::vector<Utils::WString> lines;
6488
			if ( lines )
6484
			if(File.readLines(lines))
6489
			{
6485
			{
6490
				for ( int j = 0; j < (int)lines->size(); j++ )
6486
				for ( int j = 0; j < (int)lines.size(); j++ )
6491
				{
6487
				{
6492
					Utils::String line(lines->at(j));
6488
					Utils::WString line(lines.at(j));
6493
					aniList.pushBack(line);
6489
					aniList.pushBack(line.toString());
6494
				}
6490
				}
6495
 
-
 
6496
				delete lines;
-
 
6497
			}
6491
			}
6498
 
6492
 
6499
			File.remove();
6493
			File.remove();
6500
		}
6494
		}
6501
	}
6495
	}
Line 6629... Line 6623...
6629
		return;
6623
		return;
6630
 
6624
 
6631
	// lets read our current bodies file
6625
	// lets read our current bodies file
6632
	CLinkList<SBodies> bodiesList;
6626
	CLinkList<SBodies> bodiesList;
6633
	SBodies *currentSection = NULL;
6627
	SBodies *currentSection = NULL;
6634
	int e = extractGameFile("types/Bodies.pck", m_sTempDir + "/Bodies.txt");
6628
	int e = extractGameFile(L"types/Bodies.pck", m_sTempDir + L"/Bodies.txt");
6635
	if ( e )
6629
	if ( e )
6636
	{
6630
	{
6637
		CFileIO File;
6631
		CFileIO File;
6638
		if ( File.open((e == -1) ? "Bodies.txt" : m_sTempDir + "/Bodies.txt") )
6632
		if ( File.open((e == -1) ? L"Bodies.txt" : m_sTempDir + L"/Bodies.txt") )
6639
		{
6633
		{
6640
			std::vector<Utils::String> *lines = File.readLines();
6634
			std::vector<Utils::String> *lines = File.readLines();
6641
			if ( lines )
6635
			if ( lines )
6642
			{
6636
			{
6643
				int entries = 0;
6637
				int entries = 0;