Пример #1
0
 public override MetadataFile GetIcon()
 {
     if (options.IsBackgroundDownload)
     {
         var logger = LogManager.GetLogger();
         logger.Info("SGDBMetadataProvider GetIcon options " + options.GameData.ToString());
         string gameUrl;
         if (options.GameData.Source != null && options.GameData.Source.ToString().ToLower() == "steam" && options.GameData.GameId != null)
         {
             gameUrl = services.getLogoImageUrl(options.GameData.Name, convertPlayniteGameSourceToSGDBPlatformEnum(options.GameData.Source.ToString().ToLower()), options.GameData.GameId);
         }
         else
         {
             gameUrl = services.getLogoImageUrl(options.GameData.Name);
         }
         if (gameUrl == "bad path")
         {
             return(base.GetIcon());
         }
         else
         {
             return(new MetadataFile(gameUrl));
         }
     }
     else
     {
         if (AvailableFields.Contains(MetadataField.Name))
         {
             if (searchSelection != null)
             {
                 var     icons     = services.getLogoImages(searchSelection.Name);
                 dynamic selection = null;
                 if (icons != null)
                 {
                     selection = GetIconManually(icons);
                 }
                 if (selection == null || selection.Path == "nopath")
                 {
                     return(base.GetIcon());
                 }
                 else
                 {
                     return(new MetadataFile(selection.Path));
                 }
             }
             else
             {
                 return(base.GetIcon());
             }
         }
         else
         {
             return(base.GetIcon());
         }
     }
 }
        public override MetadataFile GetIcon()
        {
            if (options.IsBackgroundDownload)
            {
                if (options.GameData.Source != null)
                {
                    return(new MetadataFile(services.getLogoImageUrl(options.GameData.Name, options.GameData.Source.ToString().ToLower(), options.GameData.GameId)));
                }
                else
                {
                    return(new MetadataFile(services.getLogoImageUrl(options.GameData.Name)));
                }
            }
            else
            {
                var gameList = new List <GenericItemOption>(services.getGameListSGDB(options.GameData.Name).Select(game => new GenericItemOption(game.name, game.id.ToString())));
                GetGame(gameList, "Icon");

                if (searchSelection != null)
                {
                    var icons     = services.getLogoImages(searchSelection.Name);
                    var selection = GetIconManually(icons);
                    if (selection == null || selection.Path == "nopath")
                    {
                        return(base.GetIcon());
                    }
                    else
                    {
                        return(new MetadataFile(selection.Path));
                    }
                }
                else
                {
                    return(base.GetIcon());
                }
            }
        }
 public override MetadataFile GetIcon()
 {
     if (options.IsBackgroundDownload)
     {
         var logger = LogManager.GetLogger();
         logger.Info("SGDBMetadataProvider GetIcon options " + options.GameData.ToString());
         string gameUrl;
         if (options.GameData.Source != null && options.GameData.PluginId == BuiltinExtensions.GetIdFromExtension(BuiltinExtension.SteamLibrary) && options.GameData.GameId != null)
         {
             if (iconAssetSelection == "logos")
             {
                 gameUrl = services.getLogoImageUrl(options.GameData.Name, convertPlayniteGamePluginIdToSGDBPlatformEnum(options.GameData.PluginId), options.GameData.GameId);
             }
             else
             {
                 gameUrl = services.getIconImageUrl(options.GameData.Name, convertPlayniteGamePluginIdToSGDBPlatformEnum(options.GameData.PluginId), options.GameData.GameId);
             }
         }
         else
         {
             if (iconAssetSelection == "logos")
             {
                 gameUrl = services.getLogoImageUrl(options.GameData.Name);
             }
             else
             {
                 gameUrl = services.getIconImageUrl(options.GameData.Name);
             }
         }
         if (gameUrl == "bad path")
         {
             return(base.GetIcon());
         }
         else
         {
             return(new MetadataFile(gameUrl));
         }
     }
     else
     {
         if (AvailableFields.Contains(MetadataField.Name))
         {
             if (searchSelection != null)
             {
                 List <MediaModel> icons;
                 if (iconAssetSelection == "logos")
                 {
                     icons = services.getLogoImages(searchSelection.Name);
                 }
                 else
                 {
                     icons = services.getIconImages(searchSelection.Name);
                 }
                 dynamic selection = null;
                 if (icons != null)
                 {
                     selection = GetIconManually(icons);
                 }
                 if (selection == null || selection.Path == "nopath")
                 {
                     return(base.GetIcon());
                 }
                 else
                 {
                     return(new MetadataFile(selection.FullRes));
                 }
             }
             else
             {
                 return(base.GetIcon());
             }
         }
         else
         {
             return(base.GetIcon());
         }
     }
 }