From a3a50cd4bd52d27333c4dfd8d02cf06fffc2f0db Mon Sep 17 00:00:00 2001 From: Vic <10308169+VictoriousRaptor@users.noreply.github.com> Date: Wed, 2 Nov 2022 12:17:51 +0800 Subject: [PATCH 1/2] Backward compatibilty --- .../Flow.Launcher.Plugin.Program/Settings.cs | 25 ++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/Plugins/Flow.Launcher.Plugin.Program/Settings.cs b/Plugins/Flow.Launcher.Plugin.Program/Settings.cs index 8044e8065a1..96328ba62eb 100644 --- a/Plugins/Flow.Launcher.Plugin.Program/Settings.cs +++ b/Plugins/Flow.Launcher.Plugin.Program/Settings.cs @@ -3,6 +3,7 @@ using System.IO; using System.Linq; using System.Text.Json.Serialization; +using Windows.Foundation.Metadata; namespace Flow.Launcher.Plugin.Program { @@ -11,7 +12,10 @@ public class Settings public DateTime LastIndexTime { get; set; } public List ProgramSources { get; set; } = new List(); public List DisabledProgramSources { get; set; } = new List(); - public string[] CustomSuffixes { get; set; } = Array.Empty(); + + [Obsolete, JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public string[] ProgramSuffixes { get; set; } = null; + public string[] CustomSuffixes { get; set; } = Array.Empty(); // Custom suffixes only public string[] CustomProtocols { get; set; } = Array.Empty(); public Dictionary BuiltinSuffixesStatus { get; set; } = new Dictionary{ @@ -32,6 +36,7 @@ public class Settings public string[] GetSuffixes() { + RemoveRedundantSuffixes(); List extensions = new List(); foreach (var item in BuiltinSuffixesStatus) { @@ -84,6 +89,24 @@ public string[] GetProtocols() } } + private void RemoveRedundantSuffixes() + { + // Migrate to new settings + // CustomSuffixes no longer contains custom suffixes + // users has tweaked the settings + // or this function has been executed once + if (UseCustomSuffixes == true || ProgramSuffixes == null) + return; + var suffixes = ProgramSuffixes.ToList(); + foreach(var item in BuiltinSuffixesStatus) + { + suffixes.Remove(item.Key); + } + CustomSuffixes = suffixes.ToArray(); // Custom suffixes + UseCustomSuffixes = CustomSuffixes.Length != 0; // Search custom suffixes or not + ProgramSuffixes = null; + } + public bool EnableStartMenuSource { get; set; } = true; public bool EnableDescription { get; set; } = false; public bool HideAppsPath { get; set; } = true; From 51f5b428eb3ed8bf64b412dab7c1175dee1d8953 Mon Sep 17 00:00:00 2001 From: Vic <10308169+VictoriousRaptor@users.noreply.github.com> Date: Wed, 2 Nov 2022 13:17:42 +0800 Subject: [PATCH 2/2] Text update --- Plugins/Flow.Launcher.Plugin.Program/Languages/en.xaml | 3 +++ Plugins/Flow.Launcher.Plugin.Program/ProgramSuffixes.xaml | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Plugins/Flow.Launcher.Plugin.Program/Languages/en.xaml b/Plugins/Flow.Launcher.Plugin.Program/Languages/en.xaml index 91e0fda1142..3132db36bf4 100644 --- a/Plugins/Flow.Launcher.Plugin.Program/Languages/en.xaml +++ b/Plugins/Flow.Launcher.Plugin.Program/Languages/en.xaml @@ -43,6 +43,9 @@ File Suffixes URL Protocols + Steam Games + Epic Games + Http/Https Custom URL Protocols Custom File Suffixes diff --git a/Plugins/Flow.Launcher.Plugin.Program/ProgramSuffixes.xaml b/Plugins/Flow.Launcher.Plugin.Program/ProgramSuffixes.xaml index b09a998ce33..f0375d126e0 100644 --- a/Plugins/Flow.Launcher.Plugin.Program/ProgramSuffixes.xaml +++ b/Plugins/Flow.Launcher.Plugin.Program/ProgramSuffixes.xaml @@ -193,9 +193,9 @@ FontSize="16" FontWeight="SemiBold" Text="{DynamicResource flowlauncher_plugin_program_suffixes_URL_types}" /> - Steam Games - Epic Games - Http/Https + + +