public static DriverTiming FromModel(DriverInfo modelDriverInfo, SessionTiming session, bool invalidateFirstLap) { var driver = new DriverTiming(modelDriverInfo, session); driver.InvalidateFirstLap = invalidateFirstLap; return(driver); }
private bool ShouldBeExported(SessionTiming sessionTiming) { if (sessionTiming.LastSet.SessionInfo.SessionTime.TotalMinutes < Settings.ReportingSettings.MinimumSessionLength) { return(false); } switch (sessionTiming.SessionType) { case SessionType.Practice: return(Settings.ReportingSettings.PracticeReportSettings.Export); case SessionType.Qualification: return(Settings.ReportingSettings.QualificationReportSetting.Export); case SessionType.WarmUp: return(Settings.ReportingSettings.WarmUpReportSettings.Export); case SessionType.Race: return(Settings.ReportingSettings.RaceReportSettings.Export); default: return(false); } }
public static SessionSummary ToSessionSummary(this SessionTiming timing) { SessionSummary summary = new SessionSummary(); FillSessionInfo(summary, timing); AddDrivers(summary, timing); return(summary); }
private static void FillSessionInfo(SessionSummary summary, SessionTiming timing) { summary.SessionType = timing.SessionType; summary.TrackInfo = timing.LastSet.SessionInfo.TrackInfo; summary.Simulator = timing.LastSet.Source; summary.SessionLength = TimeSpan.FromSeconds(timing.TotalSessionLength); summary.SessionLengthType = timing.LastSet.SessionInfo.SessionLengthType; summary.TotalNumberOfLaps = timing.LastSet.SessionInfo.TotalNumberOfLaps; }
public DriverTiming(DriverInfo driverInfo, SessionTiming session) { _lapsInfo = new List <LapInfo>(); _pitStopInfo = new List <PitStopInfo>(); DriverInfo = driverInfo; Pace = TimeSpan.Zero; LapPercentage = 0; _previousTickLapDistance = 0; Session = session; }
public SessionInfoViewModel() { _timing = null; BestSector1 = "S1:N/A"; BestSector2 = "S2:N/A"; BestSector3 = "S2:N/A"; BestLap = "Best Lap: N/A"; SessionRemaining = "L1/14"; AnySectorFilled = true; }
public DriverTiming(DriverInfo driverInfo, SessionTiming session) { _refreshBestSectorIndicationWatch = Stopwatch.StartNew(); _lapsInfo = new List <ILapInfo>(); _pitStopInfo = new List <PitStopInfo>(); DriverInfo = driverInfo; Pace = TimeSpan.Zero; LapPercentage = 0; _previousTickLapDistance = 0; Session = session; }
public SessionInfoViewModel() { _timing = null; _refreshWatch = Stopwatch.StartNew(); BestSector1 = "S1:N/A"; BestSector2 = "S2:N/A"; BestSector3 = "S2:N/A"; BestLap = "Best Lap: N/A"; SessionRemaining = "L1/14"; AnySectorFilled = true; _sessionRemainingCalculator = new SessionRemainingCalculator(this); }
public void Specificationhelper_CreateSessionTiming_Success() { // *** ARRANGE *** string tmField = "s=0 9999"; SessionTiming expected = new SessionTiming(0, 9999); // *** ACT *** SessionTiming result = SpecificationHelpers.CreateTiming(tmField); // *** ASSERT *** string eEncoded = expected.Encode(); string rEncoded = result.Encode(); Assert.Equal(eEncoded, rEncoded); }
public void SpecificationHelper_GetDescriptionField_Success() { // *** ARRANGE *** SdpVersion test1 = new SdpVersion(); // expected v= SessionOrigin test2 = new SessionOrigin(); // expected o= SessionTiming test3 = new SessionTiming(); // expected t= // *** ACT *** string result1 = SpecificationHelpers.GetDescriptionField(test1); string result2 = SpecificationHelpers.GetDescriptionField(test2); string result3 = SpecificationHelpers.GetDescriptionField(test3); // *** ASSERT *** Assert.Equal("v=", result1); Assert.Equal("o=", result2); Assert.Equal("t=", result3); }
public void CreateReport(SessionTiming sessionTiming) { if (!ShouldBeExported(sessionTiming)) { return; } try { SessionSummary sessionSummary = sessionTiming.ToSessionSummary(); string reportName = GetReportName(sessionSummary); SessionSummaryExporter sessionSummaryExporter = CreateSessionSummaryExporter(); string fullReportPath = Path.Combine( Settings.ReportingSettings.ExportDirectoryReplacedSpecialDirs, reportName); sessionSummaryExporter.ExportSessionSummary(sessionSummary, fullReportPath); OpenReportIfEnabled(sessionSummary, fullReportPath); CheckAndDeleteIfMaximumReportsExceeded(); } catch (Exception ex) { Logger.Error(ex, "Unable to export session info"); } }
private static void AddDrivers(SessionSummary summary, SessionTiming timing) { summary.Drivers.AddRange(timing.Drivers.Select(d => ConvertToSummaryDriver(d.Value, timing.SessionType))); }
public SessionInfoViewModel(SessionTiming timing) { _timing = timing; }