public static int Read(byte[] buf, int c, RaceStatus stat)
        {
            stat.MessageVersionNumber = buf[c++];

            var t = new byte[] { buf[c++], buf[c++], buf[c++], buf[c++], buf[c++], buf[c++], 0, 0 };
            stat.CurrentTime = new DateTime(1970, 1, 1).AddMilliseconds(BitConverter.ToUInt64(t, 0));

            stat.RaceId = BitConverter.ToUInt32(buf, c);
            c += 4;

            stat.Status = (RaceStatusEnum)buf[c++];

            stat.ExpectedStartTime = 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));

            stat.RaceCourseWindDirection = BitConverter.ToInt16(buf, c) * 360.0 / 65536.0;
            c += 2;

            stat.RaceCourseWindSpeed = BitConverter.ToUInt16(buf, c) / 1000.0;
            c += 2;

            stat.NumberOfBoatsInRace = buf[c++];
            stat.RaceType = (RaceTypeEnum)buf[c++];

            for (int i = 0; i < stat.NumberOfBoatsInRace; ++i)
            {
                var b = new BoatStatus();
                c = BoatStatus.Read(buf, c, b);
                stat.BoatStatuses.Add(b);
            }

            return c;
        }
        public static int Read(byte[] buf, int c, BoatStatus b)
        {
            b.BoatId = BitConverter.ToUInt32(buf, c);
            c += 4;

            b.Status = (BoatStatusEnum)buf[c++];
            b.LegNumber = buf[c++];
            b.PenaltiesAwarded = buf[c++];
            b.PenaltiesServed = buf[c++];

            b.ExpectedTimeAtNextMark = 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));

            b.EstimatedTimeAtFinish = 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));

            return c;
        }
 public static BoatStatus Read(byte[] buf)
 {
     var bs = new BoatStatus();
     Read(buf, 0, bs);
     return bs;
 }