예제 #1
0
        public IEnumerable <LapTimeEntry> Import(string sourceName)
        {
            var file = new FileInfo(Path.Combine(_ov1Directory, "userdata", "best_lap.ini"));

            if (!file.Exists)
            {
                yield break;
            }

            var ini  = new IniFile(file.FullName);
            var date = file.CreationTime;

            foreach (var section in ini)
            {
                var trackLayoutId = _fixer.FixTrackId(section.Key);
                foreach (var pair in section.Value)
                {
                    var time = TimeSpan.FromMilliseconds(FlexibleParser.TryParseInt(pair.Value) ?? 0);
                    if (time.TotalSeconds < 1d)
                    {
                        continue;
                    }
                    yield return(new LapTimeEntry(sourceName, pair.Key.ToLowerInvariant(), trackLayoutId,
                                                  date, time));
                }
            }
        }
예제 #2
0
        private bool TryToGuessCarAndTrack(string sectionName, out string carId, out string trackLayoutId)
        {
            var s = sectionName.Split(new[] { '@' }, 2);

            if (s.Length != 2 || string.IsNullOrWhiteSpace(s[0]))
            {
                carId = trackLayoutId = null;
                return(false);
            }

            carId         = s[0].ToLowerInvariant();
            trackLayoutId = _fixer.FixTrackId(s[1].ToLowerInvariant());
            return(true);
        }