]> granicus.if.org Git - handbrake/commitdiff
WinGui: Move UserSettings over to JSON format. Settings from the older XML format...
authorsr55 <sr55.hb@outlook.com>
Wed, 18 Jul 2018 21:28:13 +0000 (22:28 +0100)
committersr55 <sr55.hb@outlook.com>
Wed, 18 Jul 2018 21:28:27 +0000 (22:28 +0100)
12 files changed:
win/CS/HandBrakeWPF/Factories/HBConfigurationFactory.cs
win/CS/HandBrakeWPF/HandBrakeWPF.csproj.DotSettings [new file with mode: 0644]
win/CS/HandBrakeWPF/Helpers/AutoNameHelper.cs
win/CS/HandBrakeWPF/Services/Interfaces/IUserSettingService.cs
win/CS/HandBrakeWPF/Services/Presets/PresetService.cs
win/CS/HandBrakeWPF/Services/UpdateService.cs
win/CS/HandBrakeWPF/Services/UserSettingService.cs
win/CS/HandBrakeWPF/UserSettingConstants.cs
win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs
win/CS/HandBrakeWPF/ViewModels/StaticPreviewViewModel.cs
win/CS/HandBrakeWPF/ViewModels/SummaryViewModel.cs
win/CS/HandBrakeWPF/defaultsettings.xml

index c4d199ef8ac3fb88c25c1330c3a852c8219684af..f4e0b9ee7a6a15cdd6e8e0bc36bc13c041ec2dd2 100644 (file)
@@ -38,15 +38,15 @@ namespace HandBrakeWPF.Factories
                                              IsDvdNavDisabled = UserSettingService.GetUserSetting<bool>(UserSettingConstants.DisableLibDvdNav),\r
                                              EnableQuickSyncDecoding = UserSettingService.GetUserSetting<bool>(UserSettingConstants.EnableQuickSyncDecoding), \r
                                              UseQSVDecodeForNonQSVEnc = UserSettingService.GetUserSetting<bool>(UserSettingConstants.UseQSVDecodeForNonQSVEnc),\r
-                                             ScalingMode = UserSettingService.GetUserSetting<VideoScaler>(UserSettingConstants.ScalingMode), \r
-                                             PreviewScanCount = UserSettingService.GetUserSetting<int>(UserSettingConstants.PreviewScanCount), \r
-                                             Verbosity = UserSettingService.GetUserSetting<int>(UserSettingConstants.Verbosity), \r
-                                             MinScanDuration = UserSettingService.GetUserSetting<int>(UserSettingConstants.MinScanDuration), \r
+                                             ScalingMode = UserSettingService.GetUserSetting<VideoScaler>(UserSettingConstants.ScalingMode, typeof(int)), \r
+                                             PreviewScanCount = UserSettingService.GetUserSetting<int>(UserSettingConstants.PreviewScanCount, typeof(int)), \r
+                                             Verbosity = UserSettingService.GetUserSetting<int>(UserSettingConstants.Verbosity, typeof(int)), \r
+                                             MinScanDuration = UserSettingService.GetUserSetting<int>(UserSettingConstants.MinScanDuration, typeof(int)), \r
                                              SaveLogToCopyDirectory = UserSettingService.GetUserSetting<bool>(UserSettingConstants.SaveLogToCopyDirectory), \r
                                              SaveLogWithVideo = UserSettingService.GetUserSetting<bool>(UserSettingConstants.SaveLogWithVideo), \r
                                              SaveLogCopyDirectory = UserSettingService.GetUserSetting<string>(UserSettingConstants.SaveLogCopyDirectory), \r
                                              RemoteServiceEnabled = UserSettingService.GetUserSetting<bool>(UserSettingConstants.RemoteServiceEnabled),\r
-                                             RemoteServicePort = UserSettingService.GetUserSetting<int>(UserSettingConstants.RemoteServicePort)\r
+                                             RemoteServicePort = UserSettingService.GetUserSetting<int>(UserSettingConstants.RemoteServicePort, typeof(int))\r
             };\r
 \r
             return config;\r
diff --git a/win/CS/HandBrakeWPF/HandBrakeWPF.csproj.DotSettings b/win/CS/HandBrakeWPF/HandBrakeWPF.csproj.DotSettings
new file mode 100644 (file)
index 0000000..c54c126
--- /dev/null
@@ -0,0 +1,2 @@
+<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
+       <s:String x:Key="/Default/CodeInspection/CSharpLanguageProject/LanguageLevel/@EntryValue">CSharp70</s:String></wpf:ResourceDictionary>
\ No newline at end of file
index fb4cd589b1b34886a8cd2cc4ba7c6bb9728b9ad4..4ef7405f24572e4d125e011878b9b208de6466bc 100644 (file)
@@ -124,7 +124,7 @@ namespace HandBrakeWPF.Helpers
                  */\r
                 if (task.OutputFormat == OutputFormat.Mp4)\r
                 {\r
-                    switch (userSettingService.GetUserSetting<int>(UserSettingConstants.UseM4v))\r
+                    switch (userSettingService.GetUserSetting<int>(UserSettingConstants.UseM4v, typeof(int)))\r
                     {\r
                         case 0: // Automatic\r
                             destinationFilename += task.IncludeChapterMarkers || MP4Helper.RequiresM4v(task) ? ".m4v" : ".mp4";\r
index 5c85387df7212347233078fc9ddb2fcff6969725..2dee3cde94b12b84635875edbc7047cca4417877 100644 (file)
@@ -9,6 +9,8 @@
 \r
 namespace HandBrakeWPF.Services.Interfaces\r
 {\r
+    using System;\r
+\r
     using SettingChangedEventArgs = HandBrakeWPF.EventArgs.SettingChangedEventArgs;\r
 \r
     /// <summary>\r
@@ -49,12 +51,15 @@ namespace HandBrakeWPF.Services.Interfaces
         /// <param name="name">\r
         /// The name.\r
         /// </param>\r
+        /// <param name="convertType">\r
+        /// The convert Type.\r
+        /// </param>\r
         /// <typeparam name="T">\r
         /// The Type of the setting\r
         /// </typeparam>\r
         /// <returns>\r
         /// The user setting\r
         /// </returns>\r
-        T GetUserSetting<T>(string name);\r
+        T GetUserSetting<T>(string name, Type convertType = null);\r
     }\r
 }
\ No newline at end of file
index c53eb4f8a8384f75e1589861bca795d8cabdc8a0..b851d8a7c9df2cd39abae8cfdd21389dd4a66520 100644 (file)
@@ -740,7 +740,7 @@ namespace HandBrakeWPF.Services.Presets
                 }\r
 \r
                 // Force Upgrade of presets\r
-                if (this.userSettingService.GetUserSetting<int>(UserSettingConstants.ForcePresetReset) < ForcePresetReset)\r
+                if (this.userSettingService.GetUserSetting<int>(UserSettingConstants.ForcePresetReset, typeof(int)) < ForcePresetReset)\r
                 {\r
                     this.userSettingService.SetUserSetting(UserSettingConstants.ForcePresetReset, ForcePresetReset);\r
 \r
index d268a06e476bdb8891aeffdf6a06085e860f7fa0..6a2a289a94b5cf9bfe53f25618eb884defd54a52 100644 (file)
@@ -77,7 +77,7 @@ namespace HandBrakeWPF.Services
             if (this.userSettingService.GetUserSetting<bool>(UserSettingConstants.UpdateStatus))\r
             {\r
                 DateTime lastUpdateCheck = this.userSettingService.GetUserSetting<DateTime>(UserSettingConstants.LastUpdateCheckDate);\r
-                int checkFrequency = this.userSettingService.GetUserSetting<int>(UserSettingConstants.DaysBetweenUpdateCheck) == 0 ? 7 : 30;\r
+                int checkFrequency = this.userSettingService.GetUserSetting<int>(UserSettingConstants.DaysBetweenUpdateCheck, typeof(int)) == 0 ? 7 : 30;\r
 \r
                 if (DateTime.Now.Subtract(lastUpdateCheck).TotalDays > checkFrequency)\r
                 {\r
index b6c3f57248fc7cec4fde34187a65975cc426fb80..8bd70f509ae68389f0e0cc993c8d69cfa69206cf 100644 (file)
@@ -10,6 +10,9 @@
 namespace HandBrakeWPF.Services\r
 {\r
     using System;\r
+    using System.Collections.Generic;\r
+    using System.Collections.Specialized;\r
+    using System.Diagnostics;\r
     using System.IO;\r
     using System.Linq;\r
     using System.Reflection;\r
@@ -17,32 +20,28 @@ namespace HandBrakeWPF.Services
 \r
     using HandBrake.Interop.Utilities;\r
 \r
+    using HandBrakeWPF.Collections;\r
+    using HandBrakeWPF.Extensions;\r
     using HandBrakeWPF.Properties;\r
     using HandBrakeWPF.Services.Interfaces;\r
     using HandBrakeWPF.Utilities;\r
 \r
-    using GeneralApplicationException = HandBrakeWPF.Exceptions.GeneralApplicationException;\r
-    using SettingChangedEventArgs = HandBrakeWPF.EventArgs.SettingChangedEventArgs;\r
+    using Newtonsoft.Json;\r
+    using Newtonsoft.Json.Linq;\r
+\r
+    using GeneralApplicationException = Exceptions.GeneralApplicationException;\r
+    using SettingChangedEventArgs = EventArgs.SettingChangedEventArgs;\r
 \r
     /// <summary>\r
     /// The User Setting Service\r
     /// </summary>\r
     public class UserSettingService : IUserSettingService\r
     {\r
-        /// <summary>\r
-        /// The Settings File\r
-        /// </summary>\r
-        private readonly string settingsFile = Path.Combine(DirectoryUtilities.GetUserStoragePath(VersionHelper.IsNightly()), "settings.xml");\r
-\r
-        /// <summary>\r
-        /// The XML Serializer \r
-        /// </summary>\r
-        private readonly XmlSerializer serializer = new XmlSerializer(typeof(Collections.SerializableDictionary<string, object>));\r
-\r
-        /// <summary>\r
-        /// The User Settings\r
-        /// </summary>\r
-        private Collections.SerializableDictionary<string, object> userSettings;\r
+        private readonly string settingsFile = Path.Combine(DirectoryUtilities.GetUserStoragePath(VersionHelper.IsNightly()), "settings.json");\r
+        private readonly string releaseSettingsFile = Path.Combine(DirectoryUtilities.GetUserStoragePath(false), "settings.json");\r
+        private readonly string nightlySettingsFile = Path.Combine(DirectoryUtilities.GetUserStoragePath(true), "settings.json");\r
+        private readonly JsonSerializerSettings settings = new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore };\r
+        private Dictionary<string, object> userSettings;\r
 \r
         /// <summary>\r
         /// Initializes a new instance of the <see cref="UserSettingService"/> class.\r
@@ -80,17 +79,41 @@ namespace HandBrakeWPF.Services
         /// <param name="name">\r
         /// The name.\r
         /// </param>\r
+        /// <param name="conversionType">\r
+        /// The conversion Type.\r
+        /// </param>\r
         /// <typeparam name="T">\r
         /// The Type of the setting\r
         /// </typeparam>\r
         /// <returns>\r
         /// The user setting\r
         /// </returns>\r
-        public T GetUserSetting<T>(string name)\r
+        public T GetUserSetting<T>(string name, Type conversionType = null)\r
         {\r
             if (this.userSettings.ContainsKey(name))\r
             {\r
-                return (T)this.userSettings[name];\r
+                if (conversionType != null && typeof(int) == conversionType)\r
+                {\r
+                    object storedValue = this.userSettings[name];\r
+                    object converted = storedValue?.ToString().ToInt();\r
+                    return (T)converted;\r
+                }\r
+\r
+                // Treat String Arrays as StringCollections.  TODO refactor upstream code to more traditional string arrays.\r
+                object settingValue = this.userSettings[name];\r
+                if (settingValue.GetType() == typeof(JArray))\r
+                {\r
+                    string[] stringArr = ((JArray)settingValue).ToObject<string[]>();\r
+                    StringCollection stringCollection = new StringCollection();\r
+                    foreach (var item in stringArr)\r
+                    {\r
+                        stringCollection.Add(item);\r
+                    }\r
+\r
+                    settingValue = stringCollection;\r
+                }\r
+\r
+                return (T)settingValue;\r
             }\r
 \r
             return default(T);\r
@@ -124,9 +147,11 @@ namespace HandBrakeWPF.Services
                     Directory.CreateDirectory(directory);\r
                 }\r
 \r
-                using (FileStream strm = new FileStream(this.settingsFile, FileMode.Create, FileAccess.Write))\r
+\r
+                using (StreamWriter file = new StreamWriter(new FileStream(this.settingsFile, FileMode.Create, FileAccess.Write)))\r
                 {\r
-                    this.serializer.Serialize(strm, this.userSettings);\r
+                    string appSettings = JsonConvert.SerializeObject(this.userSettings, Formatting.Indented, this.settings);\r
+                    file.Write(appSettings);\r
                 }\r
             }\r
             catch (Exception exc)\r
@@ -150,35 +175,37 @@ namespace HandBrakeWPF.Services
                 {\r
                     using (StreamReader reader = new StreamReader(this.settingsFile))\r
                     {\r
-                        Collections.SerializableDictionary<string, object> data = (Collections.SerializableDictionary<string, object>)this.serializer.Deserialize(reader);\r
-                        this.userSettings = data;\r
+                        string appSettings = reader.ReadToEnd();\r
+                        Dictionary<string, object> deserialisedSettings = JsonConvert.DeserializeObject< Dictionary<string, object>>(appSettings);\r
+\r
+                        this.userSettings = deserialisedSettings;\r
                     }\r
                 }\r
-                else if (VersionHelper.IsNightly() && File.Exists(Path.Combine(DirectoryUtilities.GetUserStoragePath(false), "settings.xml")))\r
+                else if (VersionHelper.IsNightly() && File.Exists(this.releaseSettingsFile))\r
                 {\r
                     // Port the release versions config to the nightly.\r
-                    string releasePresetFile = Path.Combine(DirectoryUtilities.GetUserStoragePath(false), "settings.xml");\r
-\r
                     if (!Directory.Exists(DirectoryUtilities.GetUserStoragePath(true)))\r
                     {\r
                         Directory.CreateDirectory(DirectoryUtilities.GetUserStoragePath(true));\r
                     }\r
 \r
-                    File.Copy(releasePresetFile, Path.Combine(DirectoryUtilities.GetUserStoragePath(true), "settings.xml"));\r
+                    File.Copy(this.releaseSettingsFile, this.nightlySettingsFile);\r
 \r
                     using (StreamReader reader = new StreamReader(this.settingsFile))\r
                     {\r
-                        Collections.SerializableDictionary<string, object> data = (Collections.SerializableDictionary<string, object>)this.serializer.Deserialize(reader);\r
-                        this.userSettings = data;\r
+                        string appSettings = reader.ReadToEnd();\r
+                        Dictionary<string, object> deserialisedSettings = JsonConvert.DeserializeObject<Dictionary<string, object>>(appSettings);\r
+                        this.userSettings = deserialisedSettings;\r
                     }\r
                 }\r
                 else\r
                 {\r
-                    this.userSettings = new Collections.SerializableDictionary<string, object>();\r
+                    Dictionary<string, object> deserialisedSettings = this.GetLegacySettings(); // Check for Legacy files\r
+                    this.userSettings = deserialisedSettings ?? new SerializableDictionary<string, object>();\r
                 }\r
 \r
                 // Add any missing / new settings\r
-                Collections.SerializableDictionary<string, object> defaults = this.GetDefaults();\r
+                SerializableDictionary<string, object> defaults = this.GetDefaults();\r
                 foreach (var item in defaults.Where(item => !this.userSettings.Keys.Contains(item.Key)))\r
                 {\r
                     this.userSettings.Add(item.Key, item.Value);\r
@@ -194,6 +221,7 @@ namespace HandBrakeWPF.Services
                     {\r
                         File.Delete(this.settingsFile);\r
                     }\r
+\r
                     this.Save();\r
 \r
                     throw new GeneralApplicationException(Resources.UserSettings_YourSettingsHaveBeenReset, Resources.UserSettings_YourSettingsAreCorrupt, exc);\r
@@ -211,23 +239,72 @@ namespace HandBrakeWPF.Services
         /// <returns>\r
         /// The get defaults.\r
         /// </returns>\r
-        private Collections.SerializableDictionary<string, object> GetDefaults()\r
+        private SerializableDictionary<string, object> GetDefaults()\r
         {\r
+            // TODO Convert this to JSON.\r
             try\r
             {\r
                 Assembly assembly = Assembly.GetEntryAssembly();\r
                 Stream stream = assembly.GetManifestResourceStream("HandBrakeWPF.defaultsettings.xml");\r
                 if (stream != null)\r
                 {\r
-                    return (Collections.SerializableDictionary<string, object>)this.serializer.Deserialize(stream);\r
+                    XmlSerializer serializer = new XmlSerializer(typeof(Collections.SerializableDictionary<string, object>));\r
+                    return (SerializableDictionary<string, object>)serializer.Deserialize(stream);\r
                 }\r
             }\r
             catch (Exception)\r
             {\r
-                return new Collections.SerializableDictionary<string, object>();\r
+                return new SerializableDictionary<string, object>();\r
+            }\r
+\r
+            return new SerializableDictionary<string, object>();\r
+        }\r
+\r
+        private SerializableDictionary<string, object> GetLegacySettings()\r
+        {\r
+            // TODO can be removed after 1.2 releases. Useful for 1 version to upgrade users settings to the new format.\r
+            SerializableDictionary<string, object> oldAppSettings = null;\r
+\r
+            try\r
+            {\r
+                string legacyReleaseFile = Path.Combine(DirectoryUtilities.GetUserStoragePath(false), "settings.xml");\r
+                string legacyNightlyFile = Path.Combine(DirectoryUtilities.GetUserStoragePath(true), "settings.xml");\r
+\r
+                if (VersionHelper.IsNightly())\r
+                {\r
+                    if (File.Exists(legacyNightlyFile))\r
+                    {\r
+                        using (StreamReader reader = new StreamReader(legacyNightlyFile))\r
+                        {\r
+                            XmlSerializer serializer =\r
+                                new XmlSerializer(typeof(SerializableDictionary<string, object>));\r
+                            oldAppSettings = (SerializableDictionary<string, object>)serializer.Deserialize(reader);\r
+                        }\r
+\r
+                        File.Delete(legacyNightlyFile);\r
+                    }\r
+                }\r
+                else\r
+                {\r
+                    if (File.Exists(legacyReleaseFile))\r
+                    {\r
+                        using (StreamReader reader = new StreamReader(legacyReleaseFile))\r
+                        {\r
+                            XmlSerializer serializer =\r
+                                new XmlSerializer(typeof(SerializableDictionary<string, object>));\r
+                            oldAppSettings = (SerializableDictionary<string, object>)serializer.Deserialize(reader);\r
+                        }\r
+\r
+                        File.Delete(legacyReleaseFile);\r
+                    }\r
+                }\r
+            }\r
+            catch (Exception exc)\r
+            {\r
+                Debug.WriteLine(exc);\r
             }\r
 \r
-            return new Collections.SerializableDictionary<string, object>();\r
+            return oldAppSettings;\r
         }\r
     }\r
-}\r
+}
\ No newline at end of file
index cf87b6cecf1b98bb8fb3338300162f697fcd1813..30d3d7557f2663b327e1d2fa87397bdf0f986979 100644 (file)
@@ -26,7 +26,6 @@ namespace HandBrakeWPF
         public const string DefaultPlayer = "defaultPlayer";\r
         public const string LastUpdateCheckDate = "lastUpdateCheckDate";\r
         public const string MainWindowMinimize = "MainWindowMinimize";\r
-        public const string MinTitleLength = "MinTitleLength";\r
         public const string UpdateStatus = "updateStatus";\r
         public const string UseM4v = "useM4v";\r
         public const string VLCPath = "VLC_Path";\r
index 3ad88a97e6f2757386240b101dbeaee515049e27..736d67e69bb87be7ecf8b056df14d7e4b7f3e676 100644 (file)
@@ -1325,7 +1325,7 @@ namespace HandBrakeWPF.ViewModels
             this.checkForUpdatesFrequencies.Add("Weekly");\r
             this.checkForUpdatesFrequencies.Add("Monthly");\r
 \r
-            this.CheckForUpdatesFrequency = this.userSettingService.GetUserSetting<int>(UserSettingConstants.DaysBetweenUpdateCheck);\r
+            this.CheckForUpdatesFrequency = this.userSettingService.GetUserSetting<int>(UserSettingConstants.DaysBetweenUpdateCheck, typeof(int));\r
             if (this.CheckForUpdatesFrequency > 1)\r
             {\r
                 this.CheckForUpdatesFrequency = 1;\r
@@ -1380,7 +1380,7 @@ namespace HandBrakeWPF.ViewModels
             this.mp4ExtensionOptions.Add("Automatic");\r
             this.mp4ExtensionOptions.Add("Always use MP4");\r
             this.mp4ExtensionOptions.Add("Always use M4V");\r
-            this.SelectedMp4Extension = this.userSettingService.GetUserSetting<int>(UserSettingConstants.UseM4v);\r
+            this.SelectedMp4Extension = this.userSettingService.GetUserSetting<int>(UserSettingConstants.UseM4v, typeof(int));\r
 \r
             // Remove Underscores\r
             this.RemoveUnderscores = this.userSettingService.GetUserSetting<bool>(UserSettingConstants.AutoNameRemoveUnderscore);\r
@@ -1400,7 +1400,7 @@ namespace HandBrakeWPF.ViewModels
             // Video\r
             // #############################\r
             this.EnableQuickSyncDecoding = this.userSettingService.GetUserSetting<bool>(UserSettingConstants.EnableQuickSyncDecoding);\r
-            this.SelectedScalingMode = this.userSettingService.GetUserSetting<VideoScaler>(UserSettingConstants.ScalingMode);\r
+            this.SelectedScalingMode = this.userSettingService.GetUserSetting<VideoScaler>(UserSettingConstants.ScalingMode, typeof(int));\r
             this.UseQSVDecodeForNonQSVEnc = this.userSettingService.GetUserSetting<bool>(UserSettingConstants.UseQSVDecodeForNonQSVEnc);\r
 \r
             this.EnableQuickSyncEncoding = this.userSettingService.GetUserSetting<bool>(UserSettingConstants.EnableQuickSyncEncoding);\r
@@ -1429,7 +1429,7 @@ namespace HandBrakeWPF.ViewModels
             this.logVerbosityOptions.Add(0);\r
             this.logVerbosityOptions.Add(1);\r
             this.logVerbosityOptions.Add(2);\r
-            this.SelectedVerbosity = userSettingService.GetUserSetting<int>(UserSettingConstants.Verbosity);\r
+            this.SelectedVerbosity = userSettingService.GetUserSetting<int>(UserSettingConstants.Verbosity, typeof(int));\r
 \r
             // Logs\r
             this.CopyLogToEncodeDirectory = userSettingService.GetUserSetting<bool>(UserSettingConstants.SaveLogWithVideo);\r
@@ -1462,7 +1462,7 @@ namespace HandBrakeWPF.ViewModels
             this.PreviewPicturesToScan.Add(50);\r
             this.PreviewPicturesToScan.Add(55);\r
             this.PreviewPicturesToScan.Add(60);\r
-            this.SelectedPreviewCount = this.userSettingService.GetUserSetting<int>(UserSettingConstants.PreviewScanCount);\r
+            this.SelectedPreviewCount = this.userSettingService.GetUserSetting<int>(UserSettingConstants.PreviewScanCount, typeof(int));\r
 \r
             // x264 step\r
             this.ConstantQualityGranularity.Clear();\r
@@ -1472,7 +1472,7 @@ namespace HandBrakeWPF.ViewModels
             this.SelectedGranulairty = userSettingService.GetUserSetting<double>(UserSettingConstants.X264Step).ToString("0.00", CultureInfo.InvariantCulture);\r
 \r
             // Min Title Length\r
-            this.MinLength = this.userSettingService.GetUserSetting<int>(UserSettingConstants.MinScanDuration);\r
+            this.MinLength = this.userSettingService.GetUserSetting<int>(UserSettingConstants.MinScanDuration, typeof(int));\r
 \r
             // Use dvdnav\r
             this.DisableLibdvdNav = userSettingService.GetUserSetting<bool>(UserSettingConstants.DisableLibDvdNav);\r
index f3e9593be10a3ff0453b3da6073e95a0f1b6d3f4..bbb60f878a6f3feab0cf8333cd3cf1873470948c 100644 (file)
@@ -151,7 +151,7 @@ namespace HandBrakeWPF.ViewModels
             this.CanPlay = true;\r
 \r
             UseSystemDefaultPlayer = userSettingService.GetUserSetting<bool>(UserSettingConstants.DefaultPlayer);\r
-            this.Duration = userSettingService.GetUserSetting<int>(UserSettingConstants.LastPreviewDuration);\r
+            this.Duration = userSettingService.GetUserSetting<int>(UserSettingConstants.LastPreviewDuration, typeof(int));\r
         }\r
 \r
         #endregion\r
@@ -238,7 +238,7 @@ namespace HandBrakeWPF.ViewModels
         {\r
             get\r
             {\r
-                return this.userSettingService.GetUserSetting<int>(UserSettingConstants.PreviewScanCount) - 1;\r
+                return this.userSettingService.GetUserSetting<int>(UserSettingConstants.PreviewScanCount, typeof(int)) - 1;\r
             }\r
         }\r
 \r
@@ -345,7 +345,7 @@ namespace HandBrakeWPF.ViewModels
             {\r
                 List<int> startPoints = new List<int>();\r
                 for (int i = 1;\r
-                     i <= this.userSettingService.GetUserSetting<int>(UserSettingConstants.PreviewScanCount);\r
+                     i <= this.userSettingService.GetUserSetting<int>(UserSettingConstants.PreviewScanCount, typeof(int));\r
                      i++)\r
                 {\r
                     startPoints.Add(i);\r
@@ -428,7 +428,7 @@ namespace HandBrakeWPF.ViewModels
 \r
         public void NextPreview()\r
         {\r
-            int maxPreview = this.userSettingService.GetUserSetting<int>(UserSettingConstants.PreviewScanCount);\r
+            int maxPreview = this.userSettingService.GetUserSetting<int>(UserSettingConstants.PreviewScanCount, typeof(int));\r
             if ((this.SelectedPreviewImage + 1) == maxPreview)\r
             {\r
                 return;\r
index 18260ec294df3e7e41e6761d0186fa42441518ab..b3e17624543368c8af82ee5dc4979f0d040475e8 100644 (file)
@@ -368,7 +368,7 @@ namespace HandBrakeWPF.ViewModels
 
         public void NextPreview()
         {
-            int maxPreview = this.userSettingService.GetUserSetting<int>(UserSettingConstants.PreviewScanCount);
+            int maxPreview = this.userSettingService.GetUserSetting<int>(UserSettingConstants.PreviewScanCount, typeof(int));
             if (this.selectedPreview == maxPreview)
             {
                 return;
@@ -384,7 +384,7 @@ namespace HandBrakeWPF.ViewModels
 
         public void PreviousPreview()
         {
-            int maxPreview = this.userSettingService.GetUserSetting<int>(UserSettingConstants.PreviewScanCount);
+            int maxPreview = this.userSettingService.GetUserSetting<int>(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<int>(UserSettingConstants.PreviewScanCount))
+            if (this.selectedPreview < this.userSettingService.GetUserSetting<int>(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<int>(UserSettingConstants.UseM4v))
+                switch (this.userSettingService.GetUserSetting<int>(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<int>(UserSettingConstants.PreviewScanCount));
+            this.PreviewInfo = string.Format(ResourcesUI.SummaryView_PreviewInfo, this.selectedPreview, this.userSettingService.GetUserSetting<int>(UserSettingConstants.PreviewScanCount, typeof(int)));
             this.NotifyOfPropertyChange(() => this.PreviewInfo);
 
             this.ShowPreview = this.userSettingService.GetUserSetting<bool>(UserSettingConstants.ShowPreviewOnSummaryTab);
index d9f47ac912f686ee32587bf3c802e8f2bcd404eb..f0c4310630ceb68d622365ab9e9499b9337014c3 100644 (file)
       <anyType xmlns:q1="http://www.w3.org/2001/XMLSchema" d4p1:type="q1:string" xmlns:d4p1="http://www.w3.org/2001/XMLSchema-instance" />\r
     </value>\r
   </item>\r
-  <item>\r
-    <key>\r
-      <string>skipversion</string>\r
-    </key>\r
-    <value>\r
-      <anyType xmlns:q1="http://www.w3.org/2001/XMLSchema" d4p1:type="q1:int" xmlns:d4p1="http://www.w3.org/2001/XMLSchema-instance">0</anyType>\r
-    </value>\r
-  </item>\r
   <item>\r
     <key>\r
       <string>autoNaming</string>\r
       <anyType xmlns:q1="http://www.w3.org/2001/XMLSchema" d4p1:type="q1:string" xmlns:d4p1="http://www.w3.org/2001/XMLSchema-instance">(Any)</anyType>\r
     </value>\r
   </item>\r
-  <item>\r
-    <key>\r
-      <string>DubMode</string>\r
-    </key>\r
-    <value>\r
-      <anyType xmlns:q1="http://www.w3.org/2001/XMLSchema" d4p1:type="q1:int" xmlns:d4p1="http://www.w3.org/2001/XMLSchema-instance">255</anyType>\r
-    </value>\r
-  </item>\r
   <item>\r
     <key>\r
       <string>previewScanCount</string>\r
       <anyType xmlns:q1="http://www.w3.org/2001/XMLSchema" d4p1:type="q1:boolean" xmlns:d4p1="http://www.w3.org/2001/XMLSchema-instance">true</anyType>\r
     </value>\r
   </item>\r
-  <item>\r
-    <key>\r
-      <string>ActivityWindowLastMode</string>\r
-    </key>\r
-    <value>\r
-      <anyType xmlns:q1="http://www.w3.org/2001/XMLSchema" d4p1:type="q1:int" xmlns:d4p1="http://www.w3.org/2001/XMLSchema-instance">0</anyType>\r
-    </value>\r
-  </item>\r
   <item>\r
     <key>\r
       <string>useClosedCaption</string>\r
       <ArrayOfString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" />\r
     </value>\r
   </item>\r
-  <item>\r
-    <key>\r
-      <string>DubModeAudio</string>\r
-    </key>\r
-    <value>\r
-      <anyType xmlns:q1="http://www.w3.org/2001/XMLSchema" d4p1:type="q1:int" xmlns:d4p1="http://www.w3.org/2001/XMLSchema-instance">0</anyType>\r
-    </value>\r
-  </item>\r
-  <item>\r
-    <key>\r
-      <string>DubModeSubtitle</string>\r
-    </key>\r
-    <value>\r
-      <anyType xmlns:q1="http://www.w3.org/2001/XMLSchema" d4p1:type="q1:int" xmlns:d4p1="http://www.w3.org/2001/XMLSchema-instance">0</anyType>\r
-    </value>\r
-  </item>\r
   <item>\r
     <key>\r
       <string>addOnlyOneAudioPerLanguage</string>\r
       <anyType xmlns:q1="http://www.w3.org/2001/XMLSchema" d4p1:type="q1:boolean" xmlns:d4p1="http://www.w3.org/2001/XMLSchema-instance">true</anyType>\r
     </value>\r
   </item>\r
-  <item>\r
-    <key>\r
-      <string>MinTitleLength</string>\r
-    </key>\r
-    <value>\r
-      <anyType xmlns:q1="http://www.w3.org/2001/XMLSchema" d4p1:type="q1:int" xmlns:d4p1="http://www.w3.org/2001/XMLSchema-instance">10</anyType>\r
-    </value>\r
-  </item>\r
   <item>\r
     <key>\r
       <string>ShowAdvancedAudioPassthruOpts</string>\r