From c3e391f2fe94084c2a5ffb221cd1ced0b4c861bf Mon Sep 17 00:00:00 2001 From: sr55 Date: Mon, 14 May 2012 23:24:25 +0000 Subject: WinGui: - Fix some stupid code in the CliCheckHelper class which could easily cause it to not set version information. - Fix an issue in the scan service where it could try to write to a log directory which doesn't exist yet leading to no log file being displayed. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4680 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- win/CS/HandBrakeWPF/Helpers/CliCheckHelper.cs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'win/CS/HandBrakeWPF') diff --git a/win/CS/HandBrakeWPF/Helpers/CliCheckHelper.cs b/win/CS/HandBrakeWPF/Helpers/CliCheckHelper.cs index b663cf2bf..da349c417 100644 --- a/win/CS/HandBrakeWPF/Helpers/CliCheckHelper.cs +++ b/win/CS/HandBrakeWPF/Helpers/CliCheckHelper.cs @@ -72,14 +72,12 @@ namespace HandBrakeWPF.Helpers cliProcess.Start(); // Retrieve standard output and report back to parent thread until the process is complete + bool success = false; TextReader stdOutput = cliProcess.StandardError; - - while (!cliProcess.HasExited) + while ((line = stdOutput.ReadLine()) != null) { - line = stdOutput.ReadLine() ?? string.Empty; Match m = Regex.Match(line, @"HandBrake ([svnM0-9.]*) \(([0-9]*)\)"); Match platform = Regex.Match(line, @"- ([A-Za-z0-9\s ]*) -"); - if (m.Success) { string version = m.Groups[1].Success ? m.Groups[1].Value : string.Empty; @@ -90,6 +88,7 @@ namespace HandBrakeWPF.Helpers userSettingService.SetUserSetting(ASUserSettingConstants.HandBrakeBuild, buildValue); userSettingService.SetUserSetting(ASUserSettingConstants.HandBrakeVersion, version); + success = true; } if (platform.Success) @@ -97,7 +96,10 @@ namespace HandBrakeWPF.Helpers userSettingService.SetUserSetting( ASUserSettingConstants.HandBrakePlatform, platform.Value.Replace("-", string.Empty).Trim()); } + } + while (!cliProcess.HasExited) + { if (cliProcess.TotalProcessorTime.Seconds > 10) // Don't wait longer than 10 seconds. { Process cli = Process.GetProcessById(cliProcess.Id); @@ -108,7 +110,10 @@ namespace HandBrakeWPF.Helpers } } - userSettingService.SetUserSetting(ASUserSettingConstants.HandBrakeExeHash, base64Hash); + if (success) + { + userSettingService.SetUserSetting(ASUserSettingConstants.HandBrakeExeHash, base64Hash); + } } catch (Exception e) { -- cgit v1.2.3