示例#1
0
        public async Task Start()
        {
            if (_config.GenerateRawFiles)
            {
                GenerateCfgFile();
                GenerateVdmFile();
                GameLauncherConfiguration config = new GameLauncherConfiguration(_config.Demo)
                {
                    EnableHlae             = true,
                    OnGameStarted          = HandleGameStarted,
                    OnGameRunning          = HandleGameRunning,
                    OnGameClosed           = HandleGameClosed,
                    OnHLAEStarted          = HandleHLAEStarted,
                    OnHLAEClosed           = HandleHLAEClosed,
                    DeleteVdmFileAtStratup = false,
                    CsgoExePath            = AppSettings.GetCsgoExePath(),          // TODO move it?
                    EnableHlaeConfigParent = _config.EnableHlaeConfigParent,
                    Fullscreen             = false,
                    Height = _config.Height,
                    Width  = _config.Width,
                    HlaeConfigParentFolderPath = _config.HlaeConfigParentFolderPath,
                    HlaeExePath      = HlaeService.GetHlaeExePath(),
                    LaunchParameters = _config.LaunchParameters,
                    SteamExePath     = AppSettings.SteamExePath(),                 // TODO move it?
                };

                GameLauncher launcher = new GameLauncher(config);
                await launcher.StartGame();
            }
            else
            {
                // just simulate that the game has been closed to start encoding
                await HandleGameClosed();
            }
        }
        /// <summary>
        /// Return the path where FFmpeg is installed.
        /// </summary>
        /// <returns></returns>
        public static string GetFFmpegPath()
        {
            string hlaeFolderPath = HlaeService.GetHlaePath();

            return(Path.Combine(hlaeFolderPath, "ffmpeg"));
        }