internal List <GameInfo> GetLibraryGames() { var games = new List <GameInfo>(); using (var butler = new Butler()) { var profiles = butler.GetProfiles(); if (profiles?.Any() != true) { throw new Exception("User is not authenticated."); } foreach (var profile in profiles) { var keys = butler.GetOwnedKeys(profile.id); if (!keys.HasItems()) { continue; } foreach (var key in keys) { if (key.game == null) { continue; } if (key.game.classification != GameClassification.game && key.game.classification != GameClassification.tool) { continue; } if (games.Any(a => a.GameId == key.game.id.ToString())) { continue; } var game = new GameInfo() { Source = "itch.io", GameId = key.game.id.ToString(), Name = key.game.title.RemoveTrademarks(), CoverImage = key.game.coverUrl, Platform = "PC" }; games.Add(game); } } } return(games); }
internal List <Game> GetLibraryGames() { var games = new List <Game>(); using (var butler = new Butler()) { var profiles = butler.GetProfiles(); if (profiles?.Any() != true) { throw new Exception("User is not authenticated."); } foreach (var profile in profiles) { var keys = butler.GetOwnedKeys(profile.id); foreach (var key in keys) { if (key.game == null) { continue; } if (key.game.classification != GameClassification.game && key.game.classification != GameClassification.tool) { continue; } if (games.Any(a => a.GameId == key.game.id.ToString())) { continue; } var game = new Game() { PluginId = Id, GameId = key.game.id.ToString(), Name = key.game.title, CoverImage = key.game.coverUrl }; games.Add(game); } } } return(games); }