/// <summary> /// Set list sources available in database. /// </summary> /// <param name="PlayniteApiDatabase"></param> internal void SetListSource(IGameDatabaseAPI PlayniteApiDatabase) { s1.Visibility = Visibility.Hidden; s2.Visibility = Visibility.Hidden; s3.Visibility = Visibility.Hidden; s4.Visibility = Visibility.Hidden; s5.Visibility = Visibility.Hidden; s6.Visibility = Visibility.Hidden; s7.Visibility = Visibility.Hidden; s8.Visibility = Visibility.Hidden; s9.Visibility = Visibility.Hidden; s10.Visibility = Visibility.Hidden; s11.Visibility = Visibility.Hidden; s12.Visibility = Visibility.Hidden; s13.Visibility = Visibility.Hidden; int iCount = 1; // Playnite string SourceName = TransformIcon.Get("Playnite"); if (SourceName.Length != 1) { SourceName = "Playnite"; } else { SourceName = SourceName + " " + "Playnite"; } if (StatisticsDatabase.HaveGame(Guid.Parse("00000000-0000-0000-0000-000000000000"))) { s1.Tag = "00000000-0000-0000-0000-000000000000"; s1.Content = SourceName; s1.Visibility = Visibility.Visible; iCount += 1; } foreach (var item in PlayniteApiDatabase.Sources) { SourceName = TransformIcon.Get(item.Name); if (SourceName.Length != 1) { SourceName = item.Name; } else { SourceName = SourceName + " " + item.Name; } if (StatisticsDatabase.HaveGame(item.Id)) { switch (iCount) { case 1: s1.Tag = item.Id.ToString(); s1.Content = SourceName; s1.Visibility = Visibility.Visible; break; case 2: s2.Tag = item.Id.ToString(); s2.Content = SourceName; s2.Visibility = Visibility.Visible; break; case 3: s3.Tag = item.Id.ToString(); s3.Content = SourceName; s3.Visibility = Visibility.Visible; break; case 4: s4.Tag = item.Id.ToString(); s4.Content = SourceName; s4.Visibility = Visibility.Visible; break; case 5: s5.Tag = item.Id.ToString(); s5.Content = SourceName; s5.Visibility = Visibility.Visible; break; case 6: s6.Tag = item.Id.ToString(); s6.Content = SourceName; s6.Visibility = Visibility.Visible; break; case 7: s7.Tag = item.Id.ToString(); s7.Content = SourceName; s7.Visibility = Visibility.Visible; break; case 8: s8.Tag = item.Id.ToString(); s8.Content = SourceName; s8.Visibility = Visibility.Visible; break; case 9: s9.Tag = item.Id.ToString(); s9.Content = SourceName; s9.Visibility = Visibility.Visible; break; case 10: s10.Tag = item.Id.ToString(); s10.Content = SourceName; s10.Visibility = Visibility.Visible; break; case 11: s11.Tag = item.Id.ToString(); s11.Content = SourceName; s11.Visibility = Visibility.Visible; break; case 12: s12.Tag = item.Id.ToString(); s12.Content = SourceName; s12.Visibility = Visibility.Visible; break; case 13: s13.Tag = item.Id.ToString(); s13.Content = SourceName; s13.Visibility = Visibility.Visible; break; } iCount += 1; } } s0.IsChecked = true; }
/// <summary> /// Set list sources available in database. /// </summary> /// <param name="PlayniteApiDatabase"></param> internal void SetListSource(IGameDatabaseAPI PlayniteApiDatabase) { s1.Visibility = Visibility.Hidden; s2.Visibility = Visibility.Hidden; s3.Visibility = Visibility.Hidden; s4.Visibility = Visibility.Hidden; s5.Visibility = Visibility.Hidden; s6.Visibility = Visibility.Hidden; s7.Visibility = Visibility.Hidden; s8.Visibility = Visibility.Hidden; s9.Visibility = Visibility.Hidden; s10.Visibility = Visibility.Hidden; s11.Visibility = Visibility.Hidden; s12.Visibility = Visibility.Hidden; s13.Visibility = Visibility.Hidden; int iCount = 1; // Playnite string SourceName = TransformIcon.Get("Playnite"); if (SourceName.Length != 1) { SourceName = "Playnite"; } else { SourceName = SourceName + " " + "Playnite"; } if (StatisticsDatabase.HaveGame(Guid.Parse("00000000-0000-0000-0000-000000000000"))) { s1.Tag = "00000000-0000-0000-0000-000000000000"; s1.Content = SourceName; s1.Visibility = Visibility.Visible; iCount += 1; } #region Set list sources // Set emulators sources (cbEmulators) List <dataEmulators> ListEmulators = new List <dataEmulators>(); foreach (var item in PlayniteApiDatabase.Emulators) { ListEmulators.Add(new dataEmulators { Id = item.Id, Name = item.Name }); } cbEmulators.ItemsSource = ListEmulators; if (ListEmulators.Count == 0) { spEmulators.Visibility = Visibility.Hidden; } // Get link source for emulator else { foreach (var game in PlayniteApiDatabase.Games) { if (game.PlayAction != null && game.PlayAction.EmulatorId != null) { for (int i = 0; i < ListEmulators.Count; i++) { if (ListEmulators[i].Id == game.PlayAction.EmulatorId) { ListEmulators[i].SourceId = game.SourceId; if (game.SourceId == Guid.Parse("00000000-0000-0000-0000-000000000000")) { ListEmulators[i].SourceName = ""; } else { ListEmulators[i].SourceName = game.Source.Name; } i = ListEmulators.Count; } } } } } // Set pc sources foreach (var item in PlayniteApiDatabase.Sources) { bool IsEmulators = false; for (int i = 0; i < ListEmulators.Count; i++) { if (ListEmulators[i].SourceId == item.Id) { IsEmulators = true; } } if (!IsEmulators) { SourceName = TransformIcon.Get(item.Name); if (SourceName.Length != 1) { SourceName = item.Name; } else { SourceName = SourceName + " " + item.Name; } if (StatisticsDatabase.HaveGame(item.Id)) { switch (iCount) { case 1: s1.Tag = item.Id.ToString(); s1.Content = SourceName; s1.Visibility = Visibility.Visible; break; case 2: s2.Tag = item.Id.ToString(); s2.Content = SourceName; s2.Visibility = Visibility.Visible; break; case 3: s3.Tag = item.Id.ToString(); s3.Content = SourceName; s3.Visibility = Visibility.Visible; break; case 4: s4.Tag = item.Id.ToString(); s4.Content = SourceName; s4.Visibility = Visibility.Visible; break; case 5: s5.Tag = item.Id.ToString(); s5.Content = SourceName; s5.Visibility = Visibility.Visible; break; case 6: s6.Tag = item.Id.ToString(); s6.Content = SourceName; s6.Visibility = Visibility.Visible; break; case 7: s7.Tag = item.Id.ToString(); s7.Content = SourceName; s7.Visibility = Visibility.Visible; break; case 8: s8.Tag = item.Id.ToString(); s8.Content = SourceName; s8.Visibility = Visibility.Visible; break; case 9: s9.Tag = item.Id.ToString(); s9.Content = SourceName; s9.Visibility = Visibility.Visible; break; case 10: s10.Tag = item.Id.ToString(); s10.Content = SourceName; s10.Visibility = Visibility.Visible; break; case 11: s11.Tag = item.Id.ToString(); s11.Content = SourceName; s11.Visibility = Visibility.Visible; break; case 12: s12.Tag = item.Id.ToString(); s12.Content = SourceName; s12.Visibility = Visibility.Visible; break; case 13: s13.Tag = item.Id.ToString(); s13.Content = SourceName; s13.Visibility = Visibility.Visible; break; } iCount += 1; } } } s0.IsChecked = true; #endregion }