OSDN Git Service

WinGui:
authorsr55 <sr55@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Sat, 21 Aug 2010 19:48:04 +0000 (19:48 +0000)
committersr55 <sr55@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Sat, 21 Aug 2010 19:48:04 +0000 (19:48 +0000)
- Strip out some version checking code that's no longer required.

git-svn-id: svn://localhost/HandBrake/trunk@3490 b64f7644-9d1e-0410-96f1-a4d463321fa5

win/C#/Functions/Main.cs
win/C#/frmMain.cs

index e6f8e07..0ea9a8e 100644 (file)
@@ -278,7 +278,7 @@ namespace Handbrake.Functions
             // 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
@@ -305,16 +305,19 @@ namespace Handbrake.Functions
                 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
@@ -336,6 +339,9 @@ namespace Handbrake.Functions
             }\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
@@ -343,35 +349,6 @@ namespace Handbrake.Functions
         }\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
index d95d085..57528ed 100644 (file)
@@ -95,7 +95,6 @@ namespace Handbrake
 \r
             // Update the users config file with the CLI version data.\r
             Main.SetCliVersionData();\r
-            Main.CheckForValidCliVersion();\r
 \r
             if (Settings.Default.hb_version.Contains("svn"))\r
             {\r