private void RunEXEFile(string exeName, string parameter, bool raiseEventOnExit)
{
try
{
if (!File.Exists(exeName))
{
throw new FileNotFoundException("Game EXE '" + exeName + "' has not been built. Use the Build EXE command and then try again.");
}
_testGameProcess = new Process();
_testGameProcess.StartInfo.FileName = exeName;
_testGameProcess.StartInfo.Arguments = parameter;
if (raiseEventOnExit)
{
_testGameProcess.EnableRaisingEvents = true;
_testGameProcess.Exited += new EventHandler(_testGameProcess_Exited);
}
_testGameProcess.Start();
}
catch (Exception ex)
{
if (raiseEventOnExit)
{
_testGameProcess_Exited(null, null);
}
throw ex;
}
}