// 1 = Build Date\r
DateTime lastModified = File.GetLastWriteTime("HandBrakeCLI.exe");\r
\r
- if (Properties.Settings.Default.hb_build != 0 && Properties.Settings.Default.cliLastModified == lastModified )\r
+ if (Properties.Settings.Default.hb_build != 0 && Properties.Settings.Default.cliLastModified == lastModified)\r
{\r
return;\r
} \r
while (!cliProcess.HasExited)\r
{\r
line = stdOutput.ReadLine() ?? string.Empty;\r
- Match m = Regex.Match(line, @"HandBrake ([svnM0-9.]*) \([0-9]*\)");\r
+ Match m = Regex.Match(line, @"HandBrake ([svnM0-9.]*) \(([0-9]*)\)");\r
Match platform = Regex.Match(line, @"- ([A-Za-z0-9\s ]*) -");\r
\r
if (m.Success)\r
{\r
- string data = line.Replace("(", string.Empty).Replace(")", string.Empty).Replace("HandBrake ", string.Empty);\r
- string[] arr = data.Split(' ');\r
+ string version = m.Groups[1].Success ? m.Groups[1].Value : string.Empty;\r
+ string build = m.Groups[2].Success ? m.Groups[2].Value : string.Empty;\r
\r
- Properties.Settings.Default.hb_build = int.Parse(arr[1]);\r
- Properties.Settings.Default.hb_version = arr[0];\r
+ int buildValue;\r
+ int.TryParse(build, out buildValue);\r
+\r
+ Properties.Settings.Default.hb_build = buildValue;\r
+ Properties.Settings.Default.hb_version = version;\r
}\r
\r
if (platform.Success)\r
}\r
catch (Exception e)\r
{\r
+ Properties.Settings.Default.hb_build = 0;\r
+ Properties.Settings.Default.Save();\r
+\r
frmExceptionWindow exceptionWindow = new frmExceptionWindow();\r
exceptionWindow.Setup("Unable to retrieve version information from the CLI.", e.ToString());\r
exceptionWindow.ShowDialog();\r
}\r
\r
/// <summary>\r
- /// Check to make sure that the user has an up to date version of the CLI installed.\r
- /// </summary>\r
- public static void CheckForValidCliVersion()\r
- {\r
- // Make sure we have a recent version for svn builds\r
- string cli_version = Properties.Settings.Default.hb_version;\r
- Version gui_version = Assembly.GetExecutingAssembly().GetName().Version;\r
-\r
- if (cli_version.Contains("svn") || gui_version.Revision > 0)\r
- {\r
- int gui_build, cli_build;\r
- int.TryParse(gui_version.Revision.ToString(), out gui_build);\r
- int.TryParse(Properties.Settings.Default.hb_version.Replace("svn", string.Empty), out cli_build);\r
-\r
- if (gui_build > cli_build)\r
- {\r
- MessageBox.Show(\r
- "It appears you are trying to use a CLI executable that is too old for this version of the HandBrake GUI.\n" +\r
- "Please update the HandBrakeCLI.exe to a newer build.\n\n" +\r
- "HandBrake build Detected: " + cli_build,\r
- "Error",\r
- MessageBoxButtons.OK,\r
- MessageBoxIcon.Error);\r
- return;\r
- }\r
- }\r
- }\r
-\r
- /// <summary>\r
/// Check if the queue recovery file contains records.\r
/// If it does, it means the last queue did not complete before HandBrake closed.\r
/// So, return a boolean if true. \r