Subversion Repositories spk

Rev

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

Rev 192 Rev 196
Line 24... Line 24...
24
 
24
 
25
	System::String ^tempDir = System::IO::Path::GetTempPath();
25
	System::String ^tempDir = System::IO::Path::GetTempPath();
26
	System::String ^mydoc = Environment::GetFolderPath(Environment::SpecialFolder::Personal );
26
	System::String ^mydoc = Environment::GetFolderPath(Environment::SpecialFolder::Personal );
27
	System::String ^progfile = Environment::GetFolderPath(Environment::SpecialFolder::ProgramFiles );
27
	System::String ^progfile = Environment::GetFolderPath(Environment::SpecialFolder::ProgramFiles );
28
 
28
 
29
	Utils::CStringList dirList;
29
	Utils::WStringList dirList;
30
	Utils::CStringList remDirList;
30
	Utils::WStringList remDirList;
31
	System::String ^gameArgs;
31
	System::String ^gameArgs;
32
	System::String ^openPackage;
32
	System::String ^openPackage;
33
 
33
 
34
	CLanguages::Instance()->SetLanguage(44);
34
	CLanguages::Instance()->SetLanguage(44);
35
 
35
 
Line 69... Line 69...
69
			}
69
			}
70
			if ( argSwitch == "--dir" && !rest.empty() )
70
			if ( argSwitch == "--dir" && !rest.empty() )
71
			{
71
			{
72
				Utils::String gameName = packages.getGameName(rest.toString());
72
				Utils::String gameName = packages.getGameName(rest.toString());
73
				if ( !gameName.empty() )
73
				if ( !gameName.empty() )
74
					dirList.pushBack(rest.toString(), gameName);
74
					dirList.pushBack(rest, gameName);
75
			}
75
			}
76
 
76
 
77
			if ( argSwitch == "--advanced" )
77
			if ( argSwitch == "--advanced" )
78
				Advanced = true;
78
				Advanced = true;
79
			else if ( argSwitch == "--fromlauncher" )
79
			else if ( argSwitch == "--fromlauncher" )
Line 287... Line 287...
287
	{
287
	{
288
		MessageBox::Show("You dont currently have any controlled directories", "Open Package", MessageBoxButtons::OK, MessageBoxIcon::Error);
288
		MessageBox::Show("You dont currently have any controlled directories", "Open Package", MessageBoxButtons::OK, MessageBoxIcon::Error);
289
		return 1;
289
		return 1;
290
	}
290
	}
291
 
291
 
292
	Utils::String dir = dirList.empty() ? "" : dirList.first()->str;
292
	Utils::WString dir = dirList.empty() ? L"" : dirList.first()->str;
293
 
293
 
294
	StartUp ^startup = gcnew StartUp(&packages, &dir, (openPackage) ? true : false, Advanced);
294
	StartUp ^startup = gcnew StartUp(&packages, &dir, (openPackage) ? true : false, Advanced);
295
	Application::Run(startup);
295
	Application::Run(startup);
296
 
296
 
297
	// opening a package from command line
297
	// opening a package from command line
Line 330... Line 330...
330
				packages.removeUnusedSharedFiles();
330
				packages.removeUnusedSharedFiles();
331
		}
331
		}
332
		packages.closeDir(0, 0, true);
332
		packages.closeDir(0, 0, true);
333
	}
333
	}
334
 
334
 
335
	Utils::CStringList restoreModified;
335
	Utils::WStringList restoreModified;
336
	if ( gui->GetDownloadFile() )
336
	if ( gui->GetDownloadFile() )
337
	{
337
	{
338
		if ( System::IO::File::Exists(".\\AutoUpdater.exe") )
338
		if ( System::IO::File::Exists(".\\AutoUpdater.exe") )
339
		{
339
		{
340
			// rename the autoupdater
340
			// rename the autoupdater
Line 396... Line 396...
396
				if ( info )
396
				if ( info )
397
				{
397
				{
398
					if ( packages.GetCurrentGameFlags() & EXEFLAG_ADDON ) {
398
					if ( packages.GetCurrentGameFlags() & EXEFLAG_ADDON ) {
399
						CPackages p;
399
						CPackages p;
400
						p.startup(".", _S(tempDir), _S(mydoc), "");
400
						p.startup(".", _S(tempDir), _S(mydoc), "");
401
						Utils::String baseDir = CFileIO(_S(gui->GetRunFile())).dir();
401
						Utils::WString baseDir = CFileIO(_S(gui->GetRunFile())).dir();
402
						if ( p.read(baseDir) ) {
402
						if ( p.read(baseDir.toString()) ) {
403
							if ( !p.IsVanilla() ) {
403
							if ( !p.IsVanilla() ) {
404
								p.SetVanilla(true);
404
								p.SetVanilla(true);
405
								p.PrepareDisableForVanilla();
405
								p.PrepareDisableForVanilla();
406
								p.enablePreparedPackages(0, 0, 0);
406
								p.enablePreparedPackages(0, 0, 0);
407
								restoreModified.pushBack(baseDir);
407
								restoreModified.pushBack(baseDir);
Line 427... Line 427...
427
 
427
 
428
	// write config
428
	// write config
429
	std::vector<Utils::String> writeLines;
429
	std::vector<Utils::String> writeLines;
430
	for(auto itr = dirList.begin(); itr != dirList.end(); itr++)
430
	for(auto itr = dirList.begin(); itr != dirList.end(); itr++)
431
	{
431
	{
432
		writeLines.push_back("Dir:" + (*itr)->str);
432
		writeLines.push_back("Dir:" + (*itr)->str.toString());
433
		Utils::String data;
433
		Utils::WString data;
434
		if ((*itr)->data.isin("|") )
434
		if ((*itr)->data.isin("|") )
435
		{
435
		{
436
			data = CPackages::ConvertLanguage((*itr)->data.token("|", 1).toInt()) + "|";
436
			data = CPackages::ConvertLanguage((*itr)->data.token(L"|", 1).toInt()).toWString() + L"|";
437
			data += (*itr)->data.tokens("|", 2);
437
			data += (*itr)->data.tokens(L"|", 2);
438
		}
438
		}
439
		else
439
		else
440
			data = (*itr)->data;
440
			data = (*itr)->data;
441
 
441
 
442
		Utils::String exe = CFileIO(packages.GetGameExe()->GetGameRunExe((*itr)->str)).fullFilename();
442
		Utils::WString exe = CFileIO(packages.GetGameExe()->GetGameRunExe((*itr)->str.toString())).fullFilename();
443
		writeLines.push_back("DirExe:" + data + "|" + exe);
443
		writeLines.push_back((L"DirExe:" + data + L"|" + exe).toString());
444
 
444
 
445
		// do the log files
445
		// do the log files
446
		writeLines.push_back("GameLog:" + packages.logDirectory(exe) + "|" + exe);
446
		writeLines.push_back("GameLog:" + packages.logDirectory(exe.toString()) + "|" + exe.toString());
447
 
447
 
448
	}
448
	}
449
	for (auto itr = remDirList.begin(); itr != remDirList.end(); itr++)
449
	for (auto itr = remDirList.begin(); itr != remDirList.end(); itr++)
450
		writeLines.push_back("RemDir:" + (*itr)->str);
450
		writeLines.push_back("RemDir:" + (*itr)->str.toString());
451
	if ( gui->IsExperimental() )
451
	if ( gui->IsExperimental() )
452
		writeLines.push_back("Experimental:");
452
		writeLines.push_back("Experimental:");
453
	if ( gui->IsShips() )
453
	if ( gui->IsShips() )
454
		writeLines.push_back("FilterShips:");
454
		writeLines.push_back("FilterShips:");
455
	if ( gui->IsOnlySigned() )
455
	if ( gui->IsOnlySigned() )
Line 486... Line 486...
486
			continue;
486
			continue;
487
		writeLines.push_back(Utils::String("Tips: ") + (long)i + " " + (long)tips);
487
		writeLines.push_back(Utils::String("Tips: ") + (long)i + " " + (long)tips);
488
	}
488
	}
489
 
489
 
490
	for (auto rm = restoreModified.begin(); rm != restoreModified.end(); rm++) {
490
	for (auto rm = restoreModified.begin(); rm != restoreModified.end(); rm++) {
491
		writeLines.push_back("RestoreModified: " + (*rm)->str);
491
		writeLines.push_back("RestoreModified: " + (*rm)->str.toString());
492
	}
492
	}
493
 
493
 
494
	// write settings
494
	// write settings
495
	configFile.writeFile(&writeLines);
495
	configFile.writeFile(&writeLines);
496
 
496