Example #1
0
 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;
 }
Example #4
0
        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);
        }
Example #5
0
        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);
        }
Example #6
0
        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);
        }
 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
 };
Example #8
0
 static string GetDebugInfo(ZsyncParams p) => p.Verbose ? "-v " : null;
Example #9
0
 static string GetInputFile(ZsyncParams p)
 =>
 (p.ExistingFile != null) && p.ExistingFile.Exists ? $"-i \"{HandlePath(p.ExistingFile)}\" " : string.Empty;
Example #10
0
 string GetArgs(ZsyncParams p) => !string.IsNullOrWhiteSpace(p.Uri.UserInfo)
     ? GetArgsWithAuthInfo(p)
     : GetArgsWithoutAuthInfo(p);
Example #11
0
 string GetArgsWithAuthInfo(ZsyncParams p) =>
 $"{GetInputFile(p)}{GetAuthInfo(p.Uri)}{GetDebugInfo(p)}-o \"{HandlePath(p.File)}\" \"{GetUri(p.Uri).EscapedUri()}\"";
 string GetArgs(ZsyncParams p) => !string.IsNullOrWhiteSpace(p.Uri.UserInfo)
     ? GetArgsWithAuthInfo(p)
     : GetArgsWithoutAuthInfo(p);
Example #13
0
 ProcessStartInfo GetProcessStartInfo(ZsyncParams p) => new ProcessStartInfoBuilder(_binPath, GetArgs(p))
 {
     WorkingDirectory = p.File.ParentDirectoryPath
 }.Build();
 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;
 }
 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;