Beispiel #1
0
        public GameInfo(HLMOD ModInfo)
        {
            this.modInfo = ModInfo;
            Initialize();

            AssignValues();
        }
Beispiel #2
0
        public static void LaunchMod(HLMOD mod, string arguments)
        {
            bool executableExists = CheckExecutableExists(mod.Executable);
            var  filename         = "hl.exe";
            var  proc_arg         = string.Empty;

            if (CheckExecutableExists(mod.Executable))
            {
                filename = mod.Executable;
            }
            else if (CheckExecutableExists("hl.exe"))
            {
                filename = "hl.exe";
                proc_arg = " -game " + mod.ModFolder;
            }
            else if (CheckExecutableExists("hl2.exe")) // test source compat
            {
                filename = "hl2.exe";
                proc_arg = " -game " + mod.ModFolder;
            }
            else
            {
                System.Windows.Forms.MessageBox.Show("hl.exe was not found, cannot launch the game.", "Executable Not Found", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                return;
            }

            proc_arg += " " + arguments;

            using (var process = new Process())
            {
                process.StartInfo.WorkingDirectory = System.IO.Directory.GetCurrentDirectory();
                process.StartInfo.FileName         = filename;
                process.StartInfo.Arguments        = proc_arg;
                process.Start();
            }
        }