public static void Sample() { var iracing = new iRacingConnection(); iracing.Replay.MoveToStartOfRace(); iracing.Replay.SetSpeed(8); var time = new TimeSpan(); iracing.Replay.SetSpeed(1); foreach (var data in iracing.GetDataFeed().WithFinishingStatus()) { if (data.Telemetry.SessionTimeSpan > time) { MyListener.Clear(); foreach (var c in data.Telemetry.Cars.Where(c => !c.Details.IsPaceCar)) { Trace.WriteLine(string.Format("{0,-20}\tCheckedFlag: {1}\tRetired: {2}\tData:{3}", c.Details.UserName, c.HasSeenCheckeredFlag, c.HasRetired, c.HasData)); } Trace.WriteLine(""); Trace.WriteLine(string.Format("IsFinalLap: {0}, LeaderHasFinished: {1}", data.Telemetry.IsFinalLap, data.Telemetry.LeaderHasFinished)); Trace.WriteLine(""); Trace.WriteLine(""); time = data.Telemetry.SessionTimeSpan + (5 * 8).Seconds(); } } }
public static void Sample() { var iracing = new iRacingConnection(); iracing.Replay.MoveToStartOfRace(); iracing.Replay.SetSpeed(1); foreach (var data in iracing.GetDataFeed() .WithCorrectedPercentages() .WithCorrectedDistances()) { MyListener.Clear(); Trace.WriteLine("Driver Distances"); Trace.WriteLine("================"); Trace.WriteLine("RaceDistance: {0}".F(data.Telemetry.RaceDistance)); Trace.WriteLine(""); foreach (var c in data.Telemetry.Cars.OrderByDescending(d => d.TotalDistance)) { Trace.WriteLine(string.Format("{0}, dist: {1}, pos: {2}", c.Details.UserName, c.TotalDistance, c.Position)); } Thread.Sleep(2000); } }
public static void Sample() { var iracing = new iRacingConnection(); iracing.Replay.MoveToStartOfRace(); iracing.Replay.SetSpeed(1); var i = 0; foreach (var data in iracing.GetDataFeed() .WithCorrectedPercentages() .WithCorrectedDistances() .WithFinishingStatus()) { i++; if (i % 200 == 0) { MyListener.Clear(); var car = data.Telemetry.Cars .Where(c => c.TotalDistance > 0) .Where(c => !c.HasSeenCheckeredFlag) .Where(c => !c.Details.IsPaceCar) .Where(c => c.HasData) .Where(c => c.Details.Driver != null) .Where(c => c.TrackSurface == TrackLocation.OnTrack) .OrderByDescending(c => c.TotalDistance) .ThenBy(c => c.OfficialPostion == 0 ? int.MaxValue : c.OfficialPostion) .FirstOrDefault(); Trace.WriteLine("============================================================="); Trace.WriteLine(string.Format("Next Finisher is {0}", car == null ? "null" : car.Details.UserName)); Trace.WriteLine("Driver Distances"); Trace.WriteLine("================"); Trace.WriteLine("RaceDistance: {0}".F(data.Telemetry.RaceDistance)); Trace.WriteLine(""); foreach (var c in data.Telemetry.Cars.OrderByDescending(d => d.TotalDistance).ThenBy(c => c.OfficialPostion == 0 ? int.MaxValue : c.OfficialPostion)) { Trace.WriteLine(string.Format("{0}, dist: {1}, pos: {2}, official pos: {3}", c.Details.UserName, c.TotalDistance, c.Position, c.OfficialPostion)); } } } }