public void Fill(NonRaceSession session, DriverEntry te) { if (te.IsPaceCar) { return; } int carIdx = te.CarIdx; Driver d = session.Weekend.Season.Drivers.TryGetBestBy(te.CarNum, te.Name); if (d == null) { d = Driver.Create(te.CarNum, te.Name); session.Weekend.Season.Drivers.Add(d); } if (session.Weekend.Drivers.ContainsKey(carIdx)) { Driver existing = session.Weekend.Drivers[carIdx]; if (existing.Number != d.Number || existing.NameSurname != d.NameSurname) { throw new Exception("The driver names with same number between sessions differs, which is not allowed in one race weekend."); } } else { session.Weekend.Drivers.Add(carIdx, d); } }
private static void FillSession(NonRaceSession session, List <ENG.NR2003.TelemetryEvents.TelemetryEvent> list) { if (session == null) { throw new ArgumentNullException(); } if (list == null) { throw new ArgumentNullException(); } if (session.IsEmpty() == false) { throw new ArgumentException("Cannot fill non-empty session."); } EventFiller ef = new EventFiller(); Type t = typeof(EventFiller); foreach (var item in list) { System.Reflection.MethodInfo mi = t.GetMethod("Fill", new Type[] { session.GetType(), item.GetType() }); mi.Invoke(ef, new object[] { session, item }); } session.RecalculateLapTimes(); session.RefreshLinks(); session.BuildPositions(); }
public void Fill(NonRaceSession session, CurrentWeekend te) { if (te.AtTrack == false) { return; } CheckForValidTrack(te.Track, session.Weekend.Track); session.Weekend.Track.AdjustedLengthInFeet = (int)te.TrackLength; FillOrCheckCurrentWeekend(session, te); }
public NonRaceSessionView(NonRaceSession nrs) { var poss = nrs.Positions; int currentPos = 1; foreach (var item in poss) { Item i = new Item(item, currentPos, nrs.Laps[item.Driver].Count); currentPos++; inner.Add(i); } }
public void Fill(NonRaceSession session, LapCrossing te) { int carIdx = te.CarIdx; if (session.Weekend.Drivers.ContainsKey(carIdx) == false) { throw new ApplicationException("Failed to find driver with carIdx " + carIdx + " in registered drivers of weekend."); } Driver d = session.Weekend.Drivers[carIdx]; NonRaceLap l = new NonRaceLap(); l.Driver = d; l.CrossedAtTime = Time.CreateFromSeconds(te.CrossedAt); if (l.CrossedAtTime.TotalMiliseconds < 0) { throw new ApplicationException("CrossedAt below zero."); } l.IsBlackFlagged = te.IsBlackFlagged; l.IsOffTrack = te.IsOffTrack; l.IsPitted = te.IsPitted; session.Laps.Add(l); }
public void Fill(NonRaceSession session, GamePaused te) { }
public void Fill(NonRaceSession session, DriverWithdrawl te) { }
public void Fill(NonRaceSession session, TelemetryEvent te) { throw new NotImplementedException("No implementation to invoke non-race fill over " + te.GetType().FullName); }
public void Fill(NonRaceSession session, DriverInCar te) { }
public void Fill(NonRaceSession session, Standings te) { }
public void Fill(NonRaceSession session, SessionInfo te) { }
public void Fill(NonRaceSession session, ApplicationExit te) { }
private static void UpdateNonRaceSession(NonRaceSession session, SessionInfo e) { Contract.Requires(session.SessionNum == e.SessionNum); }