コード例 #1
0
 public static GameLauncherConfiguration BuildGameLauncherConfiguration(Demo demo)
 {
     return(new GameLauncherConfiguration(demo)
     {
         SteamExePath = AppSettings.SteamExePath(),
         Width = Settings.Default.ResolutionWidth,
         Height = Settings.Default.ResolutionHeight,
         Fullscreen = Settings.Default.IsFullscreen,
         IsWorldwideEnabled = Settings.Default.IsWorldwideEnabled,
         EnableHlae = Settings.Default.EnableHlae,
         CsgoExePath = Settings.Default.CsgoExePath,
         EnableHlaeConfigParent = Settings.Default.EnableHlaeConfigParent,
         HlaeConfigParentFolderPath = Settings.Default.HlaeConfigParentFolderPath,
         HlaeExePath = HlaeService.GetHlaeExePath(),
         LaunchParameters = Settings.Default.LaunchParameters,
         UseCustomActionsGeneration = Settings.Default.UseCustomActionsGeneration,
     });
 }
コード例 #2
0
        public async void StartGame()
        {
            SetupResolutionParameters();
            KillCsgo();
            if (Properties.Settings.Default.EnableHlae)
            {
                // start the game using HLAE
                if (!File.Exists(Properties.Settings.Default.CsgoExePath))
                {
                    throw new CsgoNotFoundException();
                }

                string hlaeExePath = HlaeService.GetHlaeExePath();
                if (!File.Exists(hlaeExePath))
                {
                    throw new HlaeNotFound();
                }

                _arguments.Add(Properties.Settings.Default.LaunchParameters);
                List <string> argList = new List <string>(_hlaeArguments)
                {
                    $"-csgoExe \"{Properties.Settings.Default.CsgoExePath}\"",
                    $"-customLaunchOptions \"{string.Join(ARGUMENT_SEPARATOR, _arguments.ToArray())}\""
                };

                string hlaeConfigParentPath = Properties.Settings.Default.HlaeConfigParentFolderPath;
                if (Properties.Settings.Default.EnableHlaeConfigParent && Directory.Exists(hlaeConfigParentPath))
                {
                    argList.Add("-mmcfgEnabled true");
                    argList.Add($"-mmcfg \"{hlaeConfigParentPath}\"");
                }

                string           args = string.Join(ARGUMENT_SEPARATOR, argList.ToArray());
                ProcessStartInfo psi  = new ProcessStartInfo
                {
                    Arguments       = args,
                    FileName        = hlaeExePath,
                    UseShellExecute = false
                };
                Process.Start(psi);
            }
            else
            {
                string args = string.Join(ARGUMENT_SEPARATOR, _arguments.ToArray());
                _process.StartInfo.Arguments = args + " " + Properties.Settings.Default.LaunchParameters;
                _process.Start();
            }

            if (_removeVdmFile)
            {
                await Task.Delay(3000);

                Process[] processes = Process.GetProcessesByName(AppSettings.CSGO_PROCESS_NAME);
                if (processes.Length > 0)
                {
                    Process p = processes[0];
                    p.EnableRaisingEvents = true;
                    p.Exited += (sender, args) =>
                    {
                        DeleteVdmFile();
                    };
                }
            }
        }