Esempio n. 1
0
        private Car UpdateDriver(Car car, int index)
        {
            YamlQuery query = sessionInfo["DriverInfo"]["Drivers"]["CarIdx", index];
            query = sessionInfo["DriverInfo"]["Drivers"]["CarIdx", index];
            car.CarName = query["CarPath"].GetValue();

            string position;
            if (!sessionInfo["SessionInfo"]["Sessions"]["SessionNum", telemetry.Sessions.CurrentSession.SessionNum]["ResultsPositions"]["CarIdx", index]["Position"].TryGetValue(out position))
            {
                position = "-1";
            }
            car.Position = Int32.Parse(position);

            string bestlaptime;
            if (!sessionInfo["SessionInfo"]["Sessions"]["SessionNum", telemetry.Sessions.CurrentSession.SessionNum]["ResultsPositions"]["CarIdx", index]["FastestTime"].TryGetValue(out bestlaptime))
            {
                bestlaptime = "0";
            }
            car.BestLapTime = GetBestLApTime(bestlaptime);

            string time;
            if (!sessionInfo["SessionInfo"]["Sessions"]["SessionNum", telemetry.Sessions.CurrentSession.SessionNum]["ResultsPositions"]["CarIdx", index]["LastLapTime"].TryGetValue(out time))
            {
                time = "0";
            }
            car.Time = GetBestLApTime(time);

            string lapsComplete;
            if (!sessionInfo["SessionInfo"]["Sessions"]["SessionNum", telemetry.Sessions.CurrentSession.SessionNum]["ResultsPositions"]["CarIdx", index]["LapsComplete"].TryGetValue(out lapsComplete))
            {
                lapsComplete = "0";
            }
            car.LapsComplete = lapsComplete;

            return car;
        }
Esempio n. 2
0
        private Car NewDriver(SessionInfo sessionInfo, int index)
        {
            YamlQuery query = sessionInfo["DriverInfo"]["Drivers"]["CarIdx", index];

            string name;
            if (!query["UserName"].TryGetValue(out name))
            {
                // Driver not found
                return null;
            }

            Car car = new Car() { id = index };
            car.Name = name;

            car = UpdateDriver(car, index);
            return car;
        }