diff options
author | sr55 <[email protected]> | 2014-01-21 20:27:57 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2014-01-21 20:27:57 +0000 |
commit | 1c5cdd2e5767b3b25df9da740034e1f05a43d271 (patch) | |
tree | d6230a366fdb4785faa69974efa3e3a6afb5b713 /win/CS/HandBrakeWPF/ViewModels | |
parent | 675678a7157fac5c8ad6a69edd21fbf33d263c08 (diff) |
WinGui: Make the Preset Plist importer a bit more robust by checking versions and automatically falling back to a value for invalid key/value pairs from old versions.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5988 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/CS/HandBrakeWPF/ViewModels')
-rw-r--r-- | win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs index 0499e7157..a531b549c 100644 --- a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs @@ -1539,6 +1539,33 @@ namespace HandBrakeWPF.ViewModels if (!string.IsNullOrEmpty(filename))
{
PList plist = new PList(filename);
+
+ object build;
+ plist.TryGetValue("PresetBuildNumber", out build);
+
+ string buildNumber = build as string;
+ if (buildNumber == null)
+ {
+ MessageBox.Show(
+ Resources.Preset_UnableToImport_Message,
+ Resources.Preset_UnableToImport_Header,
+ MessageBoxButton.YesNo, MessageBoxImage.Question);
+ return;
+ }
+
+ if (buildNumber != userSettingService.GetUserSetting<int>(UserSettingConstants.HandBrakeBuild).ToString(CultureInfo.InvariantCulture))
+ {
+ MessageBoxResult result = MessageBox.Show(
+ Resources.Preset_OldVersion_Message,
+ Resources.Preset_OldVersion_Header,
+ MessageBoxButton.YesNo, MessageBoxImage.Question);
+
+ if (result == MessageBoxResult.No)
+ {
+ return;
+ }
+ }
+
Preset preset = PlistPresetFactory.CreatePreset(plist);
if (this.presetService.CheckIfPresetExists(preset.Name))
|