From 2529c8be8826c4c7beb0c417740e5e3cee9251ff Mon Sep 17 00:00:00 2001 From: Jaex Date: Wed, 4 Jun 2014 14:44:37 +0300 Subject: [PATCH] Little changes --- HelpersLib/CLI/ExternalCLIManager.cs | 7 ++++--- ScreenCaptureLib/Screencast/ScreencastOptions.cs | 3 +-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/HelpersLib/CLI/ExternalCLIManager.cs b/HelpersLib/CLI/ExternalCLIManager.cs index 024f7d963..3407e53ea 100644 --- a/HelpersLib/CLI/ExternalCLIManager.cs +++ b/HelpersLib/CLI/ExternalCLIManager.cs @@ -52,11 +52,12 @@ public virtual int Open(string path, string args = null) psi.WorkingDirectory = Path.GetDirectoryName(path); process.EnableRaisingEvents = true; - process.OutputDataReceived += cli_OutputDataReceived; - process.ErrorDataReceived += cli_ErrorDataReceived; + if (psi.RedirectStandardOutput) process.OutputDataReceived += cli_OutputDataReceived; + if (psi.RedirectStandardError) process.ErrorDataReceived += cli_ErrorDataReceived; process.StartInfo = psi; process.Start(); - process.BeginErrorReadLine(); + if (psi.RedirectStandardOutput) process.BeginOutputReadLine(); + if (psi.RedirectStandardError) process.BeginErrorReadLine(); process.WaitForExit(); return process.ExitCode; } diff --git a/ScreenCaptureLib/Screencast/ScreencastOptions.cs b/ScreenCaptureLib/Screencast/ScreencastOptions.cs index 3711d085b..cd29f5985 100644 --- a/ScreenCaptureLib/Screencast/ScreencastOptions.cs +++ b/ScreenCaptureLib/Screencast/ScreencastOptions.cs @@ -66,8 +66,7 @@ public string GetFFmpegCommands() int lastIndex = commands.LastIndexOf('"'); if (lastIndex >= 0) { - commands = commands.Remove(lastIndex); - lastIndex = commands.LastIndexOf('"'); + lastIndex = commands.LastIndexOf('"', lastIndex - 1); if (lastIndex >= 0) { commands = commands.Remove(lastIndex);