From 4da7a5e078d783a832b54925ce934851d514933a Mon Sep 17 00:00:00 2001 From: Vic <10308169+VictoriousRaptor@users.noreply.github.com> Date: Thu, 20 Oct 2022 16:55:14 +0800 Subject: [PATCH] Remove DisabledProgramSource() --- Plugins/Flow.Launcher.Plugin.Program/Main.cs | 11 +---------- .../Views/Commands/ProgramSettingDisplay.cs | 10 +--------- .../Views/Models/ProgramSource.cs | 12 +----------- 3 files changed, 3 insertions(+), 30 deletions(-) diff --git a/Plugins/Flow.Launcher.Plugin.Program/Main.cs b/Plugins/Flow.Launcher.Plugin.Program/Main.cs index 1dcaa01ae..a1916f58a 100644 --- a/Plugins/Flow.Launcher.Plugin.Program/Main.cs +++ b/Plugins/Flow.Launcher.Plugin.Program/Main.cs @@ -204,16 +204,7 @@ namespace Flow.Launcher.Plugin.Program _win32s.FirstOrDefault(x => x.UniqueIdentifier == programToDelete.UniqueIdentifier) .Enabled = false; - _settings.DisabledProgramSources - .Add( - new DisabledProgramSource - { - Name = programToDelete.Name, - Location = programToDelete.Location, - UniqueIdentifier = programToDelete.UniqueIdentifier, - Enabled = false - } - ); + _settings.DisabledProgramSources.Add(new DisabledProgramSource(programToDelete)); } public static void StartProcess(Func runProcess, ProcessStartInfo info) diff --git a/Plugins/Flow.Launcher.Plugin.Program/Views/Commands/ProgramSettingDisplay.cs b/Plugins/Flow.Launcher.Plugin.Program/Views/Commands/ProgramSettingDisplay.cs index c261065f6..5e2a288f7 100644 --- a/Plugins/Flow.Launcher.Plugin.Program/Views/Commands/ProgramSettingDisplay.cs +++ b/Plugins/Flow.Launcher.Plugin.Program/Views/Commands/ProgramSettingDisplay.cs @@ -107,15 +107,7 @@ namespace Flow.Launcher.Plugin.Program.Views.Commands && !Main._settings.DisabledProgramSources.Any(x => x.UniqueIdentifier == t1.UniqueIdentifier)) .ToList() .ForEach(x => Main._settings.DisabledProgramSources - .Add( - new DisabledProgramSource - { - Name = x.Name, - Location = x.Location, - UniqueIdentifier = x.UniqueIdentifier, - Enabled = false - } - )); + .Add(new DisabledProgramSource(x))); } internal static void RemoveDisabledFromSettings(this List list) diff --git a/Plugins/Flow.Launcher.Plugin.Program/Views/Models/ProgramSource.cs b/Plugins/Flow.Launcher.Plugin.Program/Views/Models/ProgramSource.cs index 5f4ec90f7..f562d992b 100644 --- a/Plugins/Flow.Launcher.Plugin.Program/Views/Models/ProgramSource.cs +++ b/Plugins/Flow.Launcher.Plugin.Program/Views/Models/ProgramSource.cs @@ -68,16 +68,6 @@ namespace Flow.Launcher.Plugin.Program.Views.Models return program != null && program.UniqueIdentifier == this.UniqueIdentifier; } - public static bool operator ==(ProgramSource a, ProgramSource b) - { - return a is not null && a.Equals(b); - } - - public static bool operator !=(ProgramSource a, ProgramSource b) - { - return !(a == b); - } - public override int GetHashCode() { return HashCode.Combine(uid); @@ -86,7 +76,7 @@ namespace Flow.Launcher.Plugin.Program.Views.Models public class DisabledProgramSource : ProgramSource { - public DisabledProgramSource() { } + //public DisabledProgramSource() { } public DisabledProgramSource(string location) : base(location, false) { }