Subversion Repositories spk

Rev

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

Rev 185 Rev 197
Line 187... Line 187...
187
	}
187
	}
188
 
188
 
189
	return argList->Count();
189
	return argList->Count();
190
}
190
}
191
 
191
 
192
CyString InstallPackage(CyStringList *lArguments, Utils::CStringList *errors, CPackages *packages, bool disabled)
192
CyString InstallPackage(CyStringList *lArguments, Utils::WStringList *errors, CPackages *packages, bool disabled)
193
{
193
{
194
	CProgressConsole progress;
194
	CProgressConsole progress;
195
 
195
 
196
	int error;
196
	int error;
197
 
197
 
Line 201... Line 201...
201
	// append spk on the end
201
	// append spk on the end
202
	for ( SStringList *node = lArguments->Head(); node; node = node->next )
202
	for ( SStringList *node = lArguments->Head(); node; node = node->next )
203
	{
203
	{
204
		if (!CFileIO::Exists(node->str.ToString()))
204
		if (!CFileIO::Exists(node->str.ToString()))
205
		{
205
		{
206
			if (CFileIO(node->str.ToString()).extension().lower() != "spk")
206
			if (CFileIO(node->str.ToString()).extension().lower() != L"spk")
207
				node->str += ".spk";
207
				node->str += ".spk";
208
		}
208
		}
209
	}
209
	}
210
 
210
 
211
	CLinkList<CBaseFile> lPackages;
211
	CLinkList<CBaseFile> lPackages;
Line 292... Line 292...
292
						break;
292
						break;
293
					}
293
					}
294
					break;
294
					break;
295
					// wait for the rest to be added
295
					// wait for the rest to be added
296
				case INSTALLCHECK_WRONGGAME:
296
				case INSTALLCHECK_WRONGGAME:
297
					printf ( "ERROR! \"%s\" Wrong Game (Requires: %s)", packageName.c_str(), packages->getGameTypesString(package, false).c_str() );
297
					wprintf ( L"ERROR! \"%hs\" Wrong Game (Requires: %s)", packageName.c_str(), packages->getGameTypesString(package, false).c_str() );
298
					if ( g_force )
298
					if ( g_force )
299
					{
299
					{
300
						printf ( " [FORCED]\n" );
300
						printf ( " [FORCED]\n" );
301
						if ( packages->PrepareInstallPackage(package, disabled, true) != INSTALLCHECK_OK )
301
						if ( packages->PrepareInstallPackage(package, disabled, true) != INSTALLCHECK_OK )
302
							continue;
302
							continue;
Line 307... Line 307...
307
						continue;
307
						continue;
308
					}
308
					}
309
					break;
309
					break;
310
 
310
 
311
				case INSTALLCHECK_WRONGVERSION:
311
				case INSTALLCHECK_WRONGVERSION:
312
					printf ( "ERROR! \"%s\" Wrong Game Version (Requires: %s)\n", packageName.c_str(), packages->getGameVersionString(package).c_str() );
312
					wprintf ( L"ERROR! \"%hs\" Wrong Game Version (Requires: %s)\n", packageName.c_str(), packages->getGameVersionString(package).c_str() );
313
					if ( g_force )
313
					if ( g_force )
314
					{
314
					{
315
						printf ( " [FORCED]\n" );
315
						printf ( " [FORCED]\n" );
316
						if ( packages->PrepareInstallPackage(package, disabled, true) != INSTALLCHECK_OK )
316
						if ( packages->PrepareInstallPackage(package, disabled, true) != INSTALLCHECK_OK )
317
							continue;
317
							continue;
Line 419... Line 419...
419
	}
419
	}
420
 
420
 
421
	return 0;
421
	return 0;
422
}
422
}
423
 
423
 
424
bool UninstallPackage(int uninstallNum, Utils::CStringList *errors, CPackages *packages, Utils::String &endMessage)
424
bool UninstallPackage(int uninstallNum, Utils::WStringList *errors, CPackages *packages, Utils::String &endMessage)
425
{
425
{
426
	CBaseFile *p = FindPackage(uninstallNum, packages);
426
	CBaseFile *p = FindPackage(uninstallNum, packages);
427
	if ( !p )
427
	if ( !p )
428
		return false;
428
		return false;
429
 
429
 
Line 473... Line 473...
473
 
473
 
474
 
474
 
475
	return true;
475
	return true;
476
}
476
}
477
 
477
 
478
bool EnablePackage(int uninstallNum, Utils::CStringList *errors, CPackages *packages, Utils::String &endMessage)
478
bool EnablePackage(int uninstallNum, Utils::WStringList *errors, CPackages *packages, Utils::String &endMessage)
479
{
479
{
480
	CBaseFile *p = FindPackage(uninstallNum, packages);
480
	CBaseFile *p = FindPackage(uninstallNum, packages);
481
	if ( !p )
481
	if ( !p )
482
		return false;
482
		return false;
483
 
483
 
Line 501... Line 501...
501
		return false;
501
		return false;
502
	}
502
	}
503
	return true;
503
	return true;
504
}
504
}
505
 
505
 
506
bool DisablePackage(int uninstallNum, Utils::CStringList *errors, CPackages *packages, Utils::String &endMessage)
506
bool DisablePackage(int uninstallNum, Utils::WStringList *errors, CPackages *packages, Utils::String &endMessage)
507
{
507
{
508
	CBaseFile *p = FindPackage(uninstallNum, packages);
508
	CBaseFile *p = FindPackage(uninstallNum, packages);
509
	if ( !p )
509
	if ( !p )
510
		return false;
510
		return false;
511
 
511
 
Line 525... Line 525...
525
		return false;
525
		return false;
526
	}
526
	}
527
	return true;
527
	return true;
528
}
528
}
529
 
529
 
530
void RemoveUninstallScripts(CPackages *packages, Utils::CStringList *errors)
530
void RemoveUninstallScripts(CPackages *packages, Utils::WStringList *errors)
531
{
531
{
532
	CProgressConsole progress;
532
	CProgressConsole progress;
533
	printf ( "  - Removing uninstall scripts     " );
533
	printf ( "  - Removing uninstall scripts     " );
534
	packages->removeUninstallScripts(errors, &progress);
534
	packages->removeUninstallScripts(errors, &progress);
535
	progress.Finish();
535
	progress.Finish();
536
}
536
}
537
 
537
 
538
void RemoveUnusedShared(CPackages *packages, Utils::CStringList *errors)
538
void RemoveUnusedShared(CPackages *packages, Utils::WStringList *errors)
539
{
539
{
540
	CProgressConsole progress;
540
	CProgressConsole progress;
541
	printf ( "  - Removing unused shared files   " );
541
	printf ( "  - Removing unused shared files   " );
542
	packages->removeUnusedSharedFiles(errors, &progress);
542
	packages->removeUnusedSharedFiles(errors, &progress);
543
	progress.Finish();
543
	progress.Finish();
Line 653... Line 653...
653
		exit ( 1 );
653
		exit ( 1 );
654
	}
654
	}
655
 
655
 
656
	Utils::String destination = g_dir.ToString();
656
	Utils::String destination = g_dir.ToString();
657
	CyStringList errors;
657
	CyStringList errors;
658
	Utils::CStringList lErrors;
658
	Utils::WStringList lErrors;
659
 
659
 
660
	// get the command flag
660
	// get the command flag
661
	CyString command(argv[1]);
661
	CyString command(argv[1]);
662
	command = command.lower();
662
	command = command.lower();
663
 
663
 
Line 763... Line 763...
763
			{
763
			{
764
				packages.UpdatePackages();
764
				packages.UpdatePackages();
765
				packages.ReadGameLanguage(false);
765
				packages.ReadGameLanguage(false);
766
				progress.Finish(false);
766
				progress.Finish(false);
767
 
767
 
768
				Utils::String gameName = packages.getGameName();
768
				Utils::WString gameName = packages.getGameName();
769
				if ( packages.GetLanguage() || !gameName.empty())
769
				if ( packages.GetLanguage() || !gameName.empty())
770
				{
770
				{
771
					printf ( "\n\t" );
771
					printf ( "\n\t" );
772
					if ( !gameName.empty() )
772
					if ( !gameName.empty() )
773
						printf ( "Game: %s ", gameName.c_str());
773
						wprintf ( L"Game: %s ", gameName.c_str());
774
					if ( packages.GetLanguage() )
774
					if ( packages.GetLanguage() )
775
						printf ( "(Language: %d)", packages.GetLanguage() );
775
						printf ( "(Language: %d)", packages.GetLanguage() );
776
				}
776
				}
777
				printf ( "\n" );
777
				printf ( "\n" );
778
			}
778
			}