From f86c7af642aec5f696a66ab457673c02f349ddfb Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Sat, 25 Apr 2020 14:45:16 +1000 Subject: [PATCH] Fix Camera UWP app loading --- Plugins/Wox.Plugin.Program/Programs/UWP.cs | 25 ++++++++++++---------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/Plugins/Wox.Plugin.Program/Programs/UWP.cs b/Plugins/Wox.Plugin.Program/Programs/UWP.cs index 35917cb31..c5b089d46 100644 --- a/Plugins/Wox.Plugin.Program/Programs/UWP.cs +++ b/Plugins/Wox.Plugin.Program/Programs/UWP.cs @@ -363,34 +363,37 @@ public Application(IAppxManifestApplication manifestApp, UWP package) BackgroundColor = manifestApp.GetStringValue("BackgroundColor"); Package = package; - DisplayName = ResourceFromPri(package.FullName, DisplayName); - Description = ResourceFromPri(package.FullName, Description); + DisplayName = ResourceFromPri(package.FullName, package.Name, DisplayName); + Description = ResourceFromPri(package.FullName, package.Name, Description); LogoUri = LogoUriFromManifest(manifestApp); LogoPath = LogoPathFromUri(LogoUri); Enabled = true; } - internal string ResourceFromPri(string packageFullName, string resourceReference) + internal string ResourceFromPri(string packageFullName, string packageName, string resourceReference) { const string prefix = "ms-resource:"; if (!string.IsNullOrWhiteSpace(resourceReference) && resourceReference.StartsWith(prefix)) { - // magic comes from @talynone - // https://github.com/talynone/Wox.Plugin.WindowsUniversalAppLauncher/blob/master/StoreAppLauncher/Helpers/NativeApiHelper.cs#L139-L153 string key = resourceReference.Substring(prefix.Length); string parsed; if (key.StartsWith("//")) { - parsed = prefix + key; - } - else if (key.StartsWith("/")) - { - parsed = prefix + "//" + key; + parsed = $"{prefix}{key}"; } else { - parsed = prefix + "///resources/" + key; + if (!key.StartsWith("/")) + { + key = $"/{key}"; + } + + if (!key.ToLower().Contains("resources")) + { + key = $"/Resources{key}"; + } + parsed = $"{prefix}//{packageName}{key}"; } var outBuffer = new StringBuilder(128);