Exemplo n.º 1
0
 public override IEnumerable <GameMetadata> GetGames(LibraryGetGamesArgs args)
 {
     return(new List <GameMetadata>()
     {
         new GameMetadata()
         {
             Name = "Notepad",
             GameId = "notepad",
             IsInstalled = true,
             Icon = new MetadataFile(@"c:\Windows\notepad.exe")
         },
         new GameMetadata()
         {
             Name = "Calculator",
             GameId = "calc",
             IsInstalled = true,
             Icon = new MetadataFile(@"https://playnite.link/applogo.png"),
             BackgroundImage = new MetadataFile(@"https://playnite.link/applogo.png")
         },
         new GameMetadata()
         {
             Name = "Paint",
             GameId = "mspaint",
             IsInstalled = true,
             Icon = new MetadataFile(LibraryIcon)
         },
         new GameMetadata()
         {
             Name = "WordPad",
             GameId = "write",
             IsInstalled = true,
             Icon = new MetadataFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), @"Resources\icon.tga"))
         }
     });
 }
Exemplo n.º 2
0
 public override IEnumerable <GameMetadata> GetGames(LibraryGetGamesArgs args)
 {
     // Return list of user's games.
     return(new List <GameMetadata>()
     {
         new GameMetadata()
         {
             Name = "Notepad",
             GameId = "notepad",
             GameActions = new List <GameAction>
             {
                 new GameAction()
                 {
                     Type = GameActionType.File,
                     Path = "notepad.exe",
                     IsPlayAction = true
                 }
             },
             IsInstalled = true,
             Icon = new MetadataFile(@"c:\Windows\notepad.exe")
         },
         new GameMetadata()
         {
             Name = "Calculator",
             GameId = "calc",
             GameActions = new List <GameAction>
             {
                 new GameAction()
                 {
                     Type = GameActionType.File,
                     Path = "calc.exe",
                     IsPlayAction = true
                 }
             },
             IsInstalled = true,
             Icon = new MetadataFile(@"https://playnite.link/applogo.png"),
             BackgroundImage = new MetadataFile(@"https://playnite.link/applogo.png")
         }
     });
 }
 public override IEnumerable <GameMetadata> GetGames(LibraryGetGamesArgs args)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 4
0
        public override IEnumerable <GameMetadata> GetGames(LibraryGetGamesArgs args)
        {
            var gamesList = new List <GameMetadata>()
            {
            };

            if (string.IsNullOrEmpty(settings.Settings.AccountAccessCode))
            {
                PlayniteApi.Notifications.Add(new NotificationMessage(
                                                  dbImportMessageId,
                                                  "AniList access code has not been configured in the library settings",
                                                  NotificationType.Error));
            }
            else
            {
                string propertiesPrefix = settings.Settings.PropertiesPrefix;
                if (!string.IsNullOrEmpty(propertiesPrefix))
                {
                    propertiesPrefix = string.Format("{0} ", propertiesPrefix);
                }

                var accountApi = new AnilistAccountClient(PlayniteApi, settings.Settings.AccountAccessCode);
                if (string.IsNullOrEmpty(accountApi.anilistUsername))
                {
                    //Username could not be obtained
                    PlayniteApi.Notifications.Add(new NotificationMessage(
                                                      dbImportMessageId,
                                                      "Could not obtain AniList username. Verify that the configured access code is valid",
                                                      NotificationType.Error));
                }
                else
                {
                    logger.Info($"AniList username: {accountApi.anilistUsername}");
                    if (settings.Settings.ImportAnimeLibrary == true)
                    {
                        var animeEntries = accountApi.GetEntries("ANIME");
                        logger.Debug($"Found {animeEntries.Count} Anime items");
                        foreach (var entry in animeEntries)
                        {
                            var gameInfo = EntryToGameMetadata(entry, propertiesPrefix);
                            gamesList.Add(gameInfo);
                            overrideGameProperties(gameInfo);
                        }
                    }

                    if (settings.Settings.ImportMangaLibrary == true)
                    {
                        var mangaEntries = accountApi.GetEntries("MANGA");
                        logger.Debug($"Found {mangaEntries.Count} Manga items");
                        foreach (var entry in mangaEntries)
                        {
                            var gameInfo = EntryToGameMetadata(entry, propertiesPrefix);
                            gamesList.Add(gameInfo);
                            overrideGameProperties(gameInfo);
                        }
                    }
                }
            }

            return(gamesList);
        }