public void Send(NetworkOutgoingMessage message, Action callback) { if (listener.IsAvailable(identifier)) { DataBlock block = new NetworkOutgoingBlock(memory.Data, offset, message.Length); SocketBuffer buffer = new SocketBuffer(memory.Data, offset, message.Length); message.ToBytes(block); encryptor?.Encrypt(memory.Data, offset, message.Length); offset += message.Length; parts.Add(offset); socket.Send(buffer, OnSent(callback)); } }
public void ToBytes(DataBlock block) { inner.ToBytes(block); key.Encrypt(block); }