public void Send(IPBEPacket packet) { byte[] data = packet.Data.ToArray(); if (_encryption is not null) { data = _encryption.Encrypt(data); } PBENetworkUtils.Send(data, Socket); }
public void Send(IPBEPacket packet) { if (packet == null) { throw new ArgumentNullException(nameof(packet)); } byte[] data = packet.Data.ToArray(); if (_encryption != null) { data = _encryption.Encrypt(data); } PBENetworkUtils.Send(data, Socket); }
public void Send(IPBEPacket packet) { if (!IsConnected) { throw new InvalidOperationException("Socket not connected."); } byte[] data = packet.Data.ToArray(); if (_encryption is not null) { data = _encryption.Encrypt(data); } PBENetworkUtils.Send(data, _socket); }