Subversion Repositories spk

Rev

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

Rev 183 Rev 191
Line 34... Line 34...
34
	CLanguages::Instance()->SetLanguage(44);
34
	CLanguages::Instance()->SetLanguage(44);
35
 
35
 
36
	bool Advanced = false, fromLauncher = false, silent = false, gamerun = false;
36
	bool Advanced = false, fromLauncher = false, silent = false, gamerun = false;
37
	for ( int i = 0; i < args->Length; i++ )
37
	for ( int i = 0; i < args->Length; i++ )
38
	{
38
	{
39
		CyString arg = CyStringFromSystemString(args[i]);
39
		Utils::WString arg = _WS(args[i]);
40
 
40
 
41
		if ( gamerun ) {
41
		if ( gamerun ) {
42
			if ( gameArgs && gameArgs->Length ) gameArgs += " ";
42
			if ( gameArgs && gameArgs->Length ) gameArgs += " ";
43
			gameArgs += args[i];
43
			gameArgs += args[i];
44
		}
44
		}
45
		// its a switch
45
		// its a switch
46
		else if ( arg.Left(2) == "--" )
46
		else if ( arg.left(2) == L"--" )
47
		{
47
		{
48
			CyString argSwitch = arg.GetToken(":", 1, 1).ToLower();
48
			Utils::WString argSwitch = arg.token(L":", 1).lower();
49
			CyString argSwitchFirst = arg.GetToken(" ", 1, 1).ToLower();
49
			Utils::WString argSwitchFirst = arg.token(L" ", 1).lower();
50
			CyString rest = arg.GetToken(":", 2);
50
			Utils::WString rest = arg.tokens(L":", 2);
51
			if ( rest[0] == '"' && rest[rest.Length() - 1] != '"' )
51
			if ( rest[0] == '"' && rest[rest.length() - 1] != '"' )
52
			{
52
			{
53
				rest.Erase(0, 1);
53
				rest.erase(0, 1);
54
				while ( i < args->Length )
54
				while ( i < args->Length )
55
				{
55
				{
56
					i++;
56
					i++;
57
					CyString argCheck = CyStringFromSystemString(args[i]);
57
					Utils::WString argCheck = _WS(args[i]);
58
					rest += " ";
58
					rest += " ";
59
					rest += argCheck;
59
					rest += argCheck;
60
					if ( argCheck.Right(1) == "\"" )
60
					if ( argCheck.right(1) == L"\"" )
61
						break;
61
						break;
62
				}
62
				}
63
			}
63
			}
64
 
64
 
65
			if ( rest.Right(1) == "\"" )
65
			if ( rest.right(1) == L"\"" )
66
				rest.Truncate(rest.Length() - 1);
66
				rest.truncate(rest.length() - 1);
67
 
67
 
68
			if ( argSwitch == "--dir" && !rest.Empty() )
68
			if ( argSwitch == "--dir" && !rest.empty() )
69
			{
69
			{
70
				Utils::String gameName = packages.getGameName(rest.ToString());
70
				Utils::String gameName = packages.getGameName(rest.toString());
71
				if ( !gameName.empty() )
71
				if ( !gameName.empty() )
72
					dirList.pushBack(rest.ToString(), gameName);
72
					dirList.pushBack(rest.toString(), gameName);
73
			}
73
			}
74
 
74
 
75
			if ( argSwitch == "--advanced" )
75
			if ( argSwitch == "--advanced" )
76
				Advanced = true;
76
				Advanced = true;
77
			else if ( argSwitch == "--fromlauncher" )
77
			else if ( argSwitch == "--fromlauncher" )
78
				fromLauncher = true;
78
				fromLauncher = true;
79
			else if ( argSwitch == "--silent" )
79
			else if ( argSwitch == "--silent" )
80
				silent = true;
80
				silent = true;
81
			else if ( argSwitch == "--forceemp" )
81
			else if ( argSwitch == "--forceemp" )
82
				packages.SetForceEMP(true);
82
				packages.SetForceEMP(true);
83
			else if ( argSwitch == "--gamerun"; && !rest.Empty() )
83
			else if (argSwitch == "--gamerun"; && !rest.empty())
84
			{
84
			{
85
				gameArgs = SystemStringFromCyString(rest);
85
				gameArgs = _US(rest);
86
				break;
86
				break;
87
			}
87
			}
88
			else if ( argSwitch == "--gamerun" ) {
88
			else if ( argSwitch == "--gamerun" ) {
89
				gamerun = true;
89
				gamerun = true;
90
			}
90
			}
91
			else if ( argSwitchFirst == "--gamerun" ) {
91
			else if ( argSwitchFirst == "--gamerun" ) {
92
				gamerun = true;
92
				gamerun = true;
93
				gameArgs = SystemStringFromCyString(arg.GetToken(" ", 2));
93
				gameArgs = _US(arg.tokens(L" ", 2));
94
			}
94
			}
95
			else if ( argSwitch == "--noresume" )
95
			else if ( argSwitch == "--noresume" )
96
			{
96
			{
97
				RegistryKey ^searchKey = Registry::CurrentUser->CreateSubKey("Software\\Egosoft\\PluginManagerSettings");
97
				RegistryKey ^searchKey = Registry::CurrentUser->CreateSubKey("Software\\Egosoft\\PluginManagerSettings");
98
				if ( searchKey )
98
				if ( searchKey )
Line 107... Line 107...
107
			}
107
			}
108
			else if ( argSwitch == "--debug" ) {
108
			else if ( argSwitch == "--debug" ) {
109
				CFileLog *log = dynamic_cast<CFileLog *>(CFileLog::create());
109
				CFileLog *log = dynamic_cast<CFileLog *>(CFileLog::create());
110
				log->setFile(_S(mydoc) + "/Egosoft/pluginmanager.log");
110
				log->setFile(_S(mydoc) + "/Egosoft/pluginmanager.log");
111
				log->setFilter(CLog::Log_Install | CLog::Log_Uninstall | CLog::Log_IO | CLog::Log_Directory | CLog::Log_File);
111
				log->setFilter(CLog::Log_Install | CLog::Log_Uninstall | CLog::Log_IO | CLog::Log_Directory | CLog::Log_File);
112
				log->setLevel(rest.ToInt());
112
				log->setLevel(rest.toInt());
113
			}
113
			}
114
		}
114
		}
115
		// otherwise it must be a file to open
115
		// otherwise it must be a file to open
116
		else
116
		else
117
			openPackage = SystemStringFromCyString(arg);
117
			openPackage = _US(arg);
118
	}
118
	}
119
 
119
 
120
#if _DEBUG
120
#if _DEBUG
121
	CFileLog *log = dynamic_cast<CFileLog *>(CFileLog::create());
121
	CFileLog *log = dynamic_cast<CFileLog *>(CFileLog::create());
122
	log->setFile(_S(mydoc) + "/Egosoft/pluginmanager.log");
122
	log->setFile(_S(mydoc) + "/Egosoft/pluginmanager.log");