@@ -279,9 +279,15 @@ private static string GetCachedAppImagePath(uint appId, SteamImageType type)
279
279
return result ;
280
280
}
281
281
282
- var imagePath = Path . Join ( SteamLibraryCachePath , fileName ) ;
282
+ var appCachePath = Path . Join ( SteamLibraryCachePath , $ " { appId } " ) ;
283
283
284
- return imagePath ;
284
+ var exists = Directory . Exists ( appCachePath ) ;
285
+ var searchTarget = exists ? appCachePath : SteamLibraryCachePath ;
286
+ var searchName = GetAppImageSearchName ( appId , type ) ;
287
+
288
+ var imageResults = Directory . GetFiles ( searchTarget , searchName , SearchOption . AllDirectories ) ;
289
+
290
+ return imageResults . FirstOrDefault ( ) ;
285
291
}
286
292
287
293
private static bool IsAnimated ( string imagePath )
@@ -359,12 +365,31 @@ private static string GetAppImageName(uint appId, SteamImageType type)
359
365
SteamImageType . GridPortrait => $ "{ appId } p",
360
366
SteamImageType . GridIcon => $ "{ appId } _icon",
361
367
SteamImageType . GridHero => $ "{ appId } _hero",
362
- SteamImageType . Header => $ "{ appId } _header.jpg",
368
+ SteamImageType . Header => @"header.jpg" ,
369
+ SteamImageType . Icon => $ "{ appId } _icon.jpg",
370
+ SteamImageType . Logo => $ "logo.png",
371
+ SteamImageType . LibraryHero => @"library_hero.jpg" ,
372
+ SteamImageType . LibraryHeroBlur => @"library_hero_blur.jpg" ,
373
+ SteamImageType . Library => @"library_600x900.jpg" ,
374
+ _ => throw new NotSupportedException ( $ "{ type } is not available in the local cache. Use { nameof ( GetImageUri ) } instead.")
375
+ } ;
376
+ }
377
+
378
+ private static string GetAppImageSearchName ( uint appId , SteamImageType type )
379
+ {
380
+ // NOTE: this method is for local images (i.e. Steam's library cache, Grid, etc.)
381
+ return type switch
382
+ {
383
+ SteamImageType . GridLandscape => $ "{ appId } ",
384
+ SteamImageType . GridPortrait => $ "{ appId } p",
385
+ SteamImageType . GridIcon => $ "{ appId } _icon",
386
+ SteamImageType . GridHero => $ "{ appId } _hero",
387
+ SteamImageType . Header => @"*header.jpg" ,
363
388
SteamImageType . Icon => $ "{ appId } _icon.jpg",
364
- SteamImageType . Logo => $ "{ appId } _logo.jpg ",
365
- SteamImageType . LibraryHero => $ " { appId } _library_hero .jpg",
366
- SteamImageType . LibraryHeroBlur => $ " { appId } _library_hero_blur .jpg",
367
- SteamImageType . Library => $ " { appId } _library_600x900 .jpg",
389
+ SteamImageType . Logo => $ "logo.png ",
390
+ SteamImageType . LibraryHero => @"library_hero .jpg",
391
+ SteamImageType . LibraryHeroBlur => @"library_hero_blur .jpg",
392
+ SteamImageType . Library => @"library_600x900 .jpg",
368
393
_ => throw new NotSupportedException ( $ "{ type } is not available in the local cache. Use { nameof ( GetImageUri ) } instead.")
369
394
} ;
370
395
}
0 commit comments