From 4ec40322ea7ac15f645a6a056da99b43d6d2ac12 Mon Sep 17 00:00:00 2001 From: sr55 Date: Fri, 4 Nov 2011 23:02:19 +0000 Subject: WinGui: Several more culture issue fixes. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4340 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- win/CS/Controls/x264Panel.cs | 14 ++++++-------- win/CS/Functions/QueryGenerator.cs | 7 +++---- win/CS/HandBrake.ApplicationServices/Parsing/Title.cs | 9 ++------- .../Utilities/QueryGeneratorUtility.cs | 7 +++---- .../HandBrake.Interop/HandBrakeInterop/SourceData/Title.cs | 3 --- win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs | 2 +- win/CS/ToolWindows/AdvancedAudio.cs | 11 ++++------- win/CS/frmMain.cs | 2 +- win/CS/frmOptions.cs | 2 +- 9 files changed, 21 insertions(+), 36 deletions(-) (limited to 'win') diff --git a/win/CS/Controls/x264Panel.cs b/win/CS/Controls/x264Panel.cs index c7625d720..732ee2d4f 100644 --- a/win/CS/Controls/x264Panel.cs +++ b/win/CS/Controls/x264Panel.cs @@ -27,8 +27,6 @@ namespace Handbrake.Controls /// private readonly IUserSettingService UserSettingService = ServiceManager.UserSettingService; - private CultureInfo culture = CultureInfo.CreateSpecificCulture("en-US"); - /// /// Initializes a new instance of the class. /// Initializes a new instance of the x264 panel user control @@ -480,7 +478,7 @@ namespace Handbrake.Controls else { double value = slider_adaptiveQuantStrength.Value * 0.1; - string aqs = value.ToString("f1", culture); + string aqs = value.ToString("f1", CultureInfo.InvariantCulture); thisOpt = "aq-strength=" + aqs; } } @@ -493,8 +491,8 @@ namespace Handbrake.Controls double psyrd = slider_psyrd.Value * 0.1; double psytre = slider_psytrellis.Value * 0.05; - string rd = psyrd.ToString("f2", culture); - string rt = psytre.ToString("f2", culture); + string rd = psyrd.ToString("f2", CultureInfo.InvariantCulture); + string rt = psytre.ToString("f2", CultureInfo.InvariantCulture); thisOpt = "psy-rd=" + rd + "," + rt; } @@ -783,7 +781,7 @@ namespace Handbrake.Controls else { double value = slider_adaptiveQuantStrength.Value * 0.1; - string aqs = value.ToString("f1", culture); + string aqs = value.ToString("f1", CultureInfo.InvariantCulture); query += colon + "aq-strength=" + aqs; } } @@ -796,8 +794,8 @@ namespace Handbrake.Controls double psyrd = slider_psyrd.Value * 0.1; double psytre = slider_psytrellis.Value * 0.05; - string rd = psyrd.ToString("f1", culture); - string rt = psytre.ToString("f2", culture); + string rd = psyrd.ToString("f1", CultureInfo.InvariantCulture); + string rt = psytre.ToString("f2", CultureInfo.InvariantCulture); query += colon + "psy-rd=" + rd + "," + rt; } diff --git a/win/CS/Functions/QueryGenerator.cs b/win/CS/Functions/QueryGenerator.cs index c042daa79..7bf0dd01b 100644 --- a/win/CS/Functions/QueryGenerator.cs +++ b/win/CS/Functions/QueryGenerator.cs @@ -374,17 +374,16 @@ namespace Handbrake.Functions case "MPEG-4 (FFmpeg)": case "MPEG-2 (FFmpeg)": value = 31 - (mainWindow.slider_videoQuality.Value - 1); - query += " -q " + value.ToString(new CultureInfo("en-US")); + query += " -q " + value.ToString(CultureInfo.InvariantCulture); break; case "H.264 (x264)": - CultureInfo culture = CultureInfo.CreateSpecificCulture("en-US"); value = 51 - (mainWindow.slider_videoQuality.Value * cqStep); value = Math.Round(value, 2); - query += " -q " + value.ToString(culture); + query += " -q " + value.ToString(CultureInfo.InvariantCulture); break; case "VP3 (Theora)": value = mainWindow.slider_videoQuality.Value; - query += " -q " + value.ToString(new CultureInfo("en-US")); + query += " -q " + value.ToString(CultureInfo.InvariantCulture); break; } } diff --git a/win/CS/HandBrake.ApplicationServices/Parsing/Title.cs b/win/CS/HandBrake.ApplicationServices/Parsing/Title.cs index 362a86a7e..6b3d517c9 100644 --- a/win/CS/HandBrake.ApplicationServices/Parsing/Title.cs +++ b/win/CS/HandBrake.ApplicationServices/Parsing/Title.cs @@ -21,11 +21,6 @@ namespace HandBrake.ApplicationServices.Parsing /// public class Title { - /// - /// The Culture Info - /// - private static readonly CultureInfo Culture = new CultureInfo("en-US", false); - /// /// The User Setting Service /// @@ -193,8 +188,8 @@ namespace HandBrake.ApplicationServices.Parsing { thisTitle.Resolution = new Size(int.Parse(m.Groups[1].Value), int.Parse(m.Groups[2].Value)); thisTitle.ParVal = new Size(int.Parse(m.Groups[3].Value), int.Parse(m.Groups[4].Value)); - thisTitle.AspectRatio = float.Parse(m.Groups[5].Value, Culture); - thisTitle.Fps = float.Parse(m.Groups[6].Value, Culture); + thisTitle.AspectRatio = float.Parse(m.Groups[5].Value, CultureInfo.InvariantCulture); + thisTitle.Fps = float.Parse(m.Groups[6].Value, CultureInfo.InvariantCulture); } // Get autocrop region for this title diff --git a/win/CS/HandBrake.ApplicationServices/Utilities/QueryGeneratorUtility.cs b/win/CS/HandBrake.ApplicationServices/Utilities/QueryGeneratorUtility.cs index 9835603cd..07da56ec0 100644 --- a/win/CS/HandBrake.ApplicationServices/Utilities/QueryGeneratorUtility.cs +++ b/win/CS/HandBrake.ApplicationServices/Utilities/QueryGeneratorUtility.cs @@ -306,17 +306,16 @@ namespace HandBrake.ApplicationServices.Utilities { case VideoEncoder.FFMpeg: value = 31 - (task.Quality.Value - 1); - query += string.Format(" -q {0}", value.ToString(new CultureInfo("en-US"))); + query += string.Format(" -q {0}", value.ToString(CultureInfo.InvariantCulture)); break; case VideoEncoder.X264: - CultureInfo culture = CultureInfo.CreateSpecificCulture("en-US"); value = 51 - (task.Quality.Value * x264CqStep); value = Math.Round(value, 2); - query += string.Format(" -q {0}", value.ToString(culture)); + query += string.Format(" -q {0}", value.ToString(CultureInfo.InvariantCulture)); break; case VideoEncoder.Theora: value = task.Quality.Value; - query += string.Format(" -q {0}", value.ToString(new CultureInfo("en-US"))); + query += string.Format(" -q {0}", value.ToString(CultureInfo.InvariantCulture)); break; } break; diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/SourceData/Title.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/SourceData/Title.cs index be4f8a306..4a668d367 100644 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/SourceData/Title.cs +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/SourceData/Title.cs @@ -11,9 +11,7 @@ namespace HandBrake.Interop.SourceData { using System; using System.Collections.Generic; - using System.Globalization; - using HandBrake.Interop; using HandBrake.Interop.Model; /// @@ -21,7 +19,6 @@ namespace HandBrake.Interop.SourceData /// public class Title { - private static readonly CultureInfo Culture = new CultureInfo("en-US", false); private readonly List audioTracks; private readonly List chapters; private readonly List subtitles; diff --git a/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs index 9af9590f3..35207e3b8 100644 --- a/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs @@ -1407,7 +1407,7 @@ namespace HandBrakeWPF.ViewModels this.ConstantQualityGranularity.Add("0.50"); this.ConstantQualityGranularity.Add("0.25"); this.ConstantQualityGranularity.Add("0.20"); - this.selectedGranulairty = userSettingService.GetUserSetting(ASUserSettingConstants.X264Step).ToString("0.00", new CultureInfo("en-US")); + this.selectedGranulairty = userSettingService.GetUserSetting(ASUserSettingConstants.X264Step).ToString("0.00", CultureInfo.InvariantCulture); // Min Title Length this.minLength = this.userSettingService.GetUserSetting(ASUserSettingConstants.MinScanDuration); diff --git a/win/CS/ToolWindows/AdvancedAudio.cs b/win/CS/ToolWindows/AdvancedAudio.cs index d1fb0763e..f3446797c 100644 --- a/win/CS/ToolWindows/AdvancedAudio.cs +++ b/win/CS/ToolWindows/AdvancedAudio.cs @@ -16,9 +16,6 @@ namespace Handbrake.ToolWindows /// public partial class AdvancedAudio : Form { - // Culture Info - private static readonly CultureInfo Culture = new CultureInfo("en-US", false); - /// /// Initializes a new instance of the class. /// @@ -69,9 +66,9 @@ namespace Handbrake.ToolWindows int drcCalculated; if (track.DRC != 0) drcValue = ((track.DRC * 10) + 1) - 10; - int.TryParse(drcValue.ToString(Culture), out drcCalculated); + int.TryParse(drcValue.ToString(CultureInfo.InvariantCulture), out drcCalculated); tb_drc.Value = drcCalculated; - lbl_drc.Text = track.DRC.ToString(Culture); + lbl_drc.Text = track.DRC.ToString(CultureInfo.InvariantCulture); tb_drc.Enabled = track.TrackDisplay.Contains("(AC3)"); // Se the Track Name @@ -119,7 +116,7 @@ namespace Handbrake.ToolWindows int drcCalculated; if (track.DRC != 0) drcValue = ((track.DRC * 10) + 1) - 10; - int.TryParse(drcValue.ToString(Culture), out drcCalculated); + int.TryParse(drcValue.ToString(CultureInfo.InvariantCulture), out drcCalculated); tb_drc.Value = drcCalculated; // Set the model. @@ -142,7 +139,7 @@ namespace Handbrake.ToolWindows else value = ((tb_drc.Value - 1) / 10.0) + 1; - lbl_drc.Text = value.ToString(Culture); + lbl_drc.Text = value.ToString(CultureInfo.InvariantCulture); track.DRC = value; } diff --git a/win/CS/frmMain.cs b/win/CS/frmMain.cs index b1e5196fb..4f2e70c2b 100644 --- a/win/CS/frmMain.cs +++ b/win/CS/frmMain.cs @@ -1970,7 +1970,7 @@ namespace Handbrake case "H.264 (x264)": double rfValue = 51.0 - slider_videoQuality.Value * cqStep; rfValue = Math.Round(rfValue, 2); - lbl_SliderValue.Text = "RF:" + rfValue.ToString(new CultureInfo("en-US")); + lbl_SliderValue.Text = "RF:" + rfValue.ToString(CultureInfo.InvariantCulture); if (rfValue == 0) { diff --git a/win/CS/frmOptions.cs b/win/CS/frmOptions.cs index 651d5fff3..3fc663473 100644 --- a/win/CS/frmOptions.cs +++ b/win/CS/frmOptions.cs @@ -229,7 +229,7 @@ namespace Handbrake drop_previewScanCount.SelectedItem = this.userSettingService.GetUserSetting(UserSettingConstants.PreviewScanCount).ToString(); // x264 step - string step = userSettingService.GetUserSetting(ASUserSettingConstants.X264Step).ToString(new CultureInfo("en-US")); + string step = userSettingService.GetUserSetting(ASUserSettingConstants.X264Step).ToString(CultureInfo.InvariantCulture); switch (step) { case "1": -- cgit v1.2.3