Skip to content
This repository has been archived by the owner on Feb 12, 2021. It is now read-only.

Commit

Permalink
Merge pull request #187 from jjw24/fix_uwp_load
Browse files Browse the repository at this point in the history
Fix Camera UWP app loading
  • Loading branch information
jjw24 authored Apr 25, 2020
2 parents 9cc9571 + f86c7af commit 1bf6529
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions Plugins/Wox.Plugin.Program/Programs/UWP.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 1bf6529

Please sign in to comment.