Subversion Repositories spk

Rev

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

Rev 298 Rev 341
Line 11... Line 11...
11
/*
11
/*
12
	Main entry point to program
12
	Main entry point to program
13
*/
13
*/
14
int main ( int argc, char **argv )
14
int main ( int argc, char **argv )
15
{
15
{
16
	printf ( "XModDiff V1.00 (SPK Library Version %.2f) 01/04/2011 Created by Cycrow\n\n", (float)GetLibraryVersion() );
16
	wprintf ( L"XModDiff V1.00 (SPK Library Version %.2f) 01/04/2011 Created by Cycrow\n\n", (float)GetLibraryVersion() );
17
 
17
 
18
	// parse the cmd name
18
	// parse the cmd name
19
	Utils::WString cmd (argv[0]);
19
	Utils::WString cmd (argv[0]);
20
	Utils::WString dir = CFileIO(cmd).dir();
20
	Utils::WString dir = CFileIO(cmd).dir();
21
	cmd = CFileIO(cmd).filename();
21
	cmd = CFileIO(cmd).filename();
Line 23... Line 23...
23
	bool verbose = false;
23
	bool verbose = false;
24
 
24
 
25
	if ( argc < 3 )
25
	if ( argc < 3 )
26
	{
26
	{
27
		wprintf ( L"Syntax: %s [-v] <modfile.cat> <diff file> [gamedirectory]\n", cmd.c_str() );
27
		wprintf ( L"Syntax: %s [-v] <modfile.cat> <diff file> [gamedirectory]\n", cmd.c_str() );
28
		printf ( "\t<modfile.cat>:\t\tThe mod file you want to generate the diff for\n" );
28
		wprintf ( L"\t<modfile.cat>:\t\tThe mod file you want to generate the diff for\n" );
29
		printf ( "\t<diff file>:\t\tThe file to save the diff to\n" );
29
		wprintf ( L"\t<diff file>:\t\tThe file to save the diff to\n" );
30
		printf ( "\t[gamedirectory]:\tThe game directory to compare the mod against, without this will assume current directory\n" );
30
		wprintf ( L"\t[gamedirectory]:\tThe game directory to compare the mod against, without this will assume current directory\n" );
31
	}
31
	}
32
	else
32
	else
33
	{
33
	{
34
		// check for switches
34
		// check for switches
35
		int startPos = 1;
35
		int startPos = 1;
Line 46... Line 46...
46
				{
46
				{
47
					switch (checkFlags[i])
47
					switch (checkFlags[i])
48
					{
48
					{
49
						case 'v':
49
						case 'v':
50
							verbose = true;
50
							verbose = true;
-
 
51
							verbose = true;
51
							break;
52
							break;
52
					}
53
					}
53
				}
54
				}
54
			}
55
			}
55
			else if ( checkFlags.Compare("--verbose") )
56
			else if ( checkFlags.Compare("--verbose") )
Line 69... Line 70...
69
			wprintf  (L"Error: Unable to load game directory, %s\n", gamedir.c_str());
70
			wprintf  (L"Error: Unable to load game directory, %s\n", gamedir.c_str());
70
			Error();
71
			Error();
71
		}
72
		}
72
 
73
 
73
		if ( gamedir.Compare(L".") )
74
		if ( gamedir.Compare(L".") )
74
			printf ( "Game Directory: 'CURRENT' loaded\n");
75
			wprintf ( L"Game Directory: 'CURRENT' loaded\n");
75
		else
76
		else
76
			wprintf ( L"Game Directory: '%s' loaded\n", gamedir.c_str());
77
			wprintf ( L"Game Directory: '%s' loaded\n", gamedir.c_str());
77
 
78
 
78
		if ( !Diff.CreateDiff(modfile) )
79
		if ( !Diff.CreateDiff(modfile) )
79
		{
80
		{
Line 81... Line 82...
81
			Error();
82
			Error();
82
		}
83
		}
83
 
84
 
84
		if ( Diff.GetDiffFiles().empty() )
85
		if ( Diff.GetDiffFiles().empty() )
85
		{
86
		{
86
			printf("No diff entries found\n" );
87
			wprintf(L"No diff entries found\n" );
87
			Error();
88
			Error();
88
		}
89
		}
89
		printf("Diff generated\n");
90
		wprintf(L"Diff generated\n");
90
 
91
 
91
		if ( verbose )
92
		if ( verbose )
92
		{
93
		{
93
			for ( SDiffFile *d = Diff.GetDiffFiles().First(); d; d = Diff.GetDiffFiles().Next() )
94
			for ( SDiffFile *d = Diff.GetDiffFiles().First(); d; d = Diff.GetDiffFiles().Next() )
94
			{
95
			{