public void Deserialize(BitStream stream) { MessageNumber = stream.ReadUInt(); Reliability = (PacketReliability)stream.ReadBits(3)[0]; if (Reliability == PacketReliability.UnreliableSequenced || Reliability == PacketReliability.ReliableSequenced || Reliability == PacketReliability.ReliableOrdered) { OrderingChannel = stream.ReadBits(5)[0]; OrderingIndex = stream.ReadUInt(); } SplitPacket = stream.ReadBit(); if (SplitPacket) { SplitPacketId = stream.ReadUShort(); SplitPacketIndex = stream.ReadCompressedUInt(); SplitPacketCount = stream.ReadCompressedUInt(); } var length = stream.ReadCompressedUShort(); stream.AlignRead(); Data = stream.Read(BitStream.BitsToBytes(length)); }