@@ -279,9 +279,15 @@ private static string GetCachedAppImagePath(uint appId, SteamImageType type)
279279 return result ;
280280 }
281281
282- var imagePath = Path . Join ( SteamLibraryCachePath , fileName ) ;
282+ var appCachePath = Path . Join ( SteamLibraryCachePath , $ " { appId } " ) ;
283283
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 ( ) ;
285291 }
286292
287293 private static bool IsAnimated ( string imagePath )
@@ -359,12 +365,31 @@ private static string GetAppImageName(uint appId, SteamImageType type)
359365 SteamImageType . GridPortrait => $ "{ appId } p",
360366 SteamImageType . GridIcon => $ "{ appId } _icon",
361367 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" ,
363388 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",
368393 _ => throw new NotSupportedException ( $ "{ type } is not available in the local cache. Use { nameof ( GetImageUri ) } instead.")
369394 } ;
370395 }
0 commit comments