public SuccessView(SuccessStorySettings settings, IPlayniteAPI PlayniteApi, string PluginUserDataPath, Game GameSelected = null) { this.PlayniteApi = PlayniteApi; PlayniteApiDatabase = PlayniteApi.Database; PlayniteApiPaths = PlayniteApi.Paths; this.settings = settings; this.PluginUserDataPath = PluginUserDataPath; AchievementsDatabase = new AchievementsDatabase(PlayniteApi, PluginUserDataPath); AchievementsDatabase.Initialize(); InitializeComponent(); // Block hidden column. lvProgressionValue.IsEnabled = false; lvSourceName.IsEnabled = false; pbProgressionGlobalCount.Value = AchievementsDatabase.Progession().Unlocked; pbProgressionGlobalCount.Maximum = AchievementsDatabase.Progession().Total; labelProgressionGlobalCount.Content = AchievementsDatabase.Progession().Progression + "%"; GetListGame(); AchievementsGraphicsDataCount GraphicsData = AchievementsDatabase.GetCountByMonth(); string[] StatsGraphicsAchievementsLabels = GraphicsData.Labels; SeriesCollection StatsGraphicAchievementsSeries = new SeriesCollection(); StatsGraphicAchievementsSeries.Add(new LineSeries { Title = "", Values = GraphicsData.Series }); SuccessStory_Achievements_Graphics.Children.Clear(); SuccessStory_Achievements_Graphics.Children.Add(new SuccessStoryAchievementsGraphics(StatsGraphicAchievementsSeries, StatsGraphicsAchievementsLabels, this)); SuccessStory_Achievements_Graphics.UpdateLayout(); // Set game selected if (GameSelected != null) { for (int i = 0; i < ListviewGames.Items.Count; i++) { if (((ListGames)ListviewGames.Items[i]).Name == GameSelected.Name) { ListviewGames.SelectedIndex = i; } } } if (settings.EnableLocal) { //FilterSource.Items.Add(new { SourceName = "Playnite", IsCheck = false }); FilterSourceItems.Add(new ListSource { SourceName = "Playnite", IsCheck = false }); } if (settings.EnableSteam) { //FilterSource.Items.Add(new { SourceName = "Steam", IsCheck = false }); FilterSourceItems.Add(new ListSource { SourceName = "Steam", IsCheck = false }); } if (settings.EnableGog) { //FilterSource.Items.Add(new { SourceName = "GOG", IsCheck = false }); FilterSourceItems.Add(new ListSource { SourceName = "GOG", IsCheck = false }); } if (settings.EnableOrigin) { //FilterSource.Items.Add(new { SourceName = "Origin", IsCheck = false }); FilterSourceItems.Add(new ListSource { SourceName = "Origin", IsCheck = false }); } //FilterSource.UpdateLayout(); FilterSource.ItemsSource = FilterSourceItems; // Set Binding data DataContext = this; }
public TestPluginNuget(IPlayniteAPI api) : base(api) { logger = PlayniteApi.CreateLogger("TestPluginNuget"); }
public IgdbMetadataPlugin(IPlayniteAPI playniteAPI, IgdbServiceClient client) : base(playniteAPI) { Client = client; Settings = new IgdbMetadataSettings(this); }
public BackgroundChangerDatabase(IPlayniteAPI PlayniteApi, BackgroundChangerSettingsViewModel PluginSettings, string PluginUserDataPath) : base(PlayniteApi, PluginSettings, "BackgroundChanger", PluginUserDataPath) { }
public UplayLibrary(IPlayniteAPI api) : base(api) { LibrarySettings = new UplayLibrarySettings(this); }
public IgdbMetadataPlugin(IPlayniteAPI playniteAPI) : base(playniteAPI) { Client = new IgdbServiceClient(playniteAPI.ApplicationInfo.ApplicationVersion); Settings = new IgdbMetadataSettings(this); }
public void ConvertDB(IPlayniteAPI PlayniteApi) { GlobalProgressOptions globalProgressOptions = new GlobalProgressOptions( "CheckLocalizations - Database migration", false ); globalProgressOptions.IsIndeterminate = true; PlayniteApi.Dialogs.ActivateGlobalProgress((activateGlobalProgress) => { Stopwatch stopWatch = new Stopwatch(); stopWatch.Start(); logger.Info($"CheckLocalizations - ConvertDB()"); int Converted = 0; foreach (var item in Items) { try { if (PlayniteApi.Database.Games.Get(item.Key) != null) { GameLocalizations gameLocalizations = CheckLocalizations.PluginDatabase.Get(item.Key, true); foreach (var localization in item.Value) { gameLocalizations.Items.Add(new Localization { Language = localization.Language, Audio = localization.Audio, Ui = localization.Ui, Sub = localization.Sub, IsManual = false, Notes = localization.Notes }); } ItemsManual.TryGetValue(item.Key, out List <GameLocalizationOld> localizationManual); if (localizationManual != null && localizationManual.Count > 0) { foreach (var localization in localizationManual) { gameLocalizations.Items.Add(new Localization { Language = localization.Language, Audio = localization.Audio, Ui = localization.Ui, Sub = localization.Sub, IsManual = true, Notes = localization.Notes }); } } Thread.Sleep(10); CheckLocalizations.PluginDatabase.Add(gameLocalizations); Converted++; } else { logger.Warn($"CheckLocalizations - Game is deleted - {item.Key.ToString()}"); } } catch (Exception ex) { Common.LogError(ex, "CheckLocalizations", $"Failed to load ConvertDB from {item.Key.ToString()}"); } } logger.Info($"CheckLocalizations - Converted {Converted} / {Items.Count}"); stopWatch.Stop(); TimeSpan ts = stopWatch.Elapsed; logger.Info($"CheckLocalizations - Migration - {String.Format("{0:00}:{1:00}.{2:00}", ts.Minutes, ts.Seconds, ts.Milliseconds / 10)}"); }, globalProgressOptions); IsOld = false; }
public ItchioGameController(Game game, IPlayniteAPI api) : base(game) { this.api = api; this.game = game; }
public GuildWars2GameController(IPlayniteAPI api, Settings settings, Game game) : base(game) { this.settings = settings; this.api = api; }
public HowLongToBeat(HowLongToBeatData data, Game game, IPlayniteAPI PlayniteApi, HowLongToBeatSettings settings) { this.data = data; InitializeComponent(); HltbDataUser gameData = data.GetData(); if (string.IsNullOrEmpty(game.CoverImage)) { CoverImage = gameData.GameHltbData.UrlImg; } else { CoverImage = gameData.GameHltbData.UrlImg; if (!settings.ShowHltbImg) { CoverImage = PlayniteApi.Database.GetFullFilePath(game.CoverImage); } } GameName = game.Name; HltbName = resources.GetString("LOCSourceLabel") + ": " + gameData.GameHltbData.Name; int ElIndicator = 0; Hltb_El1.Visibility = Visibility.Hidden; Hltb_El1_Color.Visibility = Visibility.Hidden; Hltb_El2.Visibility = Visibility.Hidden; Hltb_El2_Color.Visibility = Visibility.Hidden; Hltb_El3.Visibility = Visibility.Hidden; Hltb_El3_Color.Visibility = Visibility.Hidden; if (gameData.GameHltbData.MainStory != 0) { ElIndicator += 1; SetDataInView(ElIndicator, resources.GetString("LOCHowLongToBeatMainStory"), gameData.GameHltbData.MainStoryFormat); } if (gameData.GameHltbData.MainExtra != 0) { ElIndicator += 1; SetDataInView(ElIndicator, resources.GetString("LOCHowLongToBeatMainExtra"), gameData.GameHltbData.MainExtraFormat); } if (gameData.GameHltbData.Completionist != 0) { ElIndicator += 1; SetDataInView(ElIndicator, resources.GetString("LOCHowLongToBeatCompletionist"), gameData.GameHltbData.CompletionistFormat); } if (gameData.GameHltbData.Solo != 0) { ElIndicator += 1; SetDataInView(ElIndicator, resources.GetString("LOCHowLongToBeatSolo"), gameData.GameHltbData.SoloFormat); } if (gameData.GameHltbData.CoOp != 0) { ElIndicator += 1; SetDataInView(ElIndicator, resources.GetString("LOCHowLongToBeatCoOp"), gameData.GameHltbData.CoOpFormat); } if (gameData.GameHltbData.Vs != 0) { ElIndicator += 1; SetDataInView(ElIndicator, resources.GetString("LOCHowLongToBeatVs"), gameData.GameHltbData.VsFormat); } LongToTimePlayedConverter converter = new LongToTimePlayedConverter(); PlaytimeFormat = (string)converter.Convert((long)game.Playtime, null, null, CultureInfo.CurrentCulture); HltbProgressBar.Children.Add(new HltbProgressBar(game.Playtime, gameData, settings)); HltbProgressBar.UpdateLayout(); // Set Binding data DataContext = this; }
public TwitchLibrary(IPlayniteAPI api) : base(api) { LibrarySettings = new TwitchLibrarySettings(this, PlayniteApi); TokensPath = Path.Combine(GetPluginUserDataPath(), "tokens.json"); }
public BethesdaLibrary(IPlayniteAPI api) : base(api) { LibrarySettings = new BethesdaLibrarySettings(this, PlayniteApi); }
public ItchioLibrary(IPlayniteAPI api) : base(api) { LibrarySettings = new ItchioLibrarySettings(this, api); }
public BattleNetGameController(Game game, IPlayniteAPI api) : base(game) { this.api = api; }
public SuccessView(SuccessStory plugin, SuccessStorySettings settings, IPlayniteAPI PlayniteApi, string PluginUserDataPath, bool isRetroAchievements = false, Game GameSelected = null) { this.plugin = plugin; this._PlayniteApi = PlayniteApi; _PlayniteApiDatabase = PlayniteApi.Database; _PlayniteApiPaths = PlayniteApi.Paths; this.settings = settings; this.PluginUserDataPath = PluginUserDataPath; InitializeComponent(); PART_DataLoad.Visibility = Visibility.Visible; PART_Data.Visibility = Visibility.Hidden; var TaskView = Task.Run(() => { AchievementsDb = new AchievementsDatabase(plugin, PlayniteApi, settings, PluginUserDataPath, isRetroAchievements); AchievementsDb.Initialize(false); GetListGame(); SetGraphicsAchievementsSources(); AchievementsGraphicsDataCount GraphicsData = null; if (settings.GraphicAllUnlockedByMonth) { GraphicsData = AchievementsDb.GetCountByMonth(null, 6); } else { GraphicsData = AchievementsDb.GetCountByDay(null, 5); } Application.Current.Dispatcher.BeginInvoke((Action) delegate { // Block hidden column. lvProgressionValue.IsEnabled = false; lvSourceName.IsEnabled = false; pbProgressionGlobalCount.Value = AchievementsDb.Progession().Unlocked; pbProgressionGlobalCount.Maximum = AchievementsDb.Progession().Total; labelProgressionGlobalCount.Content = AchievementsDb.Progession().Progression + "%"; pbProgressionLaunchedCount.Value = AchievementsDb.ProgessionLaunched().Unlocked; pbProgressionLaunchedCount.Maximum = AchievementsDb.ProgessionLaunched().Total; labelProgressionLaunchedCount.Content = AchievementsDb.ProgessionLaunched().Progression + "%"; GraphicTitle.Content = string.Empty; // lvGames options if (!settings.lvGamesIcon100Percent) { lvGameIcon100Percent.Width = 0; } if (!settings.lvGamesIcon) { lvGameIcon.Width = 0; } if (!settings.lvGamesName) { lvGameName.Width = 0; } if (!settings.lvGamesLastSession) { lvGameLastActivity.Width = 0; } if (!settings.lvGamesSource) { lvGamesSource.Width = 0; } if (!settings.lvGamesProgression) { lvGameProgression.Width = 0; } if (settings.GraphicAllUnlockedByMonth) { GraphicTitleALL.Content = resources.GetString("LOCSuccessStoryGraphicTitleALL"); } else { GraphicTitleALL.Content = resources.GetString("LOCSuccessStoryGraphicTitleALLDay"); } string[] StatsGraphicsAchievementsLabels = GraphicsData.Labels; SeriesCollection StatsGraphicAchievementsSeries = new SeriesCollection(); StatsGraphicAchievementsSeries.Add(new LineSeries { Title = string.Empty, Values = GraphicsData.Series }); SuccessStory_Achievements_Graphics.Children.Clear(); settings.IgnoreSettings = true; SuccessStory_Achievements_Graphics.Children.Add(new SuccessStoryAchievementsGraphics(StatsGraphicAchievementsSeries, StatsGraphicsAchievementsLabels, settings)); SuccessStory_Achievements_Graphics.UpdateLayout(); // Set game selected if (GameSelected != null) { for (int i = 0; i < ListviewGames.Items.Count; i++) { if (((ListViewGames)ListviewGames.Items[i]).Name == GameSelected.Name) { ListviewGames.SelectedIndex = i; } } } ListviewGames.ScrollIntoView(ListviewGames.SelectedItem); string icon = string.Empty; if (settings.EnableRetroAchievementsView && settings.EnableRetroAchievements) { if (isRetroAchievements) { PART_GraphicBySource.Visibility = Visibility.Collapsed; Grid.SetColumn(PART_GraphicAllUnlocked, 0); Grid.SetColumnSpan(PART_GraphicAllUnlocked, 3); if (settings.EnableRetroAchievements) { icon = TransformIcon.Get("RetroAchievements") + " "; FilterSourceItems.Add(new ListSource { SourceName = ((icon.Length == 2) ? icon : string.Empty) + "RetroAchievements", SourceNameShort = "RetroAchievements", IsCheck = false }); } } else { if (settings.EnableLocal) { icon = TransformIcon.Get("Playnite") + " "; FilterSourceItems.Add(new ListSource { SourceName = ((icon.Length == 2) ? icon : string.Empty) + "Playnite", SourceNameShort = "Playnite", IsCheck = false }); } if (settings.EnableSteam) { icon = TransformIcon.Get("Steam") + " "; FilterSourceItems.Add(new ListSource { SourceName = ((icon.Length == 2) ? icon : string.Empty) + "Steam", SourceNameShort = "Steam", IsCheck = false }); } if (settings.EnableGog) { icon = TransformIcon.Get("GOG") + " "; FilterSourceItems.Add(new ListSource { SourceName = ((icon.Length == 2) ? icon : string.Empty) + "GOG", SourceNameShort = "GOG", IsCheck = false }); } if (settings.EnableOrigin) { icon = TransformIcon.Get("Origin") + " "; FilterSourceItems.Add(new ListSource { SourceName = ((icon.Length == 2) ? icon : string.Empty) + "Origin", SourceNameShort = "Origin", IsCheck = false }); } if (settings.EnableXbox) { icon = TransformIcon.Get("Xbox") + " "; FilterSourceItems.Add(new ListSource { SourceName = ((icon.Length == 2) ? icon : string.Empty) + "Xbox", SourceNameShort = "Xbox", IsCheck = false }); } } } else { if (settings.EnableLocal) { icon = TransformIcon.Get("Playnite") + " "; FilterSourceItems.Add(new ListSource { SourceName = ((icon.Length == 2) ? icon : string.Empty) + "Playnite", SourceNameShort = "Playnite", IsCheck = false }); } if (settings.EnableSteam) { icon = TransformIcon.Get("Steam") + " "; FilterSourceItems.Add(new ListSource { SourceName = ((icon.Length == 2) ? icon : string.Empty) + "Steam", SourceNameShort = "Steam", IsCheck = false }); } if (settings.EnableGog) { icon = TransformIcon.Get("GOG") + " "; FilterSourceItems.Add(new ListSource { SourceName = ((icon.Length == 2) ? icon : string.Empty) + "GOG", SourceNameShort = "GOG", IsCheck = false }); } if (settings.EnableOrigin) { icon = TransformIcon.Get("Origin") + " "; FilterSourceItems.Add(new ListSource { SourceName = ((icon.Length == 2) ? icon : string.Empty) + "Origin", SourceNameShort = "Origin", IsCheck = false }); } if (settings.EnableXbox) { icon = TransformIcon.Get("Xbox") + " "; FilterSourceItems.Add(new ListSource { SourceName = ((icon.Length == 2) ? icon : string.Empty) + "Xbox", SourceNameShort = "Xbox", IsCheck = false }); } if (settings.EnableRetroAchievements) { icon = TransformIcon.Get("RetroAchievements") + " "; FilterSourceItems.Add(new ListSource { SourceName = ((icon.Length == 2) ? icon : string.Empty) + "RetroAchievements", SourceNameShort = "RetroAchievements", IsCheck = false }); } } FilterSource.ItemsSource = FilterSourceItems; // Set Binding data DataContext = this; PART_DataLoad.Visibility = Visibility.Hidden; PART_Data.Visibility = Visibility.Visible; }); }); }