public void SendPacket(AuthOpcodes opcode, byte[] data) { using (var ms = new MemoryStream()) using (var bw = new BinaryWriter(ms)) { bw.Write((byte)opcode); bw.Write(data); var packet = ms.ToArray(); Log.WriteLine(AuthLogTypes.Packets, $"-> {opcode}({packet.Length}):\n\t{string.Join(" ", packet.Select(b => b.ToString("X2")))}"); Send(packet); } }
public PacketHandlerAttribute(AuthOpcodes packetId) : this(Convert.ToInt32(packetId), typeof(AuthOpcodes)) { }