Enable user selected program loading only

Update logic, add program source only loading
This commit is contained in:
Jeremy Wu
2019-09-05 08:05:17 +10:00
parent dedac39d99
commit f51c391e84
4 changed files with 105 additions and 33 deletions

View File

@@ -202,6 +202,20 @@ namespace Wox.Plugin.Program.Programs
}
}
public static Application[] RetainApplications(Application[] applications, List<Settings.ProgramSource> applicationsToRetainPaths, bool enableProgramSourceOnly)
{
if(enableProgramSourceOnly)
return applications
.Where(t1 => applicationsToRetainPaths
.Any(x => x.LocationFile == t1.Package.Location
&& x.EnableIndexing))
.Select(t1 => t1).ToArray();
// Do not return if the application is disabled for indexing
return applications.Where(t1 => !applicationsToRetainPaths.Any(x => x.LocationFile == t1.Package.Location && !x.EnableIndexing))
.Select(t1 => t1).ToArray();
}
public override string ToString()
{
return FamilyName;