/// <summary> /// Sends a packet to the client. /// </summary> /// <param name="packet">The packet to send.</param> /// <returns>Whether the sending succeeded.</returns> /// <exception cref="ArgumentNullException"><paramref name="packet"/> is <c>null</c>.</exception> public bool SendPacket(Packet packet) { if (packet == null) { throw new ArgumentNullException("packet"); } lock (this.binaryWriter) { if (this.clientRsa != null) { return packet.WriteToStream(this.binaryWriter, this.clientRsa); } else { return packet.WriteToStream(this.binaryWriter); } } }
/// <summary> /// Sends a packet to the client. /// </summary> /// <param name="packet">The packet to send.</param> /// <returns>Whether the sending succeeded.</returns> public bool SendPacket(Packet packet) { return this.Connection.SendPacket(packet); }