public OpenConnectionRequestPacket(byte[] data) { RakDecoder decoder = new RakDecoder(data); Type = (PacketType)decoder.Byte(); decoder.Magic(); switch (Type) { case PacketType.OpenConnectionRequest1: ProtocolVersion = decoder.Byte(); break; case PacketType.OpenConnectionRequest2: Address = decoder.Address(); MtuSize = decoder.Short(); ClientID = decoder.Long().Unsigned(); break; default: Debug.Assert(false, "Unreachable."); break; } // Null padding decoder.Raw(data.Length - decoder.Pos); }
public ConnectionRequestPacket(ref RakDecoder decoder) { ClientGuid = decoder.Long().Unsigned(); TimeSinceStart = decoder.Timestamp(); UseEncryption = decoder.Byte(); }