Subversion Repositories spk

Rev

Rev 329 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 329 Rev 331
Line 93... Line 93...
93
	}
93
	}
94
 
94
 
95
	return line;
95
	return line;
96
}
96
}
97
 
97
 
-
 
98
bool OpenDestination(Utils::CommandLine& cmd, const Utils::WString& destination)
-
 
99
{
-
 
100
	Utils::WString endMessage;
-
 
101
 
-
 
102
	wprintf(L"                                   |0              100|\n\n");
-
 
103
	wprintf(L"  - Reading game directory         ");
-
 
104
 
-
 
105
	CProgressConsole progress;
-
 
106
 
-
 
107
	auto& packages = cmd.packages();
-
 
108
	if (packages.read(destination, &progress))
-
 
109
	{
-
 
110
		packages.UpdatePackages();
-
 
111
		packages.ReadGameLanguage(false);
-
 
112
		progress.Finish(false);
-
 
113
 
-
 
114
		Utils::WString gameName = packages.getGameName();
-
 
115
		if (packages.GetLanguage() || !gameName.empty())
-
 
116
		{
-
 
117
			wprintf(L"\n\t");
-
 
118
			if (!gameName.empty())
-
 
119
				wprintf(L"Game: %s ", gameName.c_str());
-
 
120
			if (packages.GetLanguage())
-
 
121
				wprintf(L"(Language: %d)", packages.GetLanguage());
-
 
122
		}
-
 
123
		wprintf(L"\n");
-
 
124
		packages.AssignPackageNumbers();
-
 
125
		return true;
-
 
126
	}
-
 
127
	else
-
 
128
	{
-
 
129
		wprintf(L"ERROR!\n");
-
 
130
		wprintf(L"\nFailed to open destination directory: %s\n", destination.c_str());
-
 
131
		exit(1);
-
 
132
	}
-
 
133
 
-
 
134
	return false;
-
 
135
}
-
 
136
 
-
 
137
bool CloseDestination(Utils::CommandLine& cmd, bool isPrepare)
-
 
138
{
-
 
139
	CProgressConsole progress;
-
 
140
	Utils::WStringList lErrors;
-
 
141
 
-
 
142
	if (isPrepare)
-
 
143
		wprintf(L"  - Preparing game directory       ");
-
 
144
	else
-
 
145
		wprintf(L"  - Closing game directory         ");
-
 
146
 
-
 
147
	if (cmd.packages().closeDir(&lErrors, &progress, true))
-
 
148
		progress.Finish();
-
 
149
	else
-
 
150
	{
-
 
151
		wprintf(L"ERROR!\n");
-
 
152
		exit(1);
-
 
153
	}
-
 
154
 
-
 
155
	cmd.packages().RestoreFakePatch();
-
 
156
 
-
 
157
	wprintf(L"\nDone!\n");
-
 
158
 
-
 
159
	return true;
-
 
160
}
-
 
161
 
-
 
162
 
98
void PrintSyntax(const Utils::WString &cmd)
163
void PrintSyntax(const Utils::WString &cmd)
99
{
164
{
100
	wprintf(L"Syntax: %s %s <command> [arguments]\n", cmd.c_str(), FLAGS );
165
	wprintf(L"Syntax: %s %s <command> [arguments]\n", cmd.c_str(), FLAGS );
101
	wprintf(L"\nCommands:\n" );
166
	wprintf(L"\nCommands:\n" );
102
	wprintf(L"   list\n\t- Lists installed packages\n");
167
	wprintf(L"   list\n\t- Lists installed packages\n");
Line 207... Line 272...
207
	}
272
	}
208
 
273
 
209
	return argList->size();
274
	return argList->size();
210
}
275
}
211
 
276
 
212
Utils::WString InstallPackage(const Utils::WStringList &lArguments, Utils::WStringList *errors, CPackages *packages, bool disabled)
277
bool GetAllFiles(const Utils::CommandLine& cmd, int start, Utils::WStringList &files, const Utils::WString &ext, bool showError)
213
{
278
{
-
 
279
	for (int i = start; i < cmd.argCount(); i++)
-
 
280
	{
-
 
281
		if (cmd.arg(i).containsAny(L"?*"))
-
 
282
		{
-
 
283
			CFileIO File(cmd.fullFilename(cmd.arg(i)));
-
 
284
			if (File.dirIO().exists())
-
 
285
			{
-
 
286
				Utils::WStringList fileList;
-
 
287
				if (File.dirIO().dirList(fileList, Utils::WString::Null(), File.filename(), true))
-
 
288
				{
-
 
289
					for (auto itr = fileList.begin(); itr != fileList.end(); itr++)
-
 
290
					{
-
 
291
						// check if the file exists
-
 
292
						if (CFileIO::Exists((*itr)->str))						
-
 
293
							files.pushBack((*itr)->str);
-
 
294
					}
-
 
295
				}
-
 
296
			}
-
 
297
		}
-
 
298
		else
-
 
299
		{
214
	CProgressConsole progress;
300
			// check if the file exists
-
 
301
			if (CFileIO::Exists(cmd.fullFilename(cmd.arg(i))))
-
 
302
			{
-
 
303
				files.pushBack(cmd.fullFilename(cmd.arg(i)));
-
 
304
				continue;
-
 
305
			}
215
 
306
 
-
 
307
			// otherwise, try to append extension to the filename
-
 
308
			if (!ext.empty())
-
 
309
			{
-
 
310
				if (CFileIO(cmd.fullFilename(cmd.arg(i))).extension().lower() != ext.lower())
-
 
311
				{
-
 
312
					Utils::WString filename = cmd.fullFilename(cmd.arg(i)) + L"." + ext;
-
 
313
					if (CFileIO::Exists(filename))
-
 
314
					{
-
 
315
						files.pushBack(filename);
-
 
316
						continue;
-
 
317
					}
-
 
318
				}
-
 
319
			}
-
 
320
 
216
	int error;
321
			if (showError)
-
 
322
				wprintf(L"Error: Unable to find package file %s\n", cmd.arg(i).c_str());
-
 
323
		}
-
 
324
 
-
 
325
	}
217
 
326
 
218
	if (lArguments.empty())
327
	return !files.empty();
-
 
328
}
-
 
329
 
-
 
330
Utils::WString InstallPackage(Utils::CommandLine &cmd, const Utils::WString &destination, Utils::WStringList *errors, CPackages *packages, bool disabled)
-
 
331
{
-
 
332
	if (cmd.argCount() < 2)
-
 
333
	{
-
 
334
		wprintf(L"Syntax: %s [flags] install <file>\n\tInstalls a package to the destination\n", cmd.cmdName().c_str());
219
		return Utils::WString::Null();
335
		return Utils::WString::Null();
-
 
336
	}
-
 
337
 
-
 
338
	CProgressConsole progress;
220
 
339
 
-
 
340
	int error;
-
 
341
 
221
	// append spk on the end
342
	Utils::WStringList files;
222
	for (auto itr = lArguments.begin(); itr != lArguments.end(); itr++)
343
	if(!GetAllFiles(cmd, 1, files, L"spk", true))
223
	{
344
	{
224
		if (!CFileIO::Exists((*itr)->str))
-
 
225
		{
-
 
226
			if (CFileIO((*itr)->str).extension().lower() != L"spk")
345
		wprintf(L"Error: No package files specified to install\n");
227
				(*itr)->str += L".spk";
346
		return Utils::WString::Null();
228
		}
-
 
229
	}
347
	}
230
 
348
 
-
 
349
	if (!OpenDestination(cmd, destination))
-
 
350
		return Utils::WString::Null();
-
 
351
 
231
	CLinkList<CBaseFile> lPackages;
352
	CLinkList<CBaseFile> lPackages;
232
 
353
 
233
	// open the package file
354
	// open the package file
234
	printf ( "  - Opening Package                \n" );
355
	printf ( "  - Opening Package                \n" );
235
	for (auto itr = lArguments.begin(); itr != lArguments.end(); itr++)
356
	for (auto itr = files.begin(); itr != files.end(); itr++)
236
	{
357
	{
237
		Utils::WString spkFilename = (*itr)->str;
358
		CFileIO spkFile((*itr)->str);
238
 
359
 
239
		if ( spkFilename.length() > 30 )
360
		if(spkFile.filename().length() > 30 )
240
			wprintf(L"    ..%28s ", spkFilename.right(28).c_str() );
361
			wprintf(L"    %28s.. ", spkFile.filename().left(28).c_str() );
241
		else
362
		else
242
			wprintf(L"    %30s ", spkFilename.right(30).c_str() );
363
			wprintf(L"    %30s ", spkFile.filename().c_str() );
243
 
364
 
244
		CLinkList<CBaseFile> lPackageList;
365
		CLinkList<CBaseFile> lPackageList;
245
		CBaseFile *package = packages->openPackage(spkFilename, &error, &progress);
366
		CBaseFile *package = packages->openPackage(spkFile.fullFilename(), &error, &progress);
246
 
367
 
247
		// multi packages
368
		// multi packages
248
		if ( !package && error == INSTALLERR_NOMULTI )
369
		if ( !package && error == INSTALLERR_NOMULTI )
249
		{
370
		{
250
			if ( !packages->openMultiPackage(spkFilename, &lPackageList, &error, &progress) )
371
			if ( !packages->openMultiPackage(spkFile.fullFilename(), &lPackageList, &error, &progress))
251
			{
372
			{
252
				printf ( "Error!\n");
373
				printf ( "Error!\n");
253
				continue;
374
				continue;
254
			}
375
			}
255
			progress.Finish();
376
			progress.Finish();
256
		}
377
		}
257
 
-
 
258
		else if ( package )
378
		else if ( package )
259
		{
379
		{
260
			progress.Finish();
380
			progress.Finish();
261
			lPackageList.push_back(package);
381
			lPackageList.push_back(package);
262
		}
382
		}
Line 379... Line 499...
379
	{
499
	{
380
		printf ( "\nError! Some packages are missing dependacies:\n" );
500
		printf ( "\nError! Some packages are missing dependacies:\n" );
381
		for ( CListNode<CBaseFile> *pNode = lCheckPackages.Front(); pNode; pNode = pNode->next() )
501
		for ( CListNode<CBaseFile> *pNode = lCheckPackages.Front(); pNode; pNode = pNode->next() )
382
		{
502
		{
383
			CSpkFile *spk = (CSpkFile *)pNode->Data();
503
			CSpkFile *spk = (CSpkFile *)pNode->Data();
384
			wprintf(L"\t%s V%s by %s (Requires: %s by %s)\n", spk->name(packages->GetLanguage()).c_str(), spk->version().c_str(), spk->author().c_str(), spk->otherName().c_str(), spk->otherAuthor().c_str());
504
			wprintf(L"\t%s V%s by %s, Requires:\n", spk->name(packages->GetLanguage()).c_str(), spk->version().c_str(), spk->author().c_str());
-
 
505
			if(!spk->otherName().empty())
-
 
506
				wprintf(L"\t\t%s by %s\n", spk->otherName().c_str(), spk->otherAuthor().c_str());
-
 
507
			for (auto lNode = spk->GetNeededLibraries()->Front(); lNode; lNode = lNode->next())
-
 
508
				wprintf(L"\t\t%s by %s (Minimum Version: %s)\n", lNode->Data()->sName.c_str(), lNode->Data()->sAuthor.c_str(), lNode->Data()->sMinVersion.c_str());
385
		}
509
		}
386
	}
510
	}
387
 
511
 
388
	// no packages will be installed
512
	// no packages will be installed
389
	if ( packages->GetNumPackagesInQueue() < 1 )
513
	if ( packages->GetNumPackagesInQueue() < 1 )
Line 395... Line 519...
395
	if ( packages->installPreparedPackages(errors, &progress, &erroredPackages) )
519
	if ( packages->installPreparedPackages(errors, &progress, &erroredPackages) )
396
		progress.Finish();
520
		progress.Finish();
397
	else
521
	else
398
	{
522
	{
399
		printf ( "ERROR!\n" );
523
		printf ( "ERROR!\n" );
-
 
524
		CloseDestination(cmd, false);
400
		return Utils::WString::Null();
525
		return Utils::WString::Null();
401
	}
526
	}
402
 
527
 
403
	// delete any errored packages
528
	// delete any errored packages
404
	for ( CListNode<CBaseFile> *pNode = erroredPackages.Front(); pNode; pNode = pNode->next() )
529
	for ( CListNode<CBaseFile> *pNode = erroredPackages.Front(); pNode; pNode = pNode->next() )
405
	{
530
	{
406
		lPackages.remove(pNode->Data());
531
		lPackages.remove(pNode->Data());
407
		pNode->DeleteData();
532
		pNode->DeleteData();
408
	}
533
	}
409
 
534
 
-
 
535
	CloseDestination(cmd, true);
-
 
536
 
410
	// now display the packages
537
	// now display the packages
411
	Utils::WString retStr = L"Packages Installed:\n";
538
	Utils::WString retStr = L"Packages Installed:\n";
412
	for ( CListNode<CBaseFile> *pNode = lPackages.Front(); pNode; pNode = pNode->next() )
539
	for ( CListNode<CBaseFile> *pNode = lPackages.Front(); pNode; pNode = pNode->next() )
413
	{
540
	{
414
		CBaseFile *package = pNode->Data();
541
		CBaseFile *package = pNode->Data();
Line 428... Line 555...
428
	}
555
	}
429
 
556
 
430
	return retStr;
557
	return retStr;
431
}
558
}
432
 
559
 
433
CBaseFile *FindPackage(int packageNum, CPackages *packages)
560
CBaseFile *FindPackage(int packageNum, const CPackages *packages)
434
{
561
{
435
	for ( CBaseFile *p = packages->PackageList()->First(); p; p = packages->PackageList()->Next() )
562
	for(auto node = packages->packageList()->Front(); node; node = node->next())
436
	{
563
	{
437
		if ( p->GetNum() == (packageNum - 1) )
564
		if (node->Data() && node->Data()->GetNum() == (packageNum - 1))
438
			return p;
565
			return node->Data();
439
	}
566
	}
440
 
567
 
441
	return 0;
568
	return nullptr;
442
}
569
}
443
 
570
 
444
bool UninstallPackage(int uninstallNum, Utils::WStringList *errors, CPackages *packages, Utils::WString &endMessage)
571
bool UninstallPackage(int uninstallNum, Utils::WStringList *errors, CPackages *packages, Utils::WString &endMessage)
445
{
572
{
446
	CBaseFile *p = FindPackage(uninstallNum, packages);
573
	CBaseFile *p = FindPackage(uninstallNum, packages);
Line 573... Line 700...
573
		printf ( "\n");
700
		printf ( "\n");
574
 
701
 
575
	for(auto itr = errors->begin(); itr != errors->end(); itr++)
702
	for(auto itr = errors->begin(); itr != errors->end(); itr++)
576
	{
703
	{
577
		int errornum = (*itr)->data.toInt();
704
		int errornum = (*itr)->data.toInt();
-
 
705
		//Check this?
578
		Utils::WString rest = (*itr)->str.tokens(L" ", 2);
706
		//Utils::WString rest = (*itr)->str.tokens(L" ", 2);
-
 
707
		Utils::WString rest = (*itr)->str;
579
 
708
 
580
		Utils::WString err = FormatErrorString(errornum, rest);
709
		Utils::WString err = FormatErrorString(errornum, rest);
581
		wprintf(L"  * %s\n", err.c_str());
710
		wprintf(L"  * %s\n", err.c_str());
582
	}
711
	}
583
 
712
 
584
	if (errors && errors->size())
713
	if (errors && errors->size())
585
		printf ( "\n");
714
		printf ( "\n");
586
}
715
}
587
 
716
 
-
 
717
void ShowInfo(const Utils::CommandLine& cmd)
-
 
718
{
-
 
719
	int package = Utils::WString(cmd.arg(1)).toInt();
-
 
720
	CBaseFile* p = FindPackage(package, &cmd.packages());
-
 
721
	if (!p)
-
 
722
	{
-
 
723
		wprintf(L"Error: Unable to find package #%d\n", package);
-
 
724
		return;
-
 
725
	}
-
 
726
	wprintf(L"\n============================\n");
-
 
727
	wprintf(L"Package #%d: %s\n", package, p->name(cmd.packages().language()).c_str());
-
 
728
	wprintf(L"\t%15s: %s\n", L"Author", p->author().c_str());
-
 
729
	wprintf(L"\t%15s: %s\n", L"Version", p->version().c_str());
-
 
730
	wprintf(L"\t%15s: %s\n", L"Description", p->description().c_str());
-
 
731
	if (p->GetType() == TYPE_SPK)
-
 
732
	{
-
 
733
		CSpkFile* spk = dynamic_cast<CSpkFile*>(p);
-
 
734
		wprintf(L"\t%15s: %s\n", L"Type", spk->scriptTypeString(cmd.packages().language()).c_str());
-
 
735
	}
-
 
736
	else if (p->GetType() == TYPE_XSP)
-
 
737
		wprintf(L"\t%15s: %s\n", L"Type", L"Ship");
-
 
738
 
-
 
739
	wprintf(L"\t%15s: %s\n", L"Status", p->isEnabled() ? L"Enabled" : L"Disabled");
-
 
740
 
-
 
741
	if (p->anyDependacies())
-
 
742
	{
-
 
743
		wprintf(L"\t%15s:\n", L"Dependancies");
-
 
744
		for (auto needed = p->GetNeededLibraries()->First(); needed; needed = p->GetNeededLibraries()->Next())
-
 
745
			wprintf(L"\t\t%s by %s (Min Version: %s)", needed->sName.c_str(), needed->sAuthor.c_str(), needed->sMinVersion.c_str());
-
 
746
	}
588
 
747
 
-
 
748
	wprintf(L"\n============================\n\b");
-
 
749
}
589
 
750
 
590
 
751
 
591
void Pause()
752
void Pause()
592
{
753
{
593
#ifdef _DEBUG
754
#ifdef _DEBUG
Line 631... Line 792...
631
 
792
 
632
	return start;
793
	return start;
633
}
794
}
634
 
795
 
635
 
796
 
636
bool OpenDestination(Utils::CommandLine &cmd, const Utils::WString& destination)
-
 
637
{
-
 
638
	Utils::WString endMessage;
-
 
639
 
-
 
640
	wprintf(L"                                   |0              100|\n\n");
-
 
641
	wprintf(L"  - Reading game directory         ");
-
 
642
 
-
 
643
	CProgressConsole progress;
-
 
644
 
-
 
645
	auto& packages = cmd.packages();
-
 
646
	if (packages.read(destination, &progress))
-
 
647
	{
-
 
648
		packages.UpdatePackages();
-
 
649
		packages.ReadGameLanguage(false);
-
 
650
		progress.Finish(false);
-
 
651
 
-
 
652
		Utils::WString gameName = packages.getGameName();
-
 
653
		if (packages.GetLanguage() || !gameName.empty())
-
 
654
		{
-
 
655
			wprintf(L"\n\t");
-
 
656
			if (!gameName.empty())
-
 
657
				wprintf(L"Game: %s ", gameName.c_str());
-
 
658
			if (packages.GetLanguage())
-
 
659
				wprintf(L"(Language: %d)", packages.GetLanguage());
-
 
660
		}
-
 
661
		wprintf(L"\n");
-
 
662
		packages.AssignPackageNumbers();
-
 
663
		return true;
-
 
664
	}
-
 
665
	else
-
 
666
	{
-
 
667
		wprintf(L"ERROR!\n");
-
 
668
		wprintf(L"\nFailed to open destination directory: %s\n", destination.c_str());
-
 
669
		exit(1);
-
 
670
	}
-
 
671
 
-
 
672
	return false;
-
 
673
}
-
 
674
 
-
 
675
bool CloseDestination(Utils::CommandLine& cmd, bool isPrepare)
-
 
676
{
-
 
677
	CProgressConsole progress;
-
 
678
	Utils::WStringList lErrors;
-
 
679
 
-
 
680
	if (isPrepare)
-
 
681
		wprintf(L"  - Preparing game directory       ");
-
 
682
	else
-
 
683
		wprintf(L"  - Closing game directory         ");
-
 
684
 
-
 
685
	if (cmd.packages().closeDir(&lErrors, &progress, true))
-
 
686
		progress.Finish();
-
 
687
	else
-
 
688
	{
-
 
689
		wprintf(L"ERROR!\n");
-
 
690
		exit(1);
-
 
691
	}
-
 
692
 
-
 
693
	cmd.packages().RestoreFakePatch();
-
 
694
 
-
 
695
	wprintf(L"\nDone!\n");
-
 
696
 
-
 
697
	return true;
-
 
698
}
-
 
699
 
797
 
700
/*
798
/*
701
TODO:
799
TODO:
702
Additional Features
800
Additional Features
703
	Patch Mods
801
	Patch Mods
Line 740... Line 838...
740
		packages.SetLanguage(cmd.switchData(L"lang").toInt());
838
		packages.SetLanguage(cmd.switchData(L"lang").toInt());
741
	else if (cmd.hasSwitch(L"language"))
839
	else if (cmd.hasSwitch(L"language"))
742
		packages.SetLanguage(cmd.switchData(L"language").toInt());
840
		packages.SetLanguage(cmd.switchData(L"language").toInt());
743
 
841
 
744
	// check for verbose mode
842
	// check for verbose mode
-
 
843
	g_debug = cmd.hasSwitch(L"verbose") || cmd.hasFlag('v');
-
 
844
	g_force = cmd.hasSwitch(L"override") || cmd.hasFlag('o');
-
 
845
 
745
	if (cmd.hasSwitch(L"verbose"))
846
	if (cmd.hasSwitch(L"textrename") || cmd.hasFlag('t'))
746
		g_debug = true;
847
		packages.SetRenameText(true);
-
 
848
 
747
	else if (cmd.hasFlag('v'))
849
	if (cmd.hasSwitch(L"enablechild") || cmd.hasFlag('c'))
748
		g_debug = true;
850
		packages.SetAutoEnable(true);
-
 
851
	if (cmd.hasSwitch(L"forcemod") || cmd.hasFlag('m'))
-
 
852
		packages.SetForceModInstall(true);
749
 
853
 
750
	int start = 2;
854
	int start = 2;
751
	/*
855
	/*
752
	// check for switchs
856
	// check for switchs
753
	while ( command[0] == '-' )
857
	while ( command[0] == '-' )
Line 810... Line 914...
810
		{
914
		{
811
			ListPackages(&packages);
915
			ListPackages(&packages);
812
			CloseDestination(cmd, false);
916
			CloseDestination(cmd, false);
813
		}
917
		}
814
	}
918
	}
-
 
919
	else if (command.Compare(L"info"))
-
 
920
	{
-
 
921
		if (cmd.argCount() < 2)
-
 
922
		{
-
 
923
			wprintf(L"Syntax: %s [flags] info <package#>\n\tDisplays info about an installed package\n", cmd.cmdName().c_str());
-
 
924
			wprintf(L"\tUse the <list> command to get the package number to use");
-
 
925
		}
-
 
926
		else
-
 
927
		{
-
 
928
			if (OpenDestination(cmd, destination))
-
 
929
			{
-
 
930
				ShowInfo(cmd);
-
 
931
				CloseDestination(cmd, false);
-
 
932
			}
-
 
933
		}
-
 
934
	}
-
 
935
	else if (command.Compare(L"install"))
-
 
936
	{
-
 
937
		Utils::WString aftertext = InstallPackage(cmd, destination, &lErrors, &packages, false);
-
 
938
		PrintDebug(&lErrors);
-
 
939
		if (!aftertext.empty())
-
 
940
			wprintf(L"\n%s\n", aftertext.c_str());
-
 
941
	}
-
 
942
	else if (command.Compare(L"uninstall"))
-
 
943
	{
-
 
944
		if (cmd.argCount() < 2)
-
 
945
		{
-
 
946
			wprintf(L"Syntax: %s [flags] uninstall <package#>\n\tUninstalls a package, package# is from the /l list command\n", cmd.cmdName().c_str());
-
 
947
			Pause();
-
 
948
			exit(1);
-
 
949
		}
-
 
950
		else
-
 
951
		{
-
 
952
			if (OpenDestination(cmd, destination))
-
 
953
			{
-
 
954
				bool prepare = UninstallPackage(Utils::WString(cmd.arg(1)).toInt(), &lErrors, &packages, command);
-
 
955
				PrintDebug(&lErrors);
-
 
956
				if (prepare)
-
 
957
					CloseDestination(cmd, true);
-
 
958
				else
-
 
959
					packages.RestoreFakePatch();
-
 
960
			}
-
 
961
		}
-
 
962
	}
-
 
963
	else if (command.Compare(L"enable"))
-
 
964
	{
-
 
965
		if (cmd.argCount() < 2)
-
 
966
		{
-
 
967
			wprintf(L"Syntax: %s [flags] enable <package#>\n\tEnables an installed package thats been disabled\n", cmd.cmdName().c_str());
-
 
968
			Pause();
-
 
969
			exit(1);
-
 
970
		}
-
 
971
		else
-
 
972
		{
-
 
973
			if (OpenDestination(cmd, destination))
-
 
974
			{
-
 
975
				bool prepare = EnablePackage(Utils::WString(cmd.arg(1)).toInt(), &lErrors, &packages, command);
-
 
976
				PrintDebug(&lErrors);
-
 
977
				if (prepare)
-
 
978
					CloseDestination(cmd, true);
-
 
979
				else
-
 
980
					packages.RestoreFakePatch();
-
 
981
			}
-
 
982
		}
-
 
983
	}
815
 
984
 
816
	if ( command[0] == '/' )
985
	if ( command[0] == '/' )
817
	{
986
	{
818
		wchar_t c = command[1];
987
		wchar_t c = command[1];
819
 
988
 
Line 879... Line 1048...
879
			Utils::WStringList lArguments;
1048
			Utils::WStringList lArguments;
880
			SplitArguments(argv, argc, start, &lArguments);
1049
			SplitArguments(argv, argc, start, &lArguments);
881
 
1050
 
882
			switch ( c )
1051
			switch ( c )
883
			{
1052
			{
884
				case 'i':
-
 
885
					if ( argc <= start )
-
 
886
						wprintf(L"Syntax: %s [flags] /i <file>\n\tInstalls a package to the destination\n", cmd.cmdName().c_str() );
-
 
887
					else
-
 
888
					{
-
 
889
						Utils::WString aftertext = InstallPackage(lArguments, &lErrors, &packages, disabled);
-
 
890
						if(!aftertext.empty())
-
 
891
						{
-
 
892
							prepare = true;
-
 
893
							endMessage = aftertext;
-
 
894
						}
-
 
895
						PrintDebug(&lErrors);
-
 
896
					}
-
 
897
					break;
-
 
898
 
1053
 
899
				case 'u':
1054
				case 'u':
900
					if ( argc <= start )
1055
					if ( argc <= start )
901
						wprintf(L"Syntax: %s [flags] /u <package#>\n\tUninstalls a package, package# is from the /l list command\n", cmd.cmdName().c_str() );
1056
						wprintf(L"Syntax: %s [flags] /u <package#>\n\tUninstalls a package, package# is from the /l list command\n", cmd.cmdName().c_str() );
902
					else
1057
					else