LaunchAndProcessInfo BuildProcessInfo(ZsyncParams p) => new LaunchAndProcessInfo(GetProcessStartInfo(p)) { StandardOutputAction = (x, args) => ParseOutput(x, args, p.Progress), StandardErrorAction = (x, args) => ParseOutput(x, args, p.Progress), MonitorOutput = _processManager.DefaultMonitorOutputTimeOut, MonitorResponding = _processManager.DefaultMonitorRespondingTimeOut, CancellationToken = p.CancelToken };
public ProcessExitResultWithOutput RunAndProcess(ZsyncParams p) { TryHandleOldFiles(p.File); var processInfo = BuildProcessInfo(p); var r = ProcessExitResultWithOutput.FromProcessExitResult(_processManager.LaunchAndProcess(processInfo), p.Progress.Output); if (r.ExitCode == 0) TryRemoveOldFiles(p.File); return r; }
public async Task<ProcessExitResultWithOutput> RunAndProcessAsync(ZsyncParams p) { TryHandleOldFiles(p.File); var processInfo = BuildProcessInfo(p); var r = ProcessExitResultWithOutput.FromProcessExitResult( await _processManager.LaunchAndProcessAsync(processInfo).ConfigureAwait(false), p.Progress.Output); if (r.ExitCode == 0) TryRemoveOldFiles(p.File); return r; }
public ProcessExitResultWithOutput Run(ZsyncParams p) { TryHandleOldFiles(p.File); var startInfo = new ProcessStartInfo(_binPath.ToString(), GetArgs(p)) .SetWorkingDirectoryOrDefault(p.File.ParentDirectoryPath); var r = _processManager.LaunchAndGrab(new BasicLaunchInfo(startInfo)); if (r.ExitCode == 0) { TryRemoveOldFiles(p.File); } return(r); }
public ProcessExitResultWithOutput RunAndProcess(ZsyncParams p) { TryHandleOldFiles(p.File); var processInfo = BuildProcessInfo(p); var r = ProcessExitResultWithOutput.FromProcessExitResult(_processManager.LaunchAndProcess(processInfo), p.Progress.Output); if (r.ExitCode == 0) { TryRemoveOldFiles(p.File); } return(r); }
public async Task <ProcessExitResultWithOutput> RunAndProcessAsync(ZsyncParams p) { TryHandleOldFiles(p.File); var processInfo = BuildProcessInfo(p); var r = ProcessExitResultWithOutput.FromProcessExitResult( await _processManager.LaunchAndProcessAsync(processInfo).ConfigureAwait(false), p.Progress.Output); if (r.ExitCode == 0) { TryRemoveOldFiles(p.File); } return(r); }
static string GetDebugInfo(ZsyncParams p) => p.Verbose ? "-v " : null;
static string GetInputFile(ZsyncParams p) => (p.ExistingFile != null) && p.ExistingFile.Exists ? $"-i \"{HandlePath(p.ExistingFile)}\" " : string.Empty;
string GetArgs(ZsyncParams p) => !string.IsNullOrWhiteSpace(p.Uri.UserInfo) ? GetArgsWithAuthInfo(p) : GetArgsWithoutAuthInfo(p);
string GetArgsWithAuthInfo(ZsyncParams p) => $"{GetInputFile(p)}{GetAuthInfo(p.Uri)}{GetDebugInfo(p)}-o \"{HandlePath(p.File)}\" \"{GetUri(p.Uri).EscapedUri()}\"";
ProcessStartInfo GetProcessStartInfo(ZsyncParams p) => new ProcessStartInfoBuilder(_binPath, GetArgs(p)) { WorkingDirectory = p.File.ParentDirectoryPath }.Build();
public ProcessExitResultWithOutput Run(ZsyncParams p) { TryHandleOldFiles(p.File); var startInfo = new ProcessStartInfo(_binPath.ToString(), GetArgs(p)) .SetWorkingDirectoryOrDefault(p.File.ParentDirectoryPath); var r = _processManager.LaunchAndGrab(new BasicLaunchInfo(startInfo)); if (r.ExitCode == 0) TryRemoveOldFiles(p.File); return r; }