public void Create(IntPtr data, int length, PacketFlags flags) { if (_packet != null) { throw new InvalidOperationException("Already created."); } _packet = Native.enet_packet_create(data, (IntPtr)length, flags); if (_packet == null) { throw new ENetException(0, "Packet creation call failed."); } }
public void Create(IntPtr data, int length, PacketFlags flags) { if (data == IntPtr.Zero) { throw new ArgumentNullException("data"); } if (length < 0) { throw new ArgumentOutOfRangeException("length"); } nativePacket = Native.enet_packet_create(data, (IntPtr)length, flags); }
public void Create(byte[] data, int length, PacketFlags flags) { if (data == null) { throw new ArgumentNullException("data"); } if (length < 0 || length > data.Length) { throw new ArgumentOutOfRangeException("length"); } nativePacket = Native.enet_packet_create(data, (IntPtr)length, flags); }