private static Data.InstallResult RunProcess(ProcessStartInfo processInfo) { var result = new Data.InstallResult(); // The following WindowsUninstaller.WindowsExitCode used below might be Windows specific. // Third party apps might not use same code. Good luck! try { using (var process = Process.Start(processInfo)) { process.WaitForExit(); result.ExitCode = process.ExitCode; result.ExitCodeMessage = new Win32Exception(process.ExitCode).Message; switch (result.ExitCode) { case (int)Data.InstallerResults.WindowsExitCode.Restart: case (int)Data.InstallerResults.WindowsExitCode.Reboot: result.Restart = true; result.Success = true; break; case (int)Data.InstallerResults.WindowsExitCode.Sucessful: result.Success = true; break; default: result.Success = false; break; } } } catch (Exception) { Data.Logger("RunProcess FAILED"); result.ExitCode = -1; result.ExitCodeMessage = String.Format("Error trying to run {0}.", processInfo.FileName); result.Output = String.Empty; } return(result); }
private static Data.InstallResult RunProcess(ProcessStartInfo processInfo) { var result = new Data.InstallResult(); // The following WindowsUninstaller.WindowsExitCode used below might be Windows specific. // Third party apps might not use same code. Good luck! try { using (var process = Process.Start(processInfo)) { process.WaitForExit(); result.ExitCode = process.ExitCode; result.ExitCodeMessage = new Win32Exception(process.ExitCode).Message; switch (result.ExitCode) { case (int)Data.InstallerResults.WindowsExitCode.Restart: case (int)Data.InstallerResults.WindowsExitCode.Reboot: result.Restart = true; result.Success = true; break; case (int)Data.InstallerResults.WindowsExitCode.Sucessful: result.Success = true; break; default: result.Success = false; break; } } } catch (Exception) { Data.Logger("RunProcess FAILED"); result.ExitCode = -1; result.ExitCodeMessage = String.Format("Error trying to run {0}.", processInfo.FileName); result.Output = String.Empty; } return result; }