@@ -618,10 +618,10 @@ string TryToFindLogo(string uri, string path)
618
618
var extension = Path . GetExtension ( path ) ;
619
619
if ( extension != null )
620
620
{
621
- if ( File . Exists ( path ) )
622
- {
623
- return path ; // shortcut, avoid enumerating files
624
- }
621
+ // if (File.Exists(path))
622
+ // {
623
+ // return path; // shortcut, avoid enumerating files
624
+ // }
625
625
626
626
var logoNamePrefix = Path . GetFileNameWithoutExtension ( uri ) ; // e.g Square44x44
627
627
var logoDir = Path . GetDirectoryName ( path ) ; // e.g ..\..\Assets
@@ -639,10 +639,26 @@ string TryToFindLogo(string uri, string path)
639
639
// Just ignore all qualifiers
640
640
// select like logo.[xxx_yyy].png
641
641
// https://learn.microsoft.com/en-us/windows/uwp/app-resources/tailor-resources-lang-scale-contrast
642
- var selected = files . FirstOrDefault ( file =>
642
+ var logos = files . Where ( file =>
643
643
Path . GetFileName ( file ) . StartsWith ( logoNamePrefix ) && extension == Path . GetExtension ( file )
644
644
) ;
645
645
646
+ var selected = logos . FirstOrDefault ( ) ;
647
+
648
+ foreach ( var logo in logos )
649
+ {
650
+
651
+ var imageStream = File . OpenRead ( logo ) ;
652
+ var decoder = BitmapDecoder . Create ( imageStream , BitmapCreateOptions . IgnoreColorProfile , BitmapCacheOption . None ) ;
653
+ var height = decoder . Frames [ 0 ] . PixelHeight ;
654
+ var width = decoder . Frames [ 0 ] . PixelWidth ;
655
+ if ( height == 44 && width == 44 )
656
+ {
657
+ selected = logo ;
658
+ break ;
659
+ }
660
+ }
661
+
646
662
if ( ! string . IsNullOrEmpty ( selected ) )
647
663
{
648
664
return selected ;
0 commit comments