Ejemplo n.º 1
0
        /// <summary>
        /// Launches the game.
        /// </summary>
        public void LaunchGame()
        {
            //start new process of the game executable
            try
            {
                ProcessStartInfo gameStartInfo = new ProcessStartInfo();
                gameStartInfo.UseShellExecute = false;
                gameStartInfo.FileName        = Config.GetGameExecutable();
                GameExitArgs.GameName         = Config.GetGameName();

                Process game = Process.Start(gameStartInfo);
                game.EnableRaisingEvents = true;

                game.Exited += delegate(object sender, EventArgs e)
                {
                    GameExitArgs.ExitCode = game.ExitCode;
                    OnGameExited();
                };
            }
            catch (IOException ioex)
            {
                Console.WriteLine("IOException in LaunchGame(): " + ioex.Message);
                OnGameLaunchFailed();
            }
        }