From 1415f74fe5dead03330d91c36e8e301cf373eacf Mon Sep 17 00:00:00 2001 From: bao-qian Date: Sat, 20 Aug 2016 19:19:33 +0100 Subject: [PATCH] Check AppListEntry #198 --- Plugins/Wox.Plugin.Program/Programs/UWP.cs | 28 ++++++++++------------ 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/Plugins/Wox.Plugin.Program/Programs/UWP.cs b/Plugins/Wox.Plugin.Program/Programs/UWP.cs index 78419a95da..3a648f1cd3 100644 --- a/Plugins/Wox.Plugin.Program/Programs/UWP.cs +++ b/Plugins/Wox.Plugin.Program/Programs/UWP.cs @@ -77,12 +77,15 @@ namespace Wox.Plugin.Program.Programs while (apps.GetHasCurrent() != 0 && i <= Apps.Length) { var currentApp = apps.GetCurrent(); - Apps[i].UserModelId = currentApp.GetAppUserModelId(); - Apps[i].Executable = currentApp.GetStringValue("Executable"); - Apps[i].BackgroundColor = currentApp.GetStringValue("BackgroundColor"); - Apps[i].LogoPath = Path.Combine(Location, currentApp.GetStringValue("Square44x44Logo")); - Apps[i].Location = Location; - + var appListEntry = currentApp.GetStringValue("AppListEntry"); + if (appListEntry != "nonoe") + { + Apps[i].UserModelId = currentApp.GetAppUserModelId(); + Apps[i].Executable = currentApp.GetStringValue("Executable") ?? string.Empty; + Apps[i].BackgroundColor = currentApp.GetStringValue("BackgroundColor") ?? string.Empty; + Apps[i].LogoPath = Path.Combine(Location, currentApp.GetStringValue("Square44x44Logo")); + Apps[i].Location = Location; + } apps.MoveNext(); i++; } @@ -107,7 +110,6 @@ namespace Wox.Plugin.Program.Programs Console.WriteLine(message); return; } - Apps = apps.Select(a => new Application { DisplayName = a.DisplayInfo.DisplayName, @@ -148,21 +150,14 @@ namespace Wox.Plugin.Program.Programs private static IEnumerable CurrentUserPackages() { - var user = WindowsIdentity.GetCurrent()?.User; + var user = WindowsIdentity.GetCurrent().User; if (user != null) { var userSecurityId = user.Value; var packageManager = new PackageManager(); var packages = packageManager.FindPackagesForUser(userSecurityId); - // cw5n1h2txyewy is PublisherID for unnormal package - // e.g. ShellExperienceHost - // but WindowsFeedBack is flitered - // tested with windows 10 1511 - const string filteredPublisherID = "cw5n1h2txyewy"; - packages = packages.Where( - p => !p.IsFramework && p.Id.PublisherId != filteredPublisherID - ); + packages = packages.Where(p => !p.IsFramework && !string.IsNullOrEmpty(p.InstalledLocation.Path)); return packages; } else @@ -205,6 +200,7 @@ namespace Wox.Plugin.Program.Programs public string PublisherDisplayName { get; set; } public string BackgroundColor { get; set; } public string LogoPath { get; set; } + public string AppListEntry { get; set; } public int Score { get; set; } public string Location { get; set; }