public static void Send(Lidgren.Network.NetOutgoingMessage message, Canvas canvas, Palette pal) { using (var stream = new MemoryStream()) { Pablo.Save(stream, canvas, pal); stream.Flush(); stream.Seek(0, SeekOrigin.Begin); message.WriteVariableInt32(canvas.Width); message.WriteVariableInt32(canvas.Height); message.WritePadBits(); message.WriteStream((Stream)stream); } }