private void sdktel_Data(Ets2Telemetry data, bool newTimestamp) { if (sdkBusy) { return; } sdkBusy = true; try { if (miner != null) { miner.Refresh(); for (int k = 0; k < 64; k++) { var carPool = miner.Get("Car " + k); if (carPool == null) { continue; } var car = Cars.FirstOrDefault(x => x.ID == k); if (car == null) { continue; } car.Speed = carPool.ReadAs <float>("Speed"); car.X = carPool.ReadAs <float>("CoordinateX"); car.Y = carPool.ReadAs <float>("CoordinateY"); car.Z = carPool.ReadAs <float>("CoordinateZ"); } } var ep = new IPEndPoint(IPAddress.Parse("192.168.1.158"), 12345); var r = (data.Drivetrain.EngineRpm - 300) / (2500 - 300); if (data.Drivetrain.EngineRpm < 300) { r = -1; } var s = ((int)(r * 10000)).ToString() + "," + ((int)(data.Controls.GameThrottle * 1000)).ToString() + "," + ((data.Paused) ? 1 : 0); var sb = ASCIIEncoding.ASCII.GetBytes(s); var dgram = ASCIIEncoding.ASCII.GetBytes(s); server.SendTo(dgram, ep); } catch { } sdkBusy = false; }