コード例 #1
0
 public override MetadataFile GetBackgroundImage()
 {
     if (options.IsBackgroundDownload)
     {
         string gameUrl;
         if (options.GameData.Source != null && options.GameData.Source.ToString().ToLower() == "steam" && options.GameData.GameId != null)
         {
             gameUrl = services.getHeroImageUrl(options.GameData.Name, convertPlayniteGameSourceToSGDBPlatformEnum(options.GameData.Source.ToString().ToLower()), options.GameData.GameId);
         }
         else
         {
             gameUrl = services.getHeroImageUrl(options.GameData.Name);
         }
         if (gameUrl == "bad path")
         {
             return(base.GetBackgroundImage());
         }
         else
         {
             return(new MetadataFile(gameUrl));
         }
     }
     else
     {
         if (AvailableFields.Contains(MetadataField.Name))
         {
             if (searchSelection != null)
             {
                 var     heroes    = services.getHeroImages(searchSelection.Name);
                 dynamic selection = null;
                 if (heroes != null)
                 {
                     selection = GetHeroManually(heroes);
                 }
                 if (selection == null || selection.Path == "nopath")
                 {
                     return(base.GetBackgroundImage());
                 }
                 else
                 {
                     return(new MetadataFile(selection.Path));
                 }
             }
             else
             {
                 return(base.GetBackgroundImage());
             }
         }
         else
         {
             return(base.GetBackgroundImage());
         }
     }
 }
コード例 #2
0
 public override MetadataFile GetBackgroundImage()
 {
     if (options.IsBackgroundDownload)
     {
         string gameUrl;
         if (options.GameData.Source != null && options.GameData.PluginId == BuiltinExtensions.GetIdFromExtension(BuiltinExtension.SteamLibrary) && options.GameData.GameId != null)
         {
             gameUrl = services.getHeroImageUrl(options.GameData.Name, convertPlayniteGamePluginIdToSGDBPlatformEnum(options.GameData.PluginId), options.GameData.GameId);
         }
         else
         {
             gameUrl = services.getHeroImageUrl(options.GameData.Name);
         }
         if (gameUrl == "bad path")
         {
             return(base.GetBackgroundImage());
         }
         else
         {
             return(new MetadataFile(gameUrl));
         }
     }
     else
     {
         if (AvailableFields.Contains(MetadataField.Name))
         {
             if (searchSelection != null)
             {
                 var     heroes    = services.getHeroImages(searchSelection.Name);
                 dynamic selection = null;
                 if (heroes != null)
                 {
                     selection = GetHeroManually(heroes);
                 }
                 if (selection == null || selection.Path == "nopath")
                 {
                     return(base.GetBackgroundImage());
                 }
                 else
                 {
                     return(new MetadataFile(selection.FullRes));
                 }
             }
             else
             {
                 return(base.GetBackgroundImage());
             }
         }
         else
         {
             return(base.GetBackgroundImage());
         }
     }
 }
コード例 #3
0
        public override MetadataFile GetBackgroundImage()
        {
            if (options.IsBackgroundDownload)
            {
                if (options.GameData.Source != null)
                {
                    return(new MetadataFile(services.getHeroImageUrl(options.GameData.Name, options.GameData.Source.ToString().ToLower(), options.GameData.GameId)));
                }
                else
                {
                    return(new MetadataFile(services.getHeroImageUrl(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, "Background");

                if (searchSelection != null)
                {
                    var heroes    = services.getHeroImages(searchSelection.Name);
                    var selection = GetHeroManually(heroes);
                    if (selection == null || selection.Path == "nopath")
                    {
                        return(base.GetBackgroundImage());
                    }
                    else
                    {
                        return(new MetadataFile(selection.Path));
                    }
                }
                else
                {
                    return(base.GetBackgroundImage());
                }
            }
        }