WinGui:
authorsr55 <sr55.hb@outlook.com>
Sun, 22 Feb 2009 19:48:14 +0000 (19:48 +0000)
committersr55 <sr55.hb@outlook.com>
Sun, 22 Feb 2009 19:48:14 +0000 (19:48 +0000)
- Fixes culture issue in the Query Generator and Preset loader. Same issue as previous checkin. Thanks to zhango for pointing this code out with a fix.

git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2174 b64f7644-9d1e-0410-96f1-a4d463321fa5

win/C#/frmMain/PresetLoader.cs
win/C#/frmMain/QueryGenerator.cs

index dd6ee48be790d9d88a18c1e5aa6cdbc03d08dff6..f10b7227d8f3ba05b6768a919192568fda7089ee 100644 (file)
@@ -182,11 +182,19 @@ namespace Handbrake
                 if (presetQuery.VideoEncoder == "H.264 (x264)")\r
                 {\r
                     int value;\r
-                    float presetValue, calculated, x264step;\r
-                    float.TryParse(presetQuery.VideoQuality.ToString(), out presetValue);\r
-                    float.TryParse(Properties.Settings.Default.x264cqstep, out x264step);\r
-\r
-                    float x = 51 / x264step;\r
+                    System.Globalization.CultureInfo culture = System.Globalization.CultureInfo.CreateSpecificCulture("en-US");\r
+\r
+                    double presetValue, calculated, x264step;\r
+                    double.TryParse(presetQuery.VideoQuality.ToString(),\r
+                                    System.Globalization.NumberStyles.Number,\r
+                                    culture,\r
+                                    out presetValue);\r
+                    double.TryParse(Properties.Settings.Default.x264cqstep,\r
+                                    System.Globalization.NumberStyles.Number,\r
+                                    culture,\r
+                                    out x264step);\r
+\r
+                    double x = 51 / x264step;\r
 \r
                     calculated = presetValue / x264step;\r
                     calculated = x - calculated;\r
index a14e3e82454148fb630d59d6ef3c07e300fd5bf3..2c04173978ca8b7e5fbcdac41894372ed1542cc7 100644 (file)
@@ -219,7 +219,11 @@ namespace Handbrake
                         break;\r
                     case "H.264 (x264)":\r
                         double divided;\r
-                        double.TryParse(Properties.Settings.Default.x264cqstep, out divided);\r
+                        System.Globalization.CultureInfo culture = System.Globalization.CultureInfo.CreateSpecificCulture("en-US");\r
+                        double.TryParse(Properties.Settings.Default.x264cqstep,\r
+                                        System.Globalization.NumberStyles.Number,\r
+                                        culture,\r
+                                        out divided);\r
                         value = 51 - mainWindow.slider_videoQuality.Value * divided;\r
                         value = Math.Round(value, 2);\r
                         query += " -q " + value.ToString(new CultureInfo("en-US"));\r