From 3e41c7995374e71e9d61b0dce4ac59066a261599 Mon Sep 17 00:00:00 2001 From: sr55 Date: Wed, 18 Jul 2018 22:28:13 +0100 Subject: WinGui: Move UserSettings over to JSON format. Settings from the older XML format will automatically transfer and the legacy files will be removed. --- .../Factories/HBConfigurationFactory.cs | 10 +- .../HandBrakeWPF/HandBrakeWPF.csproj.DotSettings | 2 + win/CS/HandBrakeWPF/Helpers/AutoNameHelper.cs | 2 +- .../Services/Interfaces/IUserSettingService.cs | 7 +- .../HandBrakeWPF/Services/Presets/PresetService.cs | 2 +- win/CS/HandBrakeWPF/Services/UpdateService.cs | 2 +- win/CS/HandBrakeWPF/Services/UserSettingService.cs | 147 ++++++++++++++++----- win/CS/HandBrakeWPF/UserSettingConstants.cs | 1 - win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs | 12 +- .../ViewModels/StaticPreviewViewModel.cs | 8 +- win/CS/HandBrakeWPF/ViewModels/SummaryViewModel.cs | 10 +- win/CS/HandBrakeWPF/defaultsettings.xml | 48 ------- 12 files changed, 143 insertions(+), 108 deletions(-) create mode 100644 win/CS/HandBrakeWPF/HandBrakeWPF.csproj.DotSettings (limited to 'win/CS') diff --git a/win/CS/HandBrakeWPF/Factories/HBConfigurationFactory.cs b/win/CS/HandBrakeWPF/Factories/HBConfigurationFactory.cs index c4d199ef8..f4e0b9ee7 100644 --- a/win/CS/HandBrakeWPF/Factories/HBConfigurationFactory.cs +++ b/win/CS/HandBrakeWPF/Factories/HBConfigurationFactory.cs @@ -38,15 +38,15 @@ namespace HandBrakeWPF.Factories IsDvdNavDisabled = UserSettingService.GetUserSetting(UserSettingConstants.DisableLibDvdNav), EnableQuickSyncDecoding = UserSettingService.GetUserSetting(UserSettingConstants.EnableQuickSyncDecoding), UseQSVDecodeForNonQSVEnc = UserSettingService.GetUserSetting(UserSettingConstants.UseQSVDecodeForNonQSVEnc), - ScalingMode = UserSettingService.GetUserSetting(UserSettingConstants.ScalingMode), - PreviewScanCount = UserSettingService.GetUserSetting(UserSettingConstants.PreviewScanCount), - Verbosity = UserSettingService.GetUserSetting(UserSettingConstants.Verbosity), - MinScanDuration = UserSettingService.GetUserSetting(UserSettingConstants.MinScanDuration), + ScalingMode = UserSettingService.GetUserSetting(UserSettingConstants.ScalingMode, typeof(int)), + PreviewScanCount = UserSettingService.GetUserSetting(UserSettingConstants.PreviewScanCount, typeof(int)), + Verbosity = UserSettingService.GetUserSetting(UserSettingConstants.Verbosity, typeof(int)), + MinScanDuration = UserSettingService.GetUserSetting(UserSettingConstants.MinScanDuration, typeof(int)), SaveLogToCopyDirectory = UserSettingService.GetUserSetting(UserSettingConstants.SaveLogToCopyDirectory), SaveLogWithVideo = UserSettingService.GetUserSetting(UserSettingConstants.SaveLogWithVideo), SaveLogCopyDirectory = UserSettingService.GetUserSetting(UserSettingConstants.SaveLogCopyDirectory), RemoteServiceEnabled = UserSettingService.GetUserSetting(UserSettingConstants.RemoteServiceEnabled), - RemoteServicePort = UserSettingService.GetUserSetting(UserSettingConstants.RemoteServicePort) + RemoteServicePort = UserSettingService.GetUserSetting(UserSettingConstants.RemoteServicePort, typeof(int)) }; return config; diff --git a/win/CS/HandBrakeWPF/HandBrakeWPF.csproj.DotSettings b/win/CS/HandBrakeWPF/HandBrakeWPF.csproj.DotSettings new file mode 100644 index 000000000..c54c126d2 --- /dev/null +++ b/win/CS/HandBrakeWPF/HandBrakeWPF.csproj.DotSettings @@ -0,0 +1,2 @@ + + CSharp70 \ No newline at end of file diff --git a/win/CS/HandBrakeWPF/Helpers/AutoNameHelper.cs b/win/CS/HandBrakeWPF/Helpers/AutoNameHelper.cs index fb4cd589b..4ef7405f2 100644 --- a/win/CS/HandBrakeWPF/Helpers/AutoNameHelper.cs +++ b/win/CS/HandBrakeWPF/Helpers/AutoNameHelper.cs @@ -124,7 +124,7 @@ namespace HandBrakeWPF.Helpers */ if (task.OutputFormat == OutputFormat.Mp4) { - switch (userSettingService.GetUserSetting(UserSettingConstants.UseM4v)) + switch (userSettingService.GetUserSetting(UserSettingConstants.UseM4v, typeof(int))) { case 0: // Automatic destinationFilename += task.IncludeChapterMarkers || MP4Helper.RequiresM4v(task) ? ".m4v" : ".mp4"; diff --git a/win/CS/HandBrakeWPF/Services/Interfaces/IUserSettingService.cs b/win/CS/HandBrakeWPF/Services/Interfaces/IUserSettingService.cs index 5c85387df..2dee3cde9 100644 --- a/win/CS/HandBrakeWPF/Services/Interfaces/IUserSettingService.cs +++ b/win/CS/HandBrakeWPF/Services/Interfaces/IUserSettingService.cs @@ -9,6 +9,8 @@ namespace HandBrakeWPF.Services.Interfaces { + using System; + using SettingChangedEventArgs = HandBrakeWPF.EventArgs.SettingChangedEventArgs; /// @@ -49,12 +51,15 @@ namespace HandBrakeWPF.Services.Interfaces /// /// The name. /// + /// + /// The convert Type. + /// /// /// The Type of the setting /// /// /// The user setting /// - T GetUserSetting(string name); + T GetUserSetting(string name, Type convertType = null); } } \ No newline at end of file diff --git a/win/CS/HandBrakeWPF/Services/Presets/PresetService.cs b/win/CS/HandBrakeWPF/Services/Presets/PresetService.cs index c53eb4f8a..b851d8a7c 100644 --- a/win/CS/HandBrakeWPF/Services/Presets/PresetService.cs +++ b/win/CS/HandBrakeWPF/Services/Presets/PresetService.cs @@ -740,7 +740,7 @@ namespace HandBrakeWPF.Services.Presets } // Force Upgrade of presets - if (this.userSettingService.GetUserSetting(UserSettingConstants.ForcePresetReset) < ForcePresetReset) + if (this.userSettingService.GetUserSetting(UserSettingConstants.ForcePresetReset, typeof(int)) < ForcePresetReset) { this.userSettingService.SetUserSetting(UserSettingConstants.ForcePresetReset, ForcePresetReset); diff --git a/win/CS/HandBrakeWPF/Services/UpdateService.cs b/win/CS/HandBrakeWPF/Services/UpdateService.cs index d268a06e4..6a2a289a9 100644 --- a/win/CS/HandBrakeWPF/Services/UpdateService.cs +++ b/win/CS/HandBrakeWPF/Services/UpdateService.cs @@ -77,7 +77,7 @@ namespace HandBrakeWPF.Services if (this.userSettingService.GetUserSetting(UserSettingConstants.UpdateStatus)) { DateTime lastUpdateCheck = this.userSettingService.GetUserSetting(UserSettingConstants.LastUpdateCheckDate); - int checkFrequency = this.userSettingService.GetUserSetting(UserSettingConstants.DaysBetweenUpdateCheck) == 0 ? 7 : 30; + int checkFrequency = this.userSettingService.GetUserSetting(UserSettingConstants.DaysBetweenUpdateCheck, typeof(int)) == 0 ? 7 : 30; if (DateTime.Now.Subtract(lastUpdateCheck).TotalDays > checkFrequency) { diff --git a/win/CS/HandBrakeWPF/Services/UserSettingService.cs b/win/CS/HandBrakeWPF/Services/UserSettingService.cs index b6c3f5724..8bd70f509 100644 --- a/win/CS/HandBrakeWPF/Services/UserSettingService.cs +++ b/win/CS/HandBrakeWPF/Services/UserSettingService.cs @@ -10,6 +10,9 @@ namespace HandBrakeWPF.Services { using System; + using System.Collections.Generic; + using System.Collections.Specialized; + using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; @@ -17,32 +20,28 @@ namespace HandBrakeWPF.Services using HandBrake.Interop.Utilities; + using HandBrakeWPF.Collections; + using HandBrakeWPF.Extensions; using HandBrakeWPF.Properties; using HandBrakeWPF.Services.Interfaces; using HandBrakeWPF.Utilities; - using GeneralApplicationException = HandBrakeWPF.Exceptions.GeneralApplicationException; - using SettingChangedEventArgs = HandBrakeWPF.EventArgs.SettingChangedEventArgs; + using Newtonsoft.Json; + using Newtonsoft.Json.Linq; + + using GeneralApplicationException = Exceptions.GeneralApplicationException; + using SettingChangedEventArgs = EventArgs.SettingChangedEventArgs; /// /// The User Setting Service /// public class UserSettingService : IUserSettingService { - /// - /// The Settings File - /// - private readonly string settingsFile = Path.Combine(DirectoryUtilities.GetUserStoragePath(VersionHelper.IsNightly()), "settings.xml"); - - /// - /// The XML Serializer - /// - private readonly XmlSerializer serializer = new XmlSerializer(typeof(Collections.SerializableDictionary)); - - /// - /// The User Settings - /// - private Collections.SerializableDictionary userSettings; + private readonly string settingsFile = Path.Combine(DirectoryUtilities.GetUserStoragePath(VersionHelper.IsNightly()), "settings.json"); + private readonly string releaseSettingsFile = Path.Combine(DirectoryUtilities.GetUserStoragePath(false), "settings.json"); + private readonly string nightlySettingsFile = Path.Combine(DirectoryUtilities.GetUserStoragePath(true), "settings.json"); + private readonly JsonSerializerSettings settings = new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore }; + private Dictionary userSettings; /// /// Initializes a new instance of the class. @@ -80,17 +79,41 @@ namespace HandBrakeWPF.Services /// /// The name. /// + /// + /// The conversion Type. + /// /// /// The Type of the setting /// /// /// The user setting /// - public T GetUserSetting(string name) + public T GetUserSetting(string name, Type conversionType = null) { if (this.userSettings.ContainsKey(name)) { - return (T)this.userSettings[name]; + if (conversionType != null && typeof(int) == conversionType) + { + object storedValue = this.userSettings[name]; + object converted = storedValue?.ToString().ToInt(); + return (T)converted; + } + + // Treat String Arrays as StringCollections. TODO refactor upstream code to more traditional string arrays. + object settingValue = this.userSettings[name]; + if (settingValue.GetType() == typeof(JArray)) + { + string[] stringArr = ((JArray)settingValue).ToObject(); + StringCollection stringCollection = new StringCollection(); + foreach (var item in stringArr) + { + stringCollection.Add(item); + } + + settingValue = stringCollection; + } + + return (T)settingValue; } return default(T); @@ -124,9 +147,11 @@ namespace HandBrakeWPF.Services Directory.CreateDirectory(directory); } - using (FileStream strm = new FileStream(this.settingsFile, FileMode.Create, FileAccess.Write)) + + using (StreamWriter file = new StreamWriter(new FileStream(this.settingsFile, FileMode.Create, FileAccess.Write))) { - this.serializer.Serialize(strm, this.userSettings); + string appSettings = JsonConvert.SerializeObject(this.userSettings, Formatting.Indented, this.settings); + file.Write(appSettings); } } catch (Exception exc) @@ -150,35 +175,37 @@ namespace HandBrakeWPF.Services { using (StreamReader reader = new StreamReader(this.settingsFile)) { - Collections.SerializableDictionary data = (Collections.SerializableDictionary)this.serializer.Deserialize(reader); - this.userSettings = data; + string appSettings = reader.ReadToEnd(); + Dictionary deserialisedSettings = JsonConvert.DeserializeObject< Dictionary>(appSettings); + + this.userSettings = deserialisedSettings; } } - else if (VersionHelper.IsNightly() && File.Exists(Path.Combine(DirectoryUtilities.GetUserStoragePath(false), "settings.xml"))) + else if (VersionHelper.IsNightly() && File.Exists(this.releaseSettingsFile)) { // Port the release versions config to the nightly. - string releasePresetFile = Path.Combine(DirectoryUtilities.GetUserStoragePath(false), "settings.xml"); - if (!Directory.Exists(DirectoryUtilities.GetUserStoragePath(true))) { Directory.CreateDirectory(DirectoryUtilities.GetUserStoragePath(true)); } - File.Copy(releasePresetFile, Path.Combine(DirectoryUtilities.GetUserStoragePath(true), "settings.xml")); + File.Copy(this.releaseSettingsFile, this.nightlySettingsFile); using (StreamReader reader = new StreamReader(this.settingsFile)) { - Collections.SerializableDictionary data = (Collections.SerializableDictionary)this.serializer.Deserialize(reader); - this.userSettings = data; + string appSettings = reader.ReadToEnd(); + Dictionary deserialisedSettings = JsonConvert.DeserializeObject>(appSettings); + this.userSettings = deserialisedSettings; } } else { - this.userSettings = new Collections.SerializableDictionary(); + Dictionary deserialisedSettings = this.GetLegacySettings(); // Check for Legacy files + this.userSettings = deserialisedSettings ?? new SerializableDictionary(); } // Add any missing / new settings - Collections.SerializableDictionary defaults = this.GetDefaults(); + SerializableDictionary defaults = this.GetDefaults(); foreach (var item in defaults.Where(item => !this.userSettings.Keys.Contains(item.Key))) { this.userSettings.Add(item.Key, item.Value); @@ -194,6 +221,7 @@ namespace HandBrakeWPF.Services { File.Delete(this.settingsFile); } + this.Save(); throw new GeneralApplicationException(Resources.UserSettings_YourSettingsHaveBeenReset, Resources.UserSettings_YourSettingsAreCorrupt, exc); @@ -211,23 +239,72 @@ namespace HandBrakeWPF.Services /// /// The get defaults. /// - private Collections.SerializableDictionary GetDefaults() + private SerializableDictionary GetDefaults() { + // TODO Convert this to JSON. try { Assembly assembly = Assembly.GetEntryAssembly(); Stream stream = assembly.GetManifestResourceStream("HandBrakeWPF.defaultsettings.xml"); if (stream != null) { - return (Collections.SerializableDictionary)this.serializer.Deserialize(stream); + XmlSerializer serializer = new XmlSerializer(typeof(Collections.SerializableDictionary)); + return (SerializableDictionary)serializer.Deserialize(stream); } } catch (Exception) { - return new Collections.SerializableDictionary(); + return new SerializableDictionary(); + } + + return new SerializableDictionary(); + } + + private SerializableDictionary GetLegacySettings() + { + // TODO can be removed after 1.2 releases. Useful for 1 version to upgrade users settings to the new format. + SerializableDictionary oldAppSettings = null; + + try + { + string legacyReleaseFile = Path.Combine(DirectoryUtilities.GetUserStoragePath(false), "settings.xml"); + string legacyNightlyFile = Path.Combine(DirectoryUtilities.GetUserStoragePath(true), "settings.xml"); + + if (VersionHelper.IsNightly()) + { + if (File.Exists(legacyNightlyFile)) + { + using (StreamReader reader = new StreamReader(legacyNightlyFile)) + { + XmlSerializer serializer = + new XmlSerializer(typeof(SerializableDictionary)); + oldAppSettings = (SerializableDictionary)serializer.Deserialize(reader); + } + + File.Delete(legacyNightlyFile); + } + } + else + { + if (File.Exists(legacyReleaseFile)) + { + using (StreamReader reader = new StreamReader(legacyReleaseFile)) + { + XmlSerializer serializer = + new XmlSerializer(typeof(SerializableDictionary)); + oldAppSettings = (SerializableDictionary)serializer.Deserialize(reader); + } + + File.Delete(legacyReleaseFile); + } + } + } + catch (Exception exc) + { + Debug.WriteLine(exc); } - return new Collections.SerializableDictionary(); + return oldAppSettings; } } -} +} \ No newline at end of file diff --git a/win/CS/HandBrakeWPF/UserSettingConstants.cs b/win/CS/HandBrakeWPF/UserSettingConstants.cs index cf87b6cec..30d3d7557 100644 --- a/win/CS/HandBrakeWPF/UserSettingConstants.cs +++ b/win/CS/HandBrakeWPF/UserSettingConstants.cs @@ -26,7 +26,6 @@ namespace HandBrakeWPF public const string DefaultPlayer = "defaultPlayer"; public const string LastUpdateCheckDate = "lastUpdateCheckDate"; public const string MainWindowMinimize = "MainWindowMinimize"; - public const string MinTitleLength = "MinTitleLength"; public const string UpdateStatus = "updateStatus"; public const string UseM4v = "useM4v"; public const string VLCPath = "VLC_Path"; diff --git a/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs index 3ad88a97e..736d67e69 100644 --- a/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs @@ -1325,7 +1325,7 @@ namespace HandBrakeWPF.ViewModels this.checkForUpdatesFrequencies.Add("Weekly"); this.checkForUpdatesFrequencies.Add("Monthly"); - this.CheckForUpdatesFrequency = this.userSettingService.GetUserSetting(UserSettingConstants.DaysBetweenUpdateCheck); + this.CheckForUpdatesFrequency = this.userSettingService.GetUserSetting(UserSettingConstants.DaysBetweenUpdateCheck, typeof(int)); if (this.CheckForUpdatesFrequency > 1) { this.CheckForUpdatesFrequency = 1; @@ -1380,7 +1380,7 @@ namespace HandBrakeWPF.ViewModels this.mp4ExtensionOptions.Add("Automatic"); this.mp4ExtensionOptions.Add("Always use MP4"); this.mp4ExtensionOptions.Add("Always use M4V"); - this.SelectedMp4Extension = this.userSettingService.GetUserSetting(UserSettingConstants.UseM4v); + this.SelectedMp4Extension = this.userSettingService.GetUserSetting(UserSettingConstants.UseM4v, typeof(int)); // Remove Underscores this.RemoveUnderscores = this.userSettingService.GetUserSetting(UserSettingConstants.AutoNameRemoveUnderscore); @@ -1400,7 +1400,7 @@ namespace HandBrakeWPF.ViewModels // Video // ############################# this.EnableQuickSyncDecoding = this.userSettingService.GetUserSetting(UserSettingConstants.EnableQuickSyncDecoding); - this.SelectedScalingMode = this.userSettingService.GetUserSetting(UserSettingConstants.ScalingMode); + this.SelectedScalingMode = this.userSettingService.GetUserSetting(UserSettingConstants.ScalingMode, typeof(int)); this.UseQSVDecodeForNonQSVEnc = this.userSettingService.GetUserSetting(UserSettingConstants.UseQSVDecodeForNonQSVEnc); this.EnableQuickSyncEncoding = this.userSettingService.GetUserSetting(UserSettingConstants.EnableQuickSyncEncoding); @@ -1429,7 +1429,7 @@ namespace HandBrakeWPF.ViewModels this.logVerbosityOptions.Add(0); this.logVerbosityOptions.Add(1); this.logVerbosityOptions.Add(2); - this.SelectedVerbosity = userSettingService.GetUserSetting(UserSettingConstants.Verbosity); + this.SelectedVerbosity = userSettingService.GetUserSetting(UserSettingConstants.Verbosity, typeof(int)); // Logs this.CopyLogToEncodeDirectory = userSettingService.GetUserSetting(UserSettingConstants.SaveLogWithVideo); @@ -1462,7 +1462,7 @@ namespace HandBrakeWPF.ViewModels this.PreviewPicturesToScan.Add(50); this.PreviewPicturesToScan.Add(55); this.PreviewPicturesToScan.Add(60); - this.SelectedPreviewCount = this.userSettingService.GetUserSetting(UserSettingConstants.PreviewScanCount); + this.SelectedPreviewCount = this.userSettingService.GetUserSetting(UserSettingConstants.PreviewScanCount, typeof(int)); // x264 step this.ConstantQualityGranularity.Clear(); @@ -1472,7 +1472,7 @@ namespace HandBrakeWPF.ViewModels this.SelectedGranulairty = userSettingService.GetUserSetting(UserSettingConstants.X264Step).ToString("0.00", CultureInfo.InvariantCulture); // Min Title Length - this.MinLength = this.userSettingService.GetUserSetting(UserSettingConstants.MinScanDuration); + this.MinLength = this.userSettingService.GetUserSetting(UserSettingConstants.MinScanDuration, typeof(int)); // Use dvdnav this.DisableLibdvdNav = userSettingService.GetUserSetting(UserSettingConstants.DisableLibDvdNav); diff --git a/win/CS/HandBrakeWPF/ViewModels/StaticPreviewViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/StaticPreviewViewModel.cs index f3e9593be..bbb60f878 100644 --- a/win/CS/HandBrakeWPF/ViewModels/StaticPreviewViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/StaticPreviewViewModel.cs @@ -151,7 +151,7 @@ namespace HandBrakeWPF.ViewModels this.CanPlay = true; UseSystemDefaultPlayer = userSettingService.GetUserSetting(UserSettingConstants.DefaultPlayer); - this.Duration = userSettingService.GetUserSetting(UserSettingConstants.LastPreviewDuration); + this.Duration = userSettingService.GetUserSetting(UserSettingConstants.LastPreviewDuration, typeof(int)); } #endregion @@ -238,7 +238,7 @@ namespace HandBrakeWPF.ViewModels { get { - return this.userSettingService.GetUserSetting(UserSettingConstants.PreviewScanCount) - 1; + return this.userSettingService.GetUserSetting(UserSettingConstants.PreviewScanCount, typeof(int)) - 1; } } @@ -345,7 +345,7 @@ namespace HandBrakeWPF.ViewModels { List startPoints = new List(); for (int i = 1; - i <= this.userSettingService.GetUserSetting(UserSettingConstants.PreviewScanCount); + i <= this.userSettingService.GetUserSetting(UserSettingConstants.PreviewScanCount, typeof(int)); i++) { startPoints.Add(i); @@ -428,7 +428,7 @@ namespace HandBrakeWPF.ViewModels public void NextPreview() { - int maxPreview = this.userSettingService.GetUserSetting(UserSettingConstants.PreviewScanCount); + int maxPreview = this.userSettingService.GetUserSetting(UserSettingConstants.PreviewScanCount, typeof(int)); if ((this.SelectedPreviewImage + 1) == maxPreview) { return; diff --git a/win/CS/HandBrakeWPF/ViewModels/SummaryViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/SummaryViewModel.cs index 18260ec29..b3e176245 100644 --- a/win/CS/HandBrakeWPF/ViewModels/SummaryViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/SummaryViewModel.cs @@ -368,7 +368,7 @@ namespace HandBrakeWPF.ViewModels public void NextPreview() { - int maxPreview = this.userSettingService.GetUserSetting(UserSettingConstants.PreviewScanCount); + int maxPreview = this.userSettingService.GetUserSetting(UserSettingConstants.PreviewScanCount, typeof(int)); if (this.selectedPreview == maxPreview) { return; @@ -384,7 +384,7 @@ namespace HandBrakeWPF.ViewModels public void PreviousPreview() { - int maxPreview = this.userSettingService.GetUserSetting(UserSettingConstants.PreviewScanCount); + int maxPreview = this.userSettingService.GetUserSetting(UserSettingConstants.PreviewScanCount, typeof(int)); if (this.selectedPreview <= 1) { return; @@ -409,7 +409,7 @@ namespace HandBrakeWPF.ViewModels this.IsPreviousPreviewControlVisible = false; } - if (this.selectedPreview < this.userSettingService.GetUserSetting(UserSettingConstants.PreviewScanCount)) + if (this.selectedPreview < this.userSettingService.GetUserSetting(UserSettingConstants.PreviewScanCount, typeof(int))) { this.IsNextPreviewControlVisible = true; } @@ -440,7 +440,7 @@ namespace HandBrakeWPF.ViewModels // Make sure the output extension is set correctly based on the users preferences and selection. if (newExtension == ".mp4" || newExtension == ".m4v") { - switch (this.userSettingService.GetUserSetting(UserSettingConstants.UseM4v)) + switch (this.userSettingService.GetUserSetting(UserSettingConstants.UseM4v, typeof(int))) { case 0: // Auto newExtension = MP4Helper.RequiresM4v(this.Task) ? ".m4v" : ".mp4"; @@ -506,7 +506,7 @@ namespace HandBrakeWPF.ViewModels this.NotifyOfPropertyChange(() => this.AspectInfo); // Preview - this.PreviewInfo = string.Format(ResourcesUI.SummaryView_PreviewInfo, this.selectedPreview, this.userSettingService.GetUserSetting(UserSettingConstants.PreviewScanCount)); + this.PreviewInfo = string.Format(ResourcesUI.SummaryView_PreviewInfo, this.selectedPreview, this.userSettingService.GetUserSetting(UserSettingConstants.PreviewScanCount, typeof(int))); this.NotifyOfPropertyChange(() => this.PreviewInfo); this.ShowPreview = this.userSettingService.GetUserSetting(UserSettingConstants.ShowPreviewOnSummaryTab); diff --git a/win/CS/HandBrakeWPF/defaultsettings.xml b/win/CS/HandBrakeWPF/defaultsettings.xml index d9f47ac91..f0c431063 100644 --- a/win/CS/HandBrakeWPF/defaultsettings.xml +++ b/win/CS/HandBrakeWPF/defaultsettings.xml @@ -120,14 +120,6 @@ - - - skipversion - - - 0 - - autoNaming @@ -224,14 +216,6 @@ (Any) - - - DubMode - - - 255 - - previewScanCount @@ -264,14 +248,6 @@ true - - - ActivityWindowLastMode - - - 0 - - useClosedCaption @@ -312,22 +288,6 @@ - - - DubModeAudio - - - 0 - - - - - DubModeSubtitle - - - 0 - - addOnlyOneAudioPerLanguage @@ -336,14 +296,6 @@ true - - - MinTitleLength - - - 10 - - ShowAdvancedAudioPassthruOpts -- cgit v1.2.3