diff --git a/Plugins/Flow.Launcher.Plugin.Program/Main.cs b/Plugins/Flow.Launcher.Plugin.Program/Main.cs index c64cd74ec..9a4e8e5a3 100644 --- a/Plugins/Flow.Launcher.Plugin.Program/Main.cs +++ b/Plugins/Flow.Launcher.Plugin.Program/Main.cs @@ -191,11 +191,11 @@ namespace Flow.Launcher.Plugin.Program return; if (_uwps.Any(x => x.UniqueIdentifier == programToDelete.UniqueIdentifier)) - _uwps.FirstOrDefault(x => x.UniqueIdentifier == programToDelete.UniqueIdentifier) + _uwps.First(x => x.UniqueIdentifier == programToDelete.UniqueIdentifier) .Enabled = false; if (_win32s.Any(x => x.UniqueIdentifier == programToDelete.UniqueIdentifier)) - _win32s.FirstOrDefault(x => x.UniqueIdentifier == programToDelete.UniqueIdentifier) + _win32s.First(x => x.UniqueIdentifier == programToDelete.UniqueIdentifier) .Enabled = false; _settings.DisabledProgramSources.Add(new DisabledProgramSource(programToDelete)); diff --git a/Plugins/Flow.Launcher.Plugin.Program/Views/Models/ProgramSource.cs b/Plugins/Flow.Launcher.Plugin.Program/Views/Models/ProgramSource.cs index a2cdb44f1..45b706a9b 100644 --- a/Plugins/Flow.Launcher.Plugin.Program/Views/Models/ProgramSource.cs +++ b/Plugins/Flow.Launcher.Plugin.Program/Views/Models/ProgramSource.cs @@ -19,12 +19,12 @@ namespace Flow.Launcher.Plugin.Program.Views.Models public string Location { get; set; } public string Name { get => name ?? new DirectoryInfo(Location).Name; set => name = value; } public bool Enabled { get; set; } = true; - private string uid { get; set; } /// - /// Guranteed lowercase. + /// Guaranteed lowercase. /// public string UniqueIdentifier { get => uid; set => uid = value.ToLowerInvariant(); } + private string uid { get; set; } public ProgramSource() { } // only for json deserialization @@ -74,6 +74,8 @@ namespace Flow.Launcher.Plugin.Program.Views.Models public class DisabledProgramSource : ProgramSource { + public new bool Enabled { get; init; } + public DisabledProgramSource() { } // only for json deserialization public DisabledProgramSource(string location) : base(location, false) { } diff --git a/Plugins/Flow.Launcher.Plugin.Program/Views/ProgramSetting.xaml.cs b/Plugins/Flow.Launcher.Plugin.Program/Views/ProgramSetting.xaml.cs index 364977b71..a1c85087c 100644 --- a/Plugins/Flow.Launcher.Plugin.Program/Views/ProgramSetting.xaml.cs +++ b/Plugins/Flow.Launcher.Plugin.Program/Views/ProgramSetting.xaml.cs @@ -199,7 +199,8 @@ namespace Flow.Launcher.Plugin.Program.Views { foreach (string directory in directories) { - if (Directory.Exists(directory) && !ProgramSettingDisplayList.Any(x => x.UniqueIdentifier == directory.ToLowerInvariant())) + if (Directory.Exists(directory) + && !ProgramSettingDisplayList.Any(x => x.UniqueIdentifier.Equals(directory, System.StringComparison.InvariantCultureIgnoreCase))) { var source = new ProgramSource(directory);