private bool SendEncrypted(Peer peer, ChannelID channel, BasePacket packet, bool reliable = true, bool unsequenced = false) { var data = packet.GetBytes(); data = _blowfish.Encrypt(data); return(peer.Send(channel, data, reliable, unsequenced)); }
private bool SendEncrypted(Peer peer, ChannelID channel, BasePacket packet, bool reliable = true, bool unsequenced = false) { byte[] data; using (var stream = new MemoryStream()) { using (var writer = new PacketWriter(stream, true)) { packet.Write(writer); } data = stream.GetBuffer().Take((int)stream.Length).ToArray(); } data = _blowfish.Encrypt(data); return(peer.Send(channel, data, reliable, unsequenced)); }