public List <GamePassGame> UpdateGamePassCatalog(bool resetCache) { var gamePassGamesList = new List <GamePassGame>(); PlayniteApi.Dialogs.ActivateGlobalProgress((a) => { var service = new GamePassCatalogBrowserService(PlayniteApi, GetPluginUserDataPath(), settings.Settings.NotifyCatalogUpdates, settings.Settings.AddExpiredTagToGames, settings.Settings.AddNewGames, settings.Settings.RemoveExpiredGames, settings.Settings.RegionCode); if (resetCache == true) { service.DeleteCache(); } gamePassGamesList = service.GetGamePassGamesList(); service.Dispose(); }, new GlobalProgressOptions(ResourceProvider.GetString("LOCGamePass_Catalog_Browser_UpdatingCatalogProgressMessage"))); return(gamePassGamesList); }
public void AddAllGamePassCatalog() { var choice = PlayniteApi.Dialogs.ShowMessage(ResourceProvider.GetString("LOCGamePass_Catalog_Browser_AddAllGamesSelectionMessage"), "Game Catalog Importer", MessageBoxButton.YesNo); if (choice == MessageBoxResult.Yes) { PlayniteApi.Dialogs.ActivateGlobalProgress((a) => { var gamePassGamesList = new List <GamePassGame>(); var service = new GamePassCatalogBrowserService(PlayniteApi, GetPluginUserDataPath(), settings.Settings.NotifyCatalogUpdates, settings.Settings.AddExpiredTagToGames, settings.Settings.AddNewGames, settings.Settings.RemoveExpiredGames, settings.Settings.RegionCode); gamePassGamesList = service.GetGamePassGamesList(); if (gamePassGamesList.Count == 0) { PlayniteApi.Dialogs.ShowMessage(ResourceProvider.GetString("LOCGamePass_Catalog_Browser_CatalogGetFailErrorMessage"), "Game Pass Catalog Browser"); } else { var addedGames = service.xboxLibraryHelper.AddGamePassListToLibrary(gamePassGamesList); PlayniteApi.Dialogs.ShowMessage(string.Format(ResourceProvider.GetString("LOCGamePass_Catalog_Browser_UpdatingCatalogProgressMessage"), addedGames.ToString()), "Game Pass Catalog Browser"); } service.Dispose(); }, new GlobalProgressOptions(ResourceProvider.GetString("LOCGamePass_Catalog_Browser_UpdatingCatalogAddGamesProgressMessage"))); } }