Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
// GameLauncher.cpp : main project file.#include "stdafx.h"#include "Forms/Form1.h"#include "X3Data.h"using namespace GameLauncher;[STAThreadAttribute]int main(array<System::String ^> ^args){// Enabling Windows XP visual effects before any controls are createdApplication::EnableVisualStyles();Application::SetCompatibleTextRenderingDefault(false);System::String ^runFile;System::String ^gameFile;System::String ^arguments;bool intoArgs = false;for ( int i = 0; i < args->Length; i++ ){if ( String::Compare(args[i], "--gameargs", false) )intoArgs;else{if ( i == 0 && !intoArgs )gameFile = args[i];else if ( i == 1 && !intoArgs )runFile = args[i];else if ( arguments )arguments += " " + args[i];elsearguments = args[i];}}if ( args->Length >= 1 )gameFile = args[0];if ( args->Length > 1 )runFile = args[1];// Create the main window and run itif ( args->Length > 2 )arguments = args[2];if ( !runFile || !runFile->Length ){RegistryKey ^searchKey = Registry::CurrentUser->OpenSubKey("Software\\Egosoft\\PluginManagerSettings");if ( searchKey )runFile = System::Convert::ToString(searchKey->GetValue("Run"));}Form1 ^form = gcnew Form1(gameFile, arguments, runFile);Application::Run(form);if ( runFile && form->Resume()){System::Diagnostics::ProcessStartInfo ^info = gcnew System::Diagnostics::ProcessStartInfo(runFile);info->WorkingDirectory = System::IO::FileInfo(runFile).DirectoryName;info->UseShellExecute = false;info->WindowStyle = System::Diagnostics::ProcessWindowStyle::Normal;System::Diagnostics::Process ^process = System::Diagnostics::Process::Start(info);}return 0;}