public static int Read(byte[] buf, int c, CourseWind w) { w.MessageVersionNumber = buf[c++]; w.SelectedWindId = buf[c++]; w.RecordCount = buf[c++]; for (int i = 0; i < w.RecordCount; ++i) { var wr = new WindRecord(); c = WindRecord.Read(buf, c, wr); w.WindRecords.Add(wr); } return c; }
public static int Read(byte[] buf, int c, WindRecord w) { w.WindId = buf[c++]; w.Time = new DateTime(1970, 1, 1).AddMilliseconds(BitConverter.ToUInt64( new byte[] { buf[c++], buf[c++], buf[c++], buf[c++], buf[c++], buf[c++], 0, 0 }, 0)); w.RaceId = BitConverter.ToUInt32(buf, c); c += 4; w.WindDirection = BitConverter.ToInt16(buf, c) * 180.0f / 32768.0f; c += 2; w.WindSpeed = BitConverter.ToUInt16(buf, c) / 1000.0f; c += 2; w.BestUpwindAngle = BitConverter.ToInt16(buf, c) * 180.0f / 32768.0f; c += 2; w.BestDownwindAngle = BitConverter.ToInt16(buf, c) * 180.0f / 32768.0f; c += 2; w.Flags = (WindRecordFlags)buf[c++]; return c; }
public static WindRecord Read(byte[] buf) { var w = new WindRecord(); Read(buf, 0, w); return w; }