示例#1
0
        public void LoadData()
        {
            m_header         = new PacketHeader();
            m_header.RawData = RawData;
            var currentPos = m_header.LoadData();

            using (var br = new BinaryReader(new MemoryStream(RawData)))
            {
                br.BaseStream.Position = currentPos;

                for (int i = 0; i < m_carTelemetryData.GetUpperBound(0); i++)
                {
                    m_carTelemetryData[i]                    = new CarTelemetryData();
                    m_carTelemetryData[i].m_speed            = br.ReadUInt16();
                    m_carTelemetryData[i].m_throttle         = br.ReadSingle();
                    m_carTelemetryData[i].m_steer            = br.ReadSingle();
                    m_carTelemetryData[i].m_brake            = br.ReadSingle();
                    m_carTelemetryData[i].m_clutch           = br.ReadByte();
                    m_carTelemetryData[i].m_gear             = br.ReadSByte();
                    m_carTelemetryData[i].m_engineRPM        = br.ReadUInt16();
                    m_carTelemetryData[i].m_drs              = br.ReadByte();
                    m_carTelemetryData[i].m_revLightsPercent = br.ReadByte();

                    for (int x = 0; x < 4; x++)
                    {
                        m_carTelemetryData[i].m_brakesTemperature[x] = br.ReadUInt16();
                    }

                    for (int x = 0; x < 4; x++)
                    {
                        m_carTelemetryData[i].m_tyresSurfaceTemperature[x] = br.ReadUInt16();
                    }

                    for (int x = 0; x < 4; x++)
                    {
                        m_carTelemetryData[i].m_tyresInnerTemperature[x] = br.ReadUInt16();
                    }

                    m_carTelemetryData[i].m_engineTemperature = br.ReadUInt16();

                    for (int x = 0; x < 4; x++)
                    {
                        m_carTelemetryData[i].m_tyresPressure[x] = br.ReadSingle();
                    }

                    for (int x = 0; x < 4; x++)
                    {
                        m_carTelemetryData[i].m_surfaceType[x] = br.ReadByte();
                    }
                }
            }
        }
示例#2
0
 public PacketCarTelemetryData(byte[] rawData)
 {
     m_carTelemetryData = new CarTelemetryData[20];
     RawData            = rawData;
     LoadData();
 }
示例#3
0
 public PacketCarTelemetryData()
 {
     m_carTelemetryData = new CarTelemetryData[20];
 }