public StatisticsView(StatisticsSettings settings, IGameDatabaseAPI PlayniteApiDatabase, string PluginUserDataPath) { StatisticsDatabase.Initialize(PlayniteApiDatabase, settings); InitializeComponent(); _settings = settings; if (!settings.PreferTopGames) { SwitchDataGames.IsChecked = false; SwitchDataSources.IsChecked = true; } if (settings.PreferGenresCount) { SwitchDataGenresTime.IsChecked = false; SwitchDataGenresCount.IsChecked = true; } SetListSource(PlayniteApiDatabase); _lastToggleButton = s0; s0.IsChecked = true; SetData("null"); }
public void Initialize(IGameDatabaseAPI PlayniteApiDatabase, StatisticsSettings settings) { this.PlayniteApiDatabase = PlayniteApiDatabase; foreach (var item in PlayniteApiDatabase.Emulators) { ListEmulators.Add(item.Id); } Statistics = new StatisticsClass { Name = "All", GameGenres = new List <Counter>(), GameGenresTime = new List <CounterTime>(), GameSource = new List <Counter>(), GameFavorite = new List <Counter>(), GameIsInstalled = new List <Counter>(), GameIsNotLaunching = new List <Counter>(), GameHidden = new List <Counter>(), GameCompletionStatus = new List <Counter>(), Playtime = 0, Total = 0 }; StatisticsSourceDatabase = new ConcurrentDictionary <Guid, StatisticsClass>(); foreach (var Game in PlayniteApiDatabase.Games) { if (!Game.Hidden) { Add(Game); if (Game.PlayAction != null && Game.PlayAction.EmulatorId != null && ListEmulators.Contains(Game.PlayAction.EmulatorId)) { Add(Game, Game.PlayAction.EmulatorId); } else { Add(Game, Game.SourceId); } } else { if (settings.IncludeHiddenGames) { if (Game.PlayAction != null && Game.PlayAction.EmulatorId != null && ListEmulators.Contains(Game.PlayAction.EmulatorId)) { Add(Game, Game.PlayAction.EmulatorId); } else { Add(Game, Game.SourceId); } } } } }
public StatisticsController( IStorage <UserStatistics> statistics, IStorage <User> users, IOptions <StatisticsSettings> options, ILogger <StatisticsController> logger, IStatisticsService statisticsService) { _statistics = statistics; _users = users; _options = options.Value; _logger = logger; _statisticsService = statisticsService; }