public static IPacket ReadPacket(this BinaryReader @this) { if (@this.BaseStream.Length - @this.BaseStream.Position < 7) { return(null); } var packetId = (PacketId)@this.ReadInt16(); return(packetId switch { PacketId.OutLoginReply => LoginReply.FromReader(@this, PacketSerializationMode.ReadCompression), PacketId.OutAnnouncement => Announcement.FromReader(@this, PacketSerializationMode.ReadCompression), _ => null });