OSDN Git Service

WinGui:
[handbrake-jp/handbrake-jp-git.git] / win / C# / Functions / Main.cs
index 4d82fb1..ebc3f38 100644 (file)
@@ -10,6 +10,7 @@ namespace Handbrake.Functions
     using System.Diagnostics;\r
     using System.IO;\r
     using System.Net;\r
+    using System.Reflection;\r
     using System.Text;\r
     using System.Text.RegularExpressions;\r
     using System.Threading;\r
@@ -345,18 +346,21 @@ namespace Handbrake.Functions
         public static void CheckForValidCliVersion()\r
         {\r
             // Make sure we have a recent version for svn builds\r
-            string version = Properties.Settings.Default.hb_version;\r
-            if (version.Contains("svn"))\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
-                version = version.Replace("svn", string.Empty).Trim();\r
-                int build;\r
-                int.TryParse(version, out build);\r
-                if (build < Properties.Settings.Default.hb_min_cli)\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: " + Properties.Settings.Default.hb_version,\r
+                        "HandBrake build Detected: " + cli_build,\r
                         "Error",\r
                         MessageBoxButtons.OK,\r
                         MessageBoxIcon.Error);\r