public static void ConfirmSuccess(this ProcessExitResult result) { if (result.ExitCode != 0) { throw result.GenerateException(); } }
private static void ProcessExitResult(ProcessExitResult r) { switch (r.ExitCode) { case 3: // TODO throw new SteamInitializationException( "The Steam client does not appear to be running, or runs under different (Administrator?) priviledges. Please start Steam and/or restart the withSIX client under the same priviledges"); case 4: throw new SteamNotFoundException( "The Steam client does not appear to be running, nor was Steam found"); case 9: throw new TimeoutException("The operation timed out waiting for a response from the Steam client"); case 10: throw new OperationCanceledException("The operation was canceled"); } r.ConfirmSuccess(); }
protected void HandleRsyncResponse(ProcessExitResult response) { if (response.ExitCode == 0) return; throw new RsyncException($"Rsync [{response.Id}] exited with code {response.ExitCode}"); }
public static ProcessExitResultWithOutput FromProcessExitResult(ProcessExitResult result, string output, string error = null) => new ProcessExitResultWithOutput(result.ExitCode, result.Id, result.StartInfo, output, error);
static string GenerateMessage(ProcessExitResult exitResult) => "The process with ID: " + exitResult.Id + ", did not exit gracefully, CODE: " + exitResult.ExitCode;
public static ProcessException GenerateException(this ProcessExitResult exitResult) => new ProcessException(GenerateMessage(exitResult));