示例#1
0
        public void RunStartGame(StartGameData data, bool admin)
        {
            string           startGamePath = StartGameUtil.GetStartGamePath();
            ProcessStartInfo startInfo     = new ProcessStartInfo();

            startInfo.FileName  = startGamePath;
            startInfo.Arguments = data.GetAsArguments();

            if (admin)
            {
                startInfo.Verb = "runas";
            }
            else
            {
                //startInfo.RedirectStandardOutput = true;
                startInfo.UseShellExecute = false;
            }

            process = Process.Start(startInfo);

            //if (!admin) {
            //    process.OutputDataReceived += proc_OutputDataReceived;
            //    process.BeginOutputReadLine();
            //}
        }
示例#2
0
        public void BeginStartGame(string pathToGame, string args, string workingDir = null)
        {
            data               = new StartGameData();
            data.Task          = GameStarterTask.StartGame;
            data.Parameters    = new string[3];
            data.Parameters[0] = pathToGame;
            data.Parameters[1] = args;
            data.Parameters[2] = workingDir;

            string           startGamePath = GetStartGamePath();
            ProcessStartInfo startInfo     = new ProcessStartInfo();

            startInfo.FileName = startGamePath;

            startInfo.Arguments = data.GetAsArguments();
            startInfo.RedirectStandardOutput = true;
            startInfo.UseShellExecute        = false;

            process = Process.Start(startInfo);
            process.OutputDataReceived += proc_OutputDataReceived;
            process.BeginOutputReadLine();
        }
示例#3
0
        public void BeginKillMutex(int processId, params string[] mutex)
        {
            data      = new StartGameData();
            data.Task = GameStarterTask.KillMutex;

            var list = mutex.ToList();

            list.Insert(0, processId.ToString());
            data.Parameters = list.ToArray();

            string           startGamePath = GetStartGamePath();
            ProcessStartInfo startInfo     = new ProcessStartInfo();

            startInfo.FileName = startGamePath;

            startInfo.Arguments = data.GetAsArguments();
            startInfo.RedirectStandardOutput = true;
            startInfo.UseShellExecute        = false;

            process = Process.Start(startInfo);
            process.OutputDataReceived += proc_OutputDataReceived;
            process.BeginOutputReadLine();
        }