diff --git a/Wox.Infrastructure/Storage/UserSettings/UserSettingStorage.cs b/Wox.Infrastructure/Storage/UserSettings/UserSettingStorage.cs index 129799d49c..81de465464 100644 --- a/Wox.Infrastructure/Storage/UserSettings/UserSettingStorage.cs +++ b/Wox.Infrastructure/Storage/UserSettings/UserSettingStorage.cs @@ -67,6 +67,9 @@ namespace Wox.Infrastructure.Storage.UserSettings [JsonProperty] public double Opacity { get; set; } + [JsonProperty] + public List ProgramSuffixes { get; set; } + [JsonProperty] public OpacityMode OpacityMode { get; set; } @@ -162,6 +165,16 @@ namespace Wox.Infrastructure.Storage.UserSettings { storage.CustomizedPluginConfigs = new List(); } + if (storage.ProgramSuffixes == null || storage.ProgramSuffixes.Count == 0) + { + storage.ProgramSuffixes = new List() + { + "lnk", + "exe", + "appref-ms", + "bat" + }; + } } } diff --git a/Wox.Plugin.SystemPlugins/Program/ProgramSetting.xaml b/Wox.Plugin.SystemPlugins/Program/ProgramSetting.xaml index 938a5920c9..f2fe7fbb80 100644 --- a/Wox.Plugin.SystemPlugins/Program/ProgramSetting.xaml +++ b/Wox.Plugin.SystemPlugins/Program/ProgramSetting.xaml @@ -16,9 +16,10 @@ - - - + + + + diff --git a/Wox.Plugin.SystemPlugins/Program/ProgramSetting.xaml.cs b/Wox.Plugin.SystemPlugins/Program/ProgramSetting.xaml.cs index 07c25f1860..dded9ae5d2 100644 --- a/Wox.Plugin.SystemPlugins/Program/ProgramSetting.xaml.cs +++ b/Wox.Plugin.SystemPlugins/Program/ProgramSetting.xaml.cs @@ -95,5 +95,12 @@ namespace Wox.Plugin.SystemPlugins.Program { ReIndexing(); } + + private void BtnProgramSuffixes_OnClick(object sender, RoutedEventArgs e) + { + + ProgramSuffixes p = new ProgramSuffixes(); + p.ShowDialog(); + } } } \ No newline at end of file diff --git a/Wox.Plugin.SystemPlugins/Program/ProgramSources/FileSystemProgramSource.cs b/Wox.Plugin.SystemPlugins/Program/ProgramSources/FileSystemProgramSource.cs index c913143607..3650f1a61c 100644 --- a/Wox.Plugin.SystemPlugins/Program/ProgramSources/FileSystemProgramSource.cs +++ b/Wox.Plugin.SystemPlugins/Program/ProgramSources/FileSystemProgramSource.cs @@ -8,19 +8,12 @@ namespace Wox.Plugin.SystemPlugins.Program.ProgramSources public class FileSystemProgramSource : AbstractProgramSource { public string BaseDirectory; - public List Suffixes = new List() { "lnk", "exe", "appref-ms" }; public FileSystemProgramSource(string baseDirectory) { BaseDirectory = baseDirectory; } - public FileSystemProgramSource(string baseDirectory, List suffixes) - : this(baseDirectory) - { - Suffixes = suffixes; - } - public FileSystemProgramSource(ProgramSource source) : this(source.Location) { @@ -41,7 +34,7 @@ namespace Wox.Plugin.SystemPlugins.Program.ProgramSources { foreach (string file in Directory.GetFiles(path)) { - if (Suffixes.Any(o => file.EndsWith("." + o))) + if (UserSettingStorage.Instance.ProgramSuffixes.Any(o => file.EndsWith("." + o))) { Program p = CreateEntry(file); list.Add(p); diff --git a/Wox.Plugin.SystemPlugins/Program/ProgramSuffixes.xaml b/Wox.Plugin.SystemPlugins/Program/ProgramSuffixes.xaml new file mode 100644 index 0000000000..9b2a8927cc --- /dev/null +++ b/Wox.Plugin.SystemPlugins/Program/ProgramSuffixes.xaml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + +