public static ITrackOfCheckpoints CreateTrack(this RoundDef def, FinishCriteria fc) { var track = TrackOfCheckpointsFactory.Create(def.RoundStartTime, fc); foreach (var checkpoint in def.Checkpoints) { track.Append(checkpoint); } return(track); }
public static RoundDef ParseRoundDef(string src) { var lines = src.Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries); var mode = Track; var(start, duration) = ParseTrackHeader(lines[0]); var rd = new RoundDef { RoundStartTime = start, Duration = duration }; foreach (var line in lines.Skip(1)) { if (line.StartsWith("#")) { continue; } switch (mode) { case Track: if (line.StartsWith(Rating)) { mode = Rating; } else { rd.Checkpoints.AddRange(ParseCheckpoints(line, rd.RoundStartTime)); } break; case Rating: rd.Rating.Add(ParseRating(line, rd.RoundStartTime)); break; } } return(rd); }
public static string FormatCheckpoints(this RoundDef rd) { return(FormatCheckpoints(rd.Checkpoints, rd.RoundStartTime)); }