Skip to content

Commit 1e8cc9a

Browse files
Slightly speed up uwp index
1 parent cdde5fa commit 1e8cc9a

File tree

2 files changed

+6
-12
lines changed

2 files changed

+6
-12
lines changed

Plugins/Flow.Launcher.Plugin.Program/Programs/AppxPackageHelper.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,10 @@ namespace Flow.Launcher.Plugin.Program.Programs
77
{
88
public class AppxPackageHelper
99
{
10-
private static readonly IAppxFactory appxFactory = (IAppxFactory)new AppxFactory();
11-
1210
// This function returns a list of attributes of applications
1311
public static List<IAppxManifestApplication> GetAppsFromManifest(IStream stream)
1412
{
13+
IAppxFactory appxFactory = (IAppxFactory)new AppxFactory();
1514
List<IAppxManifestApplication> apps = new List<IAppxManifestApplication>();
1615
var reader = appxFactory.CreateManifestReader(stream);
1716
var manifestApps = reader.GetApplications();

Plugins/Flow.Launcher.Plugin.Program/Programs/UWP.cs

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,6 @@ public UWP(Package package)
4141
FullName = package.Id.FullName;
4242
FamilyName = package.Id.FamilyName;
4343
InitializeAppInfo();
44-
Apps = Apps.Where(a => !string.IsNullOrEmpty(a.UserModelId) && !string.IsNullOrEmpty(a.DisplayName))
45-
.ToArray();
4644
}
4745

4846
private void InitializeAppInfo()
@@ -58,16 +56,13 @@ private void InitializeAppInfo()
5856

5957
if (hResult == Hresult.Ok)
6058
{
61-
var apps = new List<Application>();
62-
6359
List<AppxPackageHelper.IAppxManifestApplication> _apps = AppxPackageHelper.GetAppsFromManifest(stream);
64-
foreach (var _app in _apps)
65-
{
66-
var app = new Application(_app, this);
67-
apps.Add(app);
68-
}
6960

70-
Apps = apps.Where(a => a.AppListEntry != "none").ToArray();
61+
Apps = _apps.Select(x => new Application(x, this))
62+
.Where(a => a.AppListEntry != "none"
63+
&& !string.IsNullOrEmpty(a.UserModelId)
64+
&& !string.IsNullOrEmpty(a.DisplayName))
65+
.ToArray();
7166
}
7267
else
7368
{

0 commit comments

Comments
 (0)