From d661836cad8dc8badf31c0eb8f24b0105f0bff94 Mon Sep 17 00:00:00 2001 From: Vic <10308169+VictoriousRaptor@users.noreply.github.com> Date: Thu, 17 Nov 2022 14:32:29 +0800 Subject: [PATCH] re-organize linq --- .../Flow.Launcher.Plugin.Program/Programs/Win32.cs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/Plugins/Flow.Launcher.Plugin.Program/Programs/Win32.cs b/Plugins/Flow.Launcher.Plugin.Program/Programs/Win32.cs index 5352dbb71..7e597b424 100644 --- a/Plugins/Flow.Launcher.Plugin.Program/Programs/Win32.cs +++ b/Plugins/Flow.Launcher.Plugin.Program/Programs/Win32.cs @@ -379,12 +379,15 @@ namespace Flow.Launcher.Plugin.Program.Programs private static IEnumerable UnregisteredPrograms(List sources, string[] suffixes, string[] protocols) { // Disabled custom sources are not in DisabledProgramSources - var paths = ExceptDisabledSource(sources.Where(s => Directory.Exists(s.Location) && s.Enabled) + var paths = sources.Where(s => Directory.Exists(s.Location) && s.Enabled) + .Distinct() .AsParallel() - .SelectMany(s => ProgramPaths(s.Location, suffixes))) - .Distinct(); + .SelectMany(s => ProgramPaths(s.Location, suffixes)); - var programs = paths.Select(x => GetProgramFromPath(x, protocols)); + // Remove disabled programs in DisabledProgramSources + var programs = ExceptDisabledSource(paths) + + .Select(x => GetProgramFromPath(x, protocols)); return programs; } @@ -569,7 +572,7 @@ namespace Flow.Launcher.Plugin.Program.Programs programs = programs.Concat(unregistered); - var autoIndexPrograms = Enumerable.Empty(); + var autoIndexPrograms = Enumerable.Empty(); // for single programs, not folders if (settings.EnableRegistrySource) {