private IStatisticsReader CreateStatisticsReader(ISourcePortData sourcePort, IGameFile gameFile) { List <IStatsData> existingStats = new List <IStatsData>(); if (gameFile != null && gameFile.GameFileID.HasValue) { existingStats = DataSourceAdapter.GetStats(gameFile.GameFileID.Value).ToList(); } return(SourcePortUtil.CreateSourcePort(sourcePort).CreateStatisticsReader(gameFile, existingStats)); }
public void SetData(IGameFile gameFile) { if (gameFile != null && gameFile.GameFileID.HasValue) { IEnumerable <IStatsData> stats = DataSourceAdapter.GetStats(gameFile.GameFileID.Value); dgvMain.DataSource = new BindingListView <StatsBind>(GetStatsBind(stats)); dgvMain.ContextMenuStrip = m_menu; } else { dgvMain.DataSource = null; } }
void m_statsReader_NewStastics(object sender, NewStatisticsEventArgs e) { if (e.Statistics != null && m_currentPlayFile != null && m_currentPlayFile.GameFileID.HasValue) { e.Statistics.MapName = e.Statistics.MapName.ToUpper(); e.Statistics.GameFileID = m_currentPlayFile.GameFileID.Value; e.Statistics.SourcePortID = m_currentPlayForm.SelectedSourcePort.SourcePortID; if (e.Update) { IStatsData stats = DataSourceAdapter.GetStats(e.Statistics.GameFileID).LastOrDefault(x => x.MapName == e.Statistics.MapName); if (stats != null) { DataSourceAdapter.DeleteStats(stats.StatID); } } DataSourceAdapter.InsertStats(e.Statistics); } }
private IStatisticsReader CreateStatisticsReader(ISourcePort sourcePort, IGameFile gameFile) { IStatisticsReader statsReader = null; if (BoomStatsReader.Supported(sourcePort)) { statsReader = BoomStatsReader.CreateDefault(gameFile, sourcePort.Directory.GetFullPath()); } else if (CNDoomStatsReader.Supported(sourcePort)) { statsReader = CNDoomStatsReader.CreateDefault(gameFile, sourcePort.Directory.GetFullPath()); } else if (ZDoomStatsReader.Supported(sourcePort)) { List <IStatsData> existingStats = new List <IStatsData>(); if (gameFile != null && gameFile.GameFileID.HasValue) { existingStats = DataSourceAdapter.GetStats(gameFile.GameFileID.Value).ToList(); } statsReader = ZDoomStatsReader.CreateDefault(gameFile, sourcePort.Directory.GetFullPath(), existingStats); } return(statsReader); }