コード例 #1
0
        public static string DeltaToString(TimeSpan delta)
        {
            var seconds = delta.TotalSeconds;
            var laptime = new Laptime((float)seconds);

            return(laptime.DisplayShort);
        }
コード例 #2
0
        public BestLap(Laptime lap, Driver driver)
        {
            this.Laptime = lap;

            this.DriverId       = driver.CustId;
            this.DriverName     = driver.Name;
            this.DriverNumber   = driver.CarNumber;
            this.DriverTeamId   = driver.TeamId;
            this.DriverTeamName = driver.TeamName;
        }
コード例 #3
0
        public BestLap UpdateFastestLap(Laptime lap, Driver driver)
        {
            var classId = driver.Car.CarClassId;

            if (!this.ClassBestLaps.ContainsKey(classId))
            {
                this.ClassBestLaps.Add(classId, BestLap.Default);
            }

            if (lap.Value > 0 && this.ClassBestLaps[classId].Laptime.Value > lap.Value)
            {
                var bestlap = new BestLap(lap, driver);
                this.ClassBestLaps[classId] = bestlap;

                this.OverallBestLap =
                    this.ClassBestLaps.Values.Where(l => l.Laptime.Value > 0)
                    .OrderBy(l => l.Laptime.Value)
                    .FirstOrDefault();

                return(bestlap);
            }
            return(null);
        }