summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
authorsr55 <[email protected]>2018-07-18 22:28:13 +0100
committersr55 <[email protected]>2018-07-18 22:28:27 +0100
commit3e41c7995374e71e9d61b0dce4ac59066a261599 (patch)
treec7e643e1e5df2ab9d3bb78740c4f6ad740efba31 /win
parent45f24decdf2bb41c8eac24ead218d05fbd92955a (diff)
WinGui: Move UserSettings over to JSON format. Settings from the older XML format will automatically transfer and the legacy files will be removed.
Diffstat (limited to 'win')
-rw-r--r--win/CS/HandBrakeWPF/Factories/HBConfigurationFactory.cs10
-rw-r--r--win/CS/HandBrakeWPF/HandBrakeWPF.csproj.DotSettings2
-rw-r--r--win/CS/HandBrakeWPF/Helpers/AutoNameHelper.cs2
-rw-r--r--win/CS/HandBrakeWPF/Services/Interfaces/IUserSettingService.cs7
-rw-r--r--win/CS/HandBrakeWPF/Services/Presets/PresetService.cs2
-rw-r--r--win/CS/HandBrakeWPF/Services/UpdateService.cs2
-rw-r--r--win/CS/HandBrakeWPF/Services/UserSettingService.cs147
-rw-r--r--win/CS/HandBrakeWPF/UserSettingConstants.cs1
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs12
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/StaticPreviewViewModel.cs8
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/SummaryViewModel.cs10
-rw-r--r--win/CS/HandBrakeWPF/defaultsettings.xml48
12 files changed, 143 insertions, 108 deletions
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<bool>(UserSettingConstants.DisableLibDvdNav),
EnableQuickSyncDecoding = UserSettingService.GetUserSetting<bool>(UserSettingConstants.EnableQuickSyncDecoding),
UseQSVDecodeForNonQSVEnc = UserSettingService.GetUserSetting<bool>(UserSettingConstants.UseQSVDecodeForNonQSVEnc),
- ScalingMode = UserSettingService.GetUserSetting<VideoScaler>(UserSettingConstants.ScalingMode),
- PreviewScanCount = UserSettingService.GetUserSetting<int>(UserSettingConstants.PreviewScanCount),
- Verbosity = UserSettingService.GetUserSetting<int>(UserSettingConstants.Verbosity),
- MinScanDuration = UserSettingService.GetUserSetting<int>(UserSettingConstants.MinScanDuration),
+ ScalingMode = UserSettingService.GetUserSetting<VideoScaler>(UserSettingConstants.ScalingMode, typeof(int)),
+ PreviewScanCount = UserSettingService.GetUserSetting<int>(UserSettingConstants.PreviewScanCount, typeof(int)),
+ Verbosity = UserSettingService.GetUserSetting<int>(UserSettingConstants.Verbosity, typeof(int)),
+ MinScanDuration = UserSettingService.GetUserSetting<int>(UserSettingConstants.MinScanDuration, typeof(int)),
SaveLogToCopyDirectory = UserSettingService.GetUserSetting<bool>(UserSettingConstants.SaveLogToCopyDirectory),
SaveLogWithVideo = UserSettingService.GetUserSetting<bool>(UserSettingConstants.SaveLogWithVideo),
SaveLogCopyDirectory = UserSettingService.GetUserSetting<string>(UserSettingConstants.SaveLogCopyDirectory),
RemoteServiceEnabled = UserSettingService.GetUserSetting<bool>(UserSettingConstants.RemoteServiceEnabled),
- RemoteServicePort = UserSettingService.GetUserSetting<int>(UserSettingConstants.RemoteServicePort)
+ RemoteServicePort = UserSettingService.GetUserSetting<int>(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 @@
+<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
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<int>(UserSettingConstants.UseM4v))
+ switch (userSettingService.GetUserSetting<int>(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;
/// <summary>
@@ -49,12 +51,15 @@ namespace HandBrakeWPF.Services.Interfaces
/// <param name="name">
/// The name.
/// </param>
+ /// <param name="convertType">
+ /// The convert Type.
+ /// </param>
/// <typeparam name="T">
/// The Type of the setting
/// </typeparam>
/// <returns>
/// The user setting
/// </returns>
- T GetUserSetting<T>(string name);
+ T GetUserSetting<T>(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<int>(UserSettingConstants.ForcePresetReset) < ForcePresetReset)
+ if (this.userSettingService.GetUserSetting<int>(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<bool>(UserSettingConstants.UpdateStatus))
{
DateTime lastUpdateCheck = this.userSettingService.GetUserSetting<DateTime>(UserSettingConstants.LastUpdateCheckDate);
- int checkFrequency = this.userSettingService.GetUserSetting<int>(UserSettingConstants.DaysBetweenUpdateCheck) == 0 ? 7 : 30;
+ int checkFrequency = this.userSettingService.GetUserSetting<int>(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;
/// <summary>
/// The User Setting Service
/// </summary>
public class UserSettingService : IUserSettingService
{
- /// <summary>
- /// The Settings File
- /// </summary>
- private readonly string settingsFile = Path.Combine(DirectoryUtilities.GetUserStoragePath(VersionHelper.IsNightly()), "settings.xml");
-
- /// <summary>
- /// The XML Serializer
- /// </summary>
- private readonly XmlSerializer serializer = new XmlSerializer(typeof(Collections.SerializableDictionary<string, object>));
-
- /// <summary>
- /// The User Settings
- /// </summary>
- private Collections.SerializableDictionary<string, object> 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<string, object> userSettings;
/// <summary>
/// Initializes a new instance of the <see cref="UserSettingService"/> class.
@@ -80,17 +79,41 @@ namespace HandBrakeWPF.Services
/// <param name="name">
/// The name.
/// </param>
+ /// <param name="conversionType">
+ /// The conversion Type.
+ /// </param>
/// <typeparam name="T">
/// The Type of the setting
/// </typeparam>
/// <returns>
/// The user setting
/// </returns>
- public T GetUserSetting<T>(string name)
+ public T GetUserSetting<T>(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<string[]>();
+ 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<string, object> data = (Collections.SerializableDictionary<string, object>)this.serializer.Deserialize(reader);
- this.userSettings = data;
+ string appSettings = reader.ReadToEnd();
+ Dictionary<string, object> deserialisedSettings = JsonConvert.DeserializeObject< Dictionary<string, object>>(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<string, object> data = (Collections.SerializableDictionary<string, object>)this.serializer.Deserialize(reader);
- this.userSettings = data;
+ string appSettings = reader.ReadToEnd();
+ Dictionary<string, object> deserialisedSettings = JsonConvert.DeserializeObject<Dictionary<string, object>>(appSettings);
+ this.userSettings = deserialisedSettings;
}
}
else
{
- this.userSettings = new Collections.SerializableDictionary<string, object>();
+ Dictionary<string, object> deserialisedSettings = this.GetLegacySettings(); // Check for Legacy files
+ this.userSettings = deserialisedSettings ?? new SerializableDictionary<string, object>();
}
// Add any missing / new settings
- Collections.SerializableDictionary<string, object> defaults = this.GetDefaults();
+ SerializableDictionary<string, object> 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
/// <returns>
/// The get defaults.
/// </returns>
- private Collections.SerializableDictionary<string, object> GetDefaults()
+ private SerializableDictionary<string, object> GetDefaults()
{
+ // TODO Convert this to JSON.
try
{
Assembly assembly = Assembly.GetEntryAssembly();
Stream stream = assembly.GetManifestResourceStream("HandBrakeWPF.defaultsettings.xml");
if (stream != null)
{
- return (Collections.SerializableDictionary<string, object>)this.serializer.Deserialize(stream);
+ XmlSerializer serializer = new XmlSerializer(typeof(Collections.SerializableDictionary<string, object>));
+ return (SerializableDictionary<string, object>)serializer.Deserialize(stream);
}
}
catch (Exception)
{
- return new Collections.SerializableDictionary<string, object>();
+ return new SerializableDictionary<string, object>();
+ }
+
+ return new SerializableDictionary<string, object>();
+ }
+
+ private SerializableDictionary<string, object> GetLegacySettings()
+ {
+ // TODO can be removed after 1.2 releases. Useful for 1 version to upgrade users settings to the new format.
+ SerializableDictionary<string, object> 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<string, object>));
+ oldAppSettings = (SerializableDictionary<string, object>)serializer.Deserialize(reader);
+ }
+
+ File.Delete(legacyNightlyFile);
+ }
+ }
+ else
+ {
+ if (File.Exists(legacyReleaseFile))
+ {
+ using (StreamReader reader = new StreamReader(legacyReleaseFile))
+ {
+ XmlSerializer serializer =
+ new XmlSerializer(typeof(SerializableDictionary<string, object>));
+ oldAppSettings = (SerializableDictionary<string, object>)serializer.Deserialize(reader);
+ }
+
+ File.Delete(legacyReleaseFile);
+ }
+ }
+ }
+ catch (Exception exc)
+ {
+ Debug.WriteLine(exc);
}
- return new Collections.SerializableDictionary<string, object>();
+ 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<int>(UserSettingConstants.DaysBetweenUpdateCheck);
+ this.CheckForUpdatesFrequency = this.userSettingService.GetUserSetting<int>(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<int>(UserSettingConstants.UseM4v);
+ this.SelectedMp4Extension = this.userSettingService.GetUserSetting<int>(UserSettingConstants.UseM4v, typeof(int));
// Remove Underscores
this.RemoveUnderscores = this.userSettingService.GetUserSetting<bool>(UserSettingConstants.AutoNameRemoveUnderscore);
@@ -1400,7 +1400,7 @@ namespace HandBrakeWPF.ViewModels
// Video
// #############################
this.EnableQuickSyncDecoding = this.userSettingService.GetUserSetting<bool>(UserSettingConstants.EnableQuickSyncDecoding);
- this.SelectedScalingMode = this.userSettingService.GetUserSetting<VideoScaler>(UserSettingConstants.ScalingMode);
+ this.SelectedScalingMode = this.userSettingService.GetUserSetting<VideoScaler>(UserSettingConstants.ScalingMode, typeof(int));
this.UseQSVDecodeForNonQSVEnc = this.userSettingService.GetUserSetting<bool>(UserSettingConstants.UseQSVDecodeForNonQSVEnc);
this.EnableQuickSyncEncoding = this.userSettingService.GetUserSetting<bool>(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<int>(UserSettingConstants.Verbosity);
+ this.SelectedVerbosity = userSettingService.GetUserSetting<int>(UserSettingConstants.Verbosity, typeof(int));
// Logs
this.CopyLogToEncodeDirectory = userSettingService.GetUserSetting<bool>(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<int>(UserSettingConstants.PreviewScanCount);
+ this.SelectedPreviewCount = this.userSettingService.GetUserSetting<int>(UserSettingConstants.PreviewScanCount, typeof(int));
// x264 step
this.ConstantQualityGranularity.Clear();
@@ -1472,7 +1472,7 @@ namespace HandBrakeWPF.ViewModels
this.SelectedGranulairty = userSettingService.GetUserSetting<double>(UserSettingConstants.X264Step).ToString("0.00", CultureInfo.InvariantCulture);
// Min Title Length
- this.MinLength = this.userSettingService.GetUserSetting<int>(UserSettingConstants.MinScanDuration);
+ this.MinLength = this.userSettingService.GetUserSetting<int>(UserSettingConstants.MinScanDuration, typeof(int));
// Use dvdnav
this.DisableLibdvdNav = userSettingService.GetUserSetting<bool>(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<bool>(UserSettingConstants.DefaultPlayer);
- this.Duration = userSettingService.GetUserSetting<int>(UserSettingConstants.LastPreviewDuration);
+ this.Duration = userSettingService.GetUserSetting<int>(UserSettingConstants.LastPreviewDuration, typeof(int));
}
#endregion
@@ -238,7 +238,7 @@ namespace HandBrakeWPF.ViewModels
{
get
{
- return this.userSettingService.GetUserSetting<int>(UserSettingConstants.PreviewScanCount) - 1;
+ return this.userSettingService.GetUserSetting<int>(UserSettingConstants.PreviewScanCount, typeof(int)) - 1;
}
}
@@ -345,7 +345,7 @@ namespace HandBrakeWPF.ViewModels
{
List<int> startPoints = new List<int>();
for (int i = 1;
- i <= this.userSettingService.GetUserSetting<int>(UserSettingConstants.PreviewScanCount);
+ i <= this.userSettingService.GetUserSetting<int>(UserSettingConstants.PreviewScanCount, typeof(int));
i++)
{
startPoints.Add(i);
@@ -428,7 +428,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.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<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);
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
@@ -122,14 +122,6 @@
</item>
<item>
<key>
- <string>skipversion</string>
- </key>
- <value>
- <anyType xmlns:q1="http://www.w3.org/2001/XMLSchema" d4p1:type="q1:int" xmlns:d4p1="http://www.w3.org/2001/XMLSchema-instance">0</anyType>
- </value>
- </item>
- <item>
- <key>
<string>autoNaming</string>
</key>
<value>
@@ -226,14 +218,6 @@
</item>
<item>
<key>
- <string>DubMode</string>
- </key>
- <value>
- <anyType xmlns:q1="http://www.w3.org/2001/XMLSchema" d4p1:type="q1:int" xmlns:d4p1="http://www.w3.org/2001/XMLSchema-instance">255</anyType>
- </value>
- </item>
- <item>
- <key>
<string>previewScanCount</string>
</key>
<value>
@@ -266,14 +250,6 @@
</item>
<item>
<key>
- <string>ActivityWindowLastMode</string>
- </key>
- <value>
- <anyType xmlns:q1="http://www.w3.org/2001/XMLSchema" d4p1:type="q1:int" xmlns:d4p1="http://www.w3.org/2001/XMLSchema-instance">0</anyType>
- </value>
- </item>
- <item>
- <key>
<string>useClosedCaption</string>
</key>
<value>
@@ -314,22 +290,6 @@
</item>
<item>
<key>
- <string>DubModeAudio</string>
- </key>
- <value>
- <anyType xmlns:q1="http://www.w3.org/2001/XMLSchema" d4p1:type="q1:int" xmlns:d4p1="http://www.w3.org/2001/XMLSchema-instance">0</anyType>
- </value>
- </item>
- <item>
- <key>
- <string>DubModeSubtitle</string>
- </key>
- <value>
- <anyType xmlns:q1="http://www.w3.org/2001/XMLSchema" d4p1:type="q1:int" xmlns:d4p1="http://www.w3.org/2001/XMLSchema-instance">0</anyType>
- </value>
- </item>
- <item>
- <key>
<string>addOnlyOneAudioPerLanguage</string>
</key>
<value>
@@ -338,14 +298,6 @@
</item>
<item>
<key>
- <string>MinTitleLength</string>
- </key>
- <value>
- <anyType xmlns:q1="http://www.w3.org/2001/XMLSchema" d4p1:type="q1:int" xmlns:d4p1="http://www.w3.org/2001/XMLSchema-instance">10</anyType>
- </value>
- </item>
- <item>
- <key>
<string>ShowAdvancedAudioPassthruOpts</string>
</key>
<value>