@@ -363,34 +363,37 @@ public Application(IAppxManifestApplication manifestApp, UWP package)
363
363
BackgroundColor = manifestApp . GetStringValue ( "BackgroundColor" ) ;
364
364
Package = package ;
365
365
366
- DisplayName = ResourceFromPri ( package . FullName , DisplayName ) ;
367
- Description = ResourceFromPri ( package . FullName , Description ) ;
366
+ DisplayName = ResourceFromPri ( package . FullName , package . Name , DisplayName ) ;
367
+ Description = ResourceFromPri ( package . FullName , package . Name , Description ) ;
368
368
LogoUri = LogoUriFromManifest ( manifestApp ) ;
369
369
LogoPath = LogoPathFromUri ( LogoUri ) ;
370
370
371
371
Enabled = true ;
372
372
}
373
373
374
- internal string ResourceFromPri ( string packageFullName , string resourceReference )
374
+ internal string ResourceFromPri ( string packageFullName , string packageName , string resourceReference )
375
375
{
376
376
const string prefix = "ms-resource:" ;
377
377
if ( ! string . IsNullOrWhiteSpace ( resourceReference ) && resourceReference . StartsWith ( prefix ) )
378
378
{
379
- // magic comes from @talynone
380
- // https://github.com/talynone/Wox.Plugin.WindowsUniversalAppLauncher/blob/master/StoreAppLauncher/Helpers/NativeApiHelper.cs#L139-L153
381
379
string key = resourceReference . Substring ( prefix . Length ) ;
382
380
string parsed ;
383
381
if ( key . StartsWith ( "//" ) )
384
382
{
385
- parsed = prefix + key ;
386
- }
387
- else if ( key . StartsWith ( "/" ) )
388
- {
389
- parsed = prefix + "//" + key ;
383
+ parsed = $ "{ prefix } { key } ";
390
384
}
391
385
else
392
386
{
393
- parsed = prefix + "///resources/" + key ;
387
+ if ( ! key . StartsWith ( "/" ) )
388
+ {
389
+ key = $ "/{ key } ";
390
+ }
391
+
392
+ if ( ! key . ToLower ( ) . Contains ( "resources" ) )
393
+ {
394
+ key = $ "/Resources{ key } ";
395
+ }
396
+ parsed = $ "{ prefix } //{ packageName } { key } ";
394
397
}
395
398
396
399
var outBuffer = new StringBuilder ( 128 ) ;
@@ -413,12 +416,6 @@ internal string ResourceFromPri(string packageFullName, string resourceReference
413
416
}
414
417
else
415
418
{
416
- // https://github.com/Wox-launcher/Wox/issues/964
417
- // known hresult 2147942522:
418
- // 'Microsoft Corporation' violates pattern constraint of '\bms-resource:.{1,256}'.
419
- // for
420
- // Microsoft.MicrosoftOfficeHub_17.7608.23501.0_x64__8wekyb3d8bbwe: ms-resource://Microsoft.MicrosoftOfficeHub/officehubintl/AppManifest_GetOffice_Description
421
- // Microsoft.BingFoodAndDrink_3.0.4.336_x64__8wekyb3d8bbwe: ms-resource:AppDescription
422
419
var e = Marshal . GetExceptionForHR ( ( int ) hResult ) ;
423
420
ProgramLogger . LogException ( $ "|UWP|ResourceFromPri|{ Package . Location } |Load pri failed { source } with HResult { hResult } and location { Package . Location } ", e ) ;
424
421
return string . Empty ;
0 commit comments