コード例 #1
0
            public Item(NonRaceLap item, int currentPosition, int numberOfLaps)
            {
                this.Driver       = item.Driver.NameSurname;
                this.Number       = item.Driver.Number;
                this.Position     = currentPosition;
                this.NumberOfLaps = numberOfLaps;
                if (this.NumberOfLaps > 0)
                {
                    this.BestTime  = item.Time;
                    this.WorstTime = item.GetThrough(j => j.WorserLap).Time;
                }
                if (this.NumberOfLaps > 1)
                {
                    this.SecondTime = item.WorserLap.Time;
                }
                if (this.NumberOfLaps > 2)
                {
                    this.ThirdTime = item.WorserLap.WorserLap.Time;
                }

                this.MeanTime = GetMeanTime(item);
            }
コード例 #2
0
        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);
        }