/// <summary>This ctor serializes to the internal buffer with the given opCode and data</summary> internal EQRawApplicationPacket(AppOpCode OpCode, IPEndPoint ipe, byte[] data) { _OpCode = OpCode; _clientIPE = ipe; // serialize to raw byte stream from opcode & passed data int dataSize = (data != null) ? 2 + data.Length : 2; // allow for opcode _data = new byte[dataSize]; Buffer.BlockCopy(BitConverter.GetBytes((ushort)_OpCode), 0, _data, 0, 2); // Don't put in network order? if (data != null) Buffer.BlockCopy(data, 0, _data, 2, data.Length); }
internal EQRawApplicationPacket(RawEQPacket rawPacket) : base(rawPacket.ClientIPE, rawPacket.RawPacketData) { _OpCode = (AppOpCode)rawPacket.RawOpCode; }
/// <summary>This ctor only parses and deserializes the opCode internally.</summary> internal EQRawApplicationPacket(IPEndPoint ipe, byte[] data) : base(ipe, data) { // OpCode is assumed sent backwards, so no need for endian switching _OpCode = (AppOpCode)BitConverter.ToUInt16(data, 0); }