summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsr55 <[email protected]>2012-05-14 23:24:25 +0000
committersr55 <[email protected]>2012-05-14 23:24:25 +0000
commitc3e391f2fe94084c2a5ffb221cd1ced0b4c861bf (patch)
tree6b4f3fe904a6717371ed15f95f4a958b2669b1c9
parent0a46de5cf236dd05ac9cd18451f2fd23fc6419a7 (diff)
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
-rw-r--r--win/CS/HandBrake.ApplicationServices/Services/ScanService.cs7
-rw-r--r--win/CS/HandBrakeWPF/Helpers/CliCheckHelper.cs15
2 files changed, 16 insertions, 6 deletions
diff --git a/win/CS/HandBrake.ApplicationServices/Services/ScanService.cs b/win/CS/HandBrake.ApplicationServices/Services/ScanService.cs
index cc94a3f7d..cd9eb834a 100644
--- a/win/CS/HandBrake.ApplicationServices/Services/ScanService.cs
+++ b/win/CS/HandBrake.ApplicationServices/Services/ScanService.cs
@@ -21,7 +21,7 @@ namespace HandBrake.ApplicationServices.Services
/// <summary>
/// Scan a Source
/// </summary>
- public class ScanService : IScan
+ public class ScanService : IScan
{
#region Private Variables
@@ -210,6 +210,11 @@ namespace HandBrake.ApplicationServices.Services
logDir,
string.Format("last_scan_log{0}.txt", GeneralUtilities.GetInstanceCount));
+ if (!Directory.Exists(logDir))
+ {
+ Directory.CreateDirectory(logDir);
+ }
+
// Make we don't pick up a stale last_encode_log.txt (and that we have rights to the file)
if (File.Exists(dvdInfoPath))
{
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)
{