From 29eb7166e6577974d786edbe868afbb346d2e2d2 Mon Sep 17 00:00:00 2001 From: sr55 Date: Thu, 3 Jan 2019 19:38:46 +0000 Subject: [PATCH] WinGui: Remove support for loading legacy settings files AND add VideoScaler to the reset legacy settings list to avoid crash issues. Fixes #1782 --- .../Services/UserSettingService.cs | 55 +------------------ 1 file changed, 2 insertions(+), 53 deletions(-) diff --git a/win/CS/HandBrakeWPF/Services/UserSettingService.cs b/win/CS/HandBrakeWPF/Services/UserSettingService.cs index e4ac3c7d6..3c71854a3 100644 --- a/win/CS/HandBrakeWPF/Services/UserSettingService.cs +++ b/win/CS/HandBrakeWPF/Services/UserSettingService.cs @@ -12,12 +12,12 @@ 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; using System.Xml.Serialization; + using HandBrake.Interop.Model; using HandBrake.Interop.Utilities; using HandBrakeWPF.Collections; @@ -198,11 +198,6 @@ namespace HandBrakeWPF.Services this.userSettings = deserialisedSettings; } } - else - { - Dictionary deserialisedSettings = this.GetLegacySettings(); // Check for Legacy files - this.userSettings = deserialisedSettings ?? new SerializableDictionary(); - } // Add any missing / new settings SerializableDictionary defaults = this.GetDefaults(); @@ -214,6 +209,7 @@ namespace HandBrakeWPF.Services // Legacy Settings forced Reset. this.userSettings[UserSettingConstants.ShowAdvancedTab] = false; + this.userSettings[UserSettingConstants.ScalingMode] = VideoScaler.Lanczos; } catch (Exception exc) { @@ -262,52 +258,5 @@ namespace HandBrakeWPF.Services 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 oldAppSettings; - } } } \ No newline at end of file -- 2.40.0