From 0342693442d5cce41c1ebd8537adbe9504116bbd Mon Sep 17 00:00:00 2001 From: Alekhya Reddy Date: Wed, 24 Jun 2020 21:34:33 +1000 Subject: [PATCH 1/4] Remove Program Plugin dll (AppxPackagingTlb.dll) --- .../AppxPackagingTlb.dll | Bin 17408 -> 0 bytes .../Flow.Launcher.Plugin.Program.csproj | 11 - .../Programs/AppxPackageHelper.cs | 82 ++ .../Programs/UWP.cs | 71 +- installer/PowerToysSetup/Product.wxs | 951 ++++++++++++++++++ 5 files changed, 1077 insertions(+), 38 deletions(-) delete mode 100644 Plugins/Flow.Launcher.Plugin.Program/AppxPackagingTlb.dll create mode 100644 Plugins/Flow.Launcher.Plugin.Program/Programs/AppxPackageHelper.cs create mode 100644 installer/PowerToysSetup/Product.wxs diff --git a/Plugins/Flow.Launcher.Plugin.Program/AppxPackagingTlb.dll b/Plugins/Flow.Launcher.Plugin.Program/AppxPackagingTlb.dll deleted file mode 100644 index 183cfc085c378e7b1927d3354d65d7206e15c978..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 17408 zcmeHudzf3*b?-i!8I9zzhk4k+#DvJPDW)K!$I+`Hj*recvK7w@Ni%-LMb^xmnNiS4 zgQUTpgxpLp1WJMHToOYI2@vxLA(T*{At3=b&YRGNo1}qT`dwQ3$SvV(`axUTwBi2N zI!Ak?8IO~%U;pXX%3i;-e`~M3_S)<0bI#sJqrn5mM4J$z9rD&&LOh8heReXQ85U99 z{mw6Ui^sjsZGKW2cy4oUrdadMRV&lg!mMwiP%c;MzH!S}oiF=}WuGye_03i$t?ld9 zt=a0h9x;U&P};;#qmS)v^!BoFZSGRKgt!zMx2@fA07oC>5QL)h;o!34Mv3F6qqrLa zJ$>55&g+Ee;r~lVhuS9Mr~8E%rt%@^DG|#*i$bhjuKQKEPY6$wod_kGgSFKV7h8*i6D#=$8()8K6LW8a; zulP`GF3}-Id_vrr5JDm4zvGk4zAvdbttpnP)a`-o;XpVDp920%z>{wmV$1&!;^Iw0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=3$as#c`$B zy+;fUBTS(R7b#{)5}Bu~E{6H1#-q58n9lT#o2jT~q)b@S+0-zX5@ECnrF8VIs(QR} zNraPhi6(Hz#pJi|xCs*%ToTSSJ+2!u!^u(#$&Ex!gqWawn!$uW8NwBWNuvg$1_qCJ zyPTznsvChQ=30m*u^OO!nnuVUi^MeKMKjU8llee2g_||97!G32qYg6!6FVA?o3Sv? zXi|lxSa1ITf$zrKsqEw83TXT$)UL?um8wxH4br$Z{qKHZ|ILKL?Hcf2r_hdLlUvr(Tvp(wxasLY#ZGr7j%{CXaO(Svx9%^EO67N zW3a8ldTA^{u^l!I!Efos2G~TFv^-=(GqG=VQI#1Z`6VF7(!0i1TmpM%{vJWb+A zn(>LG1A?+1Z(&M7vqEtD+amj%}Oc_=X)HlzED; zkqcs!QGs8E{pxYrIUj+~3ZkFKxav(Kw)?fm(rU9jn?4HizuITS{!RSO-}tXK@c$k! HW#InPreserveNewest - - - - .\AppxPackagingTlb.dll - True - - - .\ShObjIdlTlb.dll - True - - diff --git a/Plugins/Flow.Launcher.Plugin.Program/Programs/AppxPackageHelper.cs b/Plugins/Flow.Launcher.Plugin.Program/Programs/AppxPackageHelper.cs new file mode 100644 index 00000000000..f9605a574a3 --- /dev/null +++ b/Plugins/Flow.Launcher.Plugin.Program/Programs/AppxPackageHelper.cs @@ -0,0 +1,82 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.Runtime.InteropServices; +using System.Runtime.InteropServices.ComTypes; +using Windows.Storage; + +namespace Microsoft.Plugin.Program.Programs +{ + public class AppxPackageHelper + { + // This function returns a list of attributes of applications + public List getAppsFromManifest(IStream stream) + { + List apps = new List(); + var appxFactory = new AppxFactory(); + var reader = ((IAppxFactory)appxFactory).CreateManifestReader(stream); + var manifestApps = reader.GetApplications(); + while (manifestApps.GetHasCurrent()) + { + string appListEntry; + var manifestApp = manifestApps.GetCurrent(); + manifestApp.GetStringValue("AppListEntry", out appListEntry); + if (appListEntry != "none") + { + apps.Add(manifestApp); + } + manifestApps.MoveNext(); + } + return apps; + } + + // Reference : https://stackoverflow.com/questions/32122679/getting-icon-of-modern-windows-app-from-a-desktop-application + [Guid("5842a140-ff9f-4166-8f5c-62f5b7b0c781"), ComImport] + public class AppxFactory + { + } + + [Guid("BEB94909-E451-438B-B5A7-D79E767B75D8"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface IAppxFactory + { + void _VtblGap0_2(); // skip 2 methods + IAppxManifestReader CreateManifestReader(IStream inputStream); + } + + [Guid("4E1BD148-55A0-4480-A3D1-15544710637C"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface IAppxManifestReader + { + void _VtblGap0_1(); // skip 1 method + IAppxManifestProperties GetProperties(); + void _VtblGap1_5(); // skip 5 methods + IAppxManifestApplicationsEnumerator GetApplications(); + } + + [Guid("9EB8A55A-F04B-4D0D-808D-686185D4847A"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface IAppxManifestApplicationsEnumerator + { + IAppxManifestApplication GetCurrent(); + bool GetHasCurrent(); + bool MoveNext(); + } + + [Guid("5DA89BF4-3773-46BE-B650-7E744863B7E8"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface IAppxManifestApplication + { + [PreserveSig] + int GetStringValue([MarshalAs(UnmanagedType.LPWStr)] string name, [MarshalAs(UnmanagedType.LPWStr)] out string value); + + [PreserveSig] + int GetAppUserModelId([MarshalAs(UnmanagedType.LPWStr)] out string value); + } + + [Guid("03FAF64D-F26F-4B2C-AAF7-8FE7789B8BCA"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface IAppxManifestProperties + { + [PreserveSig] + int GetBoolValue([MarshalAs(UnmanagedType.LPWStr)]string name, out bool value); + [PreserveSig] + int GetStringValue([MarshalAs(UnmanagedType.LPWStr)] string name, [MarshalAs(UnmanagedType.LPWStr)] out string value); + } + } +} diff --git a/Plugins/Flow.Launcher.Plugin.Program/Programs/UWP.cs b/Plugins/Flow.Launcher.Plugin.Program/Programs/UWP.cs index b8633f3571e..1706bb606ad 100644 --- a/Plugins/Flow.Launcher.Plugin.Program/Programs/UWP.cs +++ b/Plugins/Flow.Launcher.Plugin.Program/Programs/UWP.cs @@ -12,14 +12,18 @@ using System.Xml.Linq; using Windows.ApplicationModel; using Windows.Management.Deployment; -using AppxPackaing; -using Shell; -using Flow.Launcher.Infrastructure; -using Flow.Launcher.Plugin.Program.Logger; -using IStream = AppxPackaing.IStream; +using Wox.Infrastructure; +using Microsoft.Plugin.Program.Logger; using Rect = System.Windows.Rect; - -namespace Flow.Launcher.Plugin.Program.Programs +using Windows.UI.Xaml.Media.Imaging; +using Windows.UI.Xaml.Media; +using System.Windows.Controls; +using Wox.Plugin; +using System.Reflection; +using Wox.Plugin.SharedCommands; +using System.Runtime.InteropServices.ComTypes; + +namespace Microsoft.Plugin.Program.Programs { [Serializable] public class UWP @@ -51,12 +55,12 @@ public UWP(Package package) private void InitializeAppInfo() { + AppxPackageHelper _helper = new AppxPackageHelper(); var path = Path.Combine(Location, "AppxManifest.xml"); var namespaces = XmlNamespaces(path); InitPackageVersion(namespaces); - var appxFactory = new AppxFactory(); IStream stream; const uint noAttribute = 0x80; const Stgm exclusiveRead = Stgm.Read | Stgm.ShareExclusive; @@ -64,20 +68,15 @@ private void InitializeAppInfo() if (hResult == Hresult.Ok) { - var reader = appxFactory.CreateManifestReader(stream); - var manifestApps = reader.GetApplications(); var apps = new List(); - while (manifestApps.GetHasCurrent() != 0) + + List _apps = _helper.getAppsFromManifest(stream); + foreach(var _app in _apps) { - var manifestApp = manifestApps.GetCurrent(); - var appListEntry = manifestApp.GetStringValue("AppListEntry"); - if (appListEntry != "none") - { - var app = new Application(manifestApp, this); - apps.Add(app); - } - manifestApps.MoveNext(); + var app = new Application(_app, this); + apps.Add(app); } + Apps = apps.Where(a => a.AppListEntry != "none").ToArray(); } else @@ -356,13 +355,30 @@ await Task.Run(() => }); } - public Application(IAppxManifestApplication manifestApp, UWP package) + public Application(AppxPackageHelper.IAppxManifestApplication manifestApp, UWP package) { - UserModelId = manifestApp.GetAppUserModelId(); - UniqueIdentifier = manifestApp.GetAppUserModelId(); - DisplayName = manifestApp.GetStringValue("DisplayName"); - Description = manifestApp.GetStringValue("Description"); - BackgroundColor = manifestApp.GetStringValue("BackgroundColor"); + // This is done because we cannot use the keyword 'out' along with a property + string tmpUserModelId; + string tmpUniqueIdentifier; + string tmpDisplayName; + string tmpDescription; + string tmpBackgroundColor; + string tmpEntryPoint; + + manifestApp.GetAppUserModelId(out tmpUserModelId); + manifestApp.GetAppUserModelId(out tmpUniqueIdentifier); + manifestApp.GetStringValue("DisplayName", out tmpDisplayName); + manifestApp.GetStringValue("Description", out tmpDescription); + manifestApp.GetStringValue("BackgroundColor", out tmpBackgroundColor); + manifestApp.GetStringValue("EntryPoint", out tmpEntryPoint); + + UserModelId = tmpUserModelId; + UniqueIdentifier = tmpUniqueIdentifier; + DisplayName = tmpDisplayName; + Description = tmpDescription; + BackgroundColor = tmpBackgroundColor; + EntryPoint = tmpEntryPoint; + Package = package; DisplayName = ResourceFromPri(package.FullName, package.Name, DisplayName); @@ -430,7 +446,7 @@ public string FormattedPriReferenceValue(string packageName, string rawPriRefere return $"{prefix}//{packageName}{key}"; } - internal string LogoUriFromManifest(IAppxManifestApplication app) + internal string LogoUriFromManifest(AppxPackageHelper.IAppxManifestApplication app) { var logoKeyFromVersion = new Dictionary { @@ -440,8 +456,9 @@ internal string LogoUriFromManifest(IAppxManifestApplication app) }; if (logoKeyFromVersion.ContainsKey(Package.Version)) { + string logoUri; var key = logoKeyFromVersion[Package.Version]; - var logoUri = app.GetStringValue(key); + app.GetStringValue(key, out logoUri); return logoUri; } else diff --git a/installer/PowerToysSetup/Product.wxs b/installer/PowerToysSetup/Product.wxs new file mode 100644 index 00000000000..2ff4c033f06 --- /dev/null +++ b/installer/PowerToysSetup/Product.wxs @@ -0,0 +1,951 @@ + + + + + + + + + + + + + + + + + + + + + + = 17134)]]> + + + + + + + + + + + + + + + NOT Installed + 1 + NOT Installed + NOT Installed + Installed AND _REMOVE_ALL="Yes" + Installed AND _REMOVE_ALL="Yes" + Installed AND NOT (_REMOVE_ALL="Yes") + Installed AND NOT (_REMOVE_ALL="Yes") + + + + + + + + + + + + + + + + + + + + + + NOT Installed and CREATESCHEDULEDTASK = 1 + + + + + NOT Installed + + + Installed and (NOT UPGRADINGPRODUCTCODE) AND (REMOVE="ALL") + + + + NOT Installed + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + EXISTINGPOWERRENAMEEXTPATH OR EXISTINGIMAGERESIZERPATH + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + INSTALLDESKTOPSHORTCUT + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 327e2f32531afdffd9262a1970773a7055b5b6e0 Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Wed, 24 Jun 2020 21:55:52 +1000 Subject: [PATCH 2/4] update commit for Flow-Launcher --- .../Programs/AppxPackageHelper.cs | 2 +- .../Programs/UWP.cs | 15 +- installer/PowerToysSetup/Product.wxs | 951 ------------------ 3 files changed, 6 insertions(+), 962 deletions(-) delete mode 100644 installer/PowerToysSetup/Product.wxs diff --git a/Plugins/Flow.Launcher.Plugin.Program/Programs/AppxPackageHelper.cs b/Plugins/Flow.Launcher.Plugin.Program/Programs/AppxPackageHelper.cs index f9605a574a3..e48f30757be 100644 --- a/Plugins/Flow.Launcher.Plugin.Program/Programs/AppxPackageHelper.cs +++ b/Plugins/Flow.Launcher.Plugin.Program/Programs/AppxPackageHelper.cs @@ -5,7 +5,7 @@ using System.Runtime.InteropServices.ComTypes; using Windows.Storage; -namespace Microsoft.Plugin.Program.Programs +namespace Flow.Launcher.Plugin.Program.Programs { public class AppxPackageHelper { diff --git a/Plugins/Flow.Launcher.Plugin.Program/Programs/UWP.cs b/Plugins/Flow.Launcher.Plugin.Program/Programs/UWP.cs index 1706bb606ad..6818a8bcd6e 100644 --- a/Plugins/Flow.Launcher.Plugin.Program/Programs/UWP.cs +++ b/Plugins/Flow.Launcher.Plugin.Program/Programs/UWP.cs @@ -4,6 +4,7 @@ using System.IO; using System.Linq; using System.Runtime.InteropServices; +using System.Runtime.InteropServices.ComTypes; using System.Security.Principal; using System.Text; using System.Threading.Tasks; @@ -12,18 +13,11 @@ using System.Xml.Linq; using Windows.ApplicationModel; using Windows.Management.Deployment; -using Wox.Infrastructure; -using Microsoft.Plugin.Program.Logger; +using Flow.Launcher.Infrastructure; +using Flow.Launcher.Plugin.Program.Logger; using Rect = System.Windows.Rect; -using Windows.UI.Xaml.Media.Imaging; -using Windows.UI.Xaml.Media; -using System.Windows.Controls; -using Wox.Plugin; -using System.Reflection; -using Wox.Plugin.SharedCommands; -using System.Runtime.InteropServices.ComTypes; -namespace Microsoft.Plugin.Program.Programs +namespace Flow.Launcher.Plugin.Program.Programs { [Serializable] public class UWP @@ -253,6 +247,7 @@ public class Application : IProgram public string UserModelId { get; set; } public string BackgroundColor { get; set; } + public string EntryPoint { get; set; } public string Name => DisplayName; public string Location => Package.Location; diff --git a/installer/PowerToysSetup/Product.wxs b/installer/PowerToysSetup/Product.wxs deleted file mode 100644 index 2ff4c033f06..00000000000 --- a/installer/PowerToysSetup/Product.wxs +++ /dev/null @@ -1,951 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - = 17134)]]> - - - - - - - - - - - - - - - NOT Installed - 1 - NOT Installed - NOT Installed - Installed AND _REMOVE_ALL="Yes" - Installed AND _REMOVE_ALL="Yes" - Installed AND NOT (_REMOVE_ALL="Yes") - Installed AND NOT (_REMOVE_ALL="Yes") - - - - - - - - - - - - - - - - - - - - - - NOT Installed and CREATESCHEDULEDTASK = 1 - - - - - NOT Installed - - - Installed and (NOT UPGRADINGPRODUCTCODE) AND (REMOVE="ALL") - - - - NOT Installed - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - EXISTINGPOWERRENAMEEXTPATH OR EXISTINGIMAGERESIZERPATH - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - INSTALLDESKTOPSHORTCUT - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - From 4b4953e3ac78c17f94a9bc09f957d8880a33da0d Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Mon, 15 Feb 2021 20:02:18 +1100 Subject: [PATCH 3/4] version bump Program plugin --- Plugins/Flow.Launcher.Plugin.Program/plugin.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Flow.Launcher.Plugin.Program/plugin.json b/Plugins/Flow.Launcher.Plugin.Program/plugin.json index 93e5079c2d5..d110124ff42 100644 --- a/Plugins/Flow.Launcher.Plugin.Program/plugin.json +++ b/Plugins/Flow.Launcher.Plugin.Program/plugin.json @@ -4,7 +4,7 @@ "Name": "Program", "Description": "Search programs in Flow.Launcher", "Author": "qianlifeng", - "Version": "1.4.1", + "Version": "1.4.2", "Language": "csharp", "Website": "https://github.com/Flow-Launcher/Flow.Launcher", "ExecuteFileName": "Flow.Launcher.Plugin.Program.dll", From 575ff31ce56e056ac4f97f0cb5faa1c46d20f612 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=98=E9=9F=AC=20=E5=BC=A0?= Date: Mon, 15 Feb 2021 17:17:03 +0800 Subject: [PATCH 4/4] change format Initialize out variable inline, and use discard varable for unused variable --- .../Programs/UWP.cs | 29 +++++++------------ 1 file changed, 10 insertions(+), 19 deletions(-) diff --git a/Plugins/Flow.Launcher.Plugin.Program/Programs/UWP.cs b/Plugins/Flow.Launcher.Plugin.Program/Programs/UWP.cs index 69afecb4f45..855a11c86fa 100644 --- a/Plugins/Flow.Launcher.Plugin.Program/Programs/UWP.cs +++ b/Plugins/Flow.Launcher.Plugin.Program/Programs/UWP.cs @@ -56,10 +56,9 @@ private void InitializeAppInfo() var namespaces = XmlNamespaces(path); InitPackageVersion(namespaces); - IStream stream; const uint noAttribute = 0x80; const Stgm exclusiveRead = Stgm.Read | Stgm.ShareExclusive; - var hResult = SHCreateStreamOnFileEx(path, exclusiveRead, noAttribute, false, null, out stream); + var hResult = SHCreateStreamOnFileEx(path, exclusiveRead, noAttribute, false, null, out IStream stream); if (hResult == Hresult.Ok) { @@ -345,14 +344,13 @@ public List ContextMenus(IPublicAPI api) private async void Launch(IPublicAPI api) { var appManager = new ApplicationActivationHelper.ApplicationActivationManager(); - uint unusedPid; const string noArgs = ""; const ApplicationActivationHelper.ActivateOptions noFlags = ApplicationActivationHelper.ActivateOptions.None; await Task.Run(() => { try { - appManager.ActivateApplication(UserModelId, noArgs, noFlags, out unusedPid); + appManager.ActivateApplication(UserModelId, noArgs, noFlags, out _); } catch (Exception) { @@ -366,19 +364,13 @@ await Task.Run(() => public Application(AppxPackageHelper.IAppxManifestApplication manifestApp, UWP package) { // This is done because we cannot use the keyword 'out' along with a property - string tmpUserModelId; - string tmpUniqueIdentifier; - string tmpDisplayName; - string tmpDescription; - string tmpBackgroundColor; - string tmpEntryPoint; - - manifestApp.GetAppUserModelId(out tmpUserModelId); - manifestApp.GetAppUserModelId(out tmpUniqueIdentifier); - manifestApp.GetStringValue("DisplayName", out tmpDisplayName); - manifestApp.GetStringValue("Description", out tmpDescription); - manifestApp.GetStringValue("BackgroundColor", out tmpBackgroundColor); - manifestApp.GetStringValue("EntryPoint", out tmpEntryPoint); + + manifestApp.GetAppUserModelId(out string tmpUserModelId); + manifestApp.GetAppUserModelId(out string tmpUniqueIdentifier); + manifestApp.GetStringValue("DisplayName", out string tmpDisplayName); + manifestApp.GetStringValue("Description", out string tmpDescription); + manifestApp.GetStringValue("BackgroundColor", out string tmpBackgroundColor); + manifestApp.GetStringValue("EntryPoint", out string tmpEntryPoint); UserModelId = tmpUserModelId; UniqueIdentifier = tmpUniqueIdentifier; @@ -464,9 +456,8 @@ internal string LogoUriFromManifest(AppxPackageHelper.IAppxManifestApplication a }; if (logoKeyFromVersion.ContainsKey(Package.Version)) { - string logoUri; var key = logoKeyFromVersion[Package.Version]; - app.GetStringValue(key, out logoUri); + app.GetStringValue(key, out string logoUri); return logoUri; } else