Beispiel #1
0
        public static Canvas Receive(Lidgren.Network.NetIncomingMessage message, Palette pal)
        {
            var width  = message.ReadVariableInt32();
            var height = message.ReadVariableInt32();

            message.ReadPadBits();
            var stream = message.ReadStream();

            var canvas = new MemoryCanvas(new Size(width, height));

            Pablo.Load(stream, canvas, pal);
            return(canvas);
        }
Beispiel #2
0
        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);
            }
        }
        public override void Receive(ReceiveCommandArgs args)
        {
            base.Receive(args);
            ICEColours = args.Message.ReadBoolean();
            Use9x      = args.Message.ReadBoolean();
            DosAspect  = args.Message.ReadBoolean();
            var page       = Pages[0];
            var canvasSize = args.Message.ReadSize();

            args.Message.ReadPadBits();
            page.Canvas.ResizeCanvas(canvasSize, false);
            var stream = args.Message.ReadStream();
            var type   = new Types.Pablo(Info);

            resizeCanvas = !EditMode;
            type.Load(stream, this, null);
            if (Use9x)
            {
                SetFont(false);
            }
        }
        public override bool Send(SendCommandArgs args)
        {
            base.Send(args);
            args.Message.Write(ICEColours);
            args.Message.Write(Use9x);
            args.Message.Write(DosAspect);
            var page = Pages[0];

            args.Message.Write(page.Canvas.Size);
            args.Message.WritePadBits();
            using (var stream = new MemoryStream())
            {
                var type = new Types.Pablo(Info);
                type.Save(stream, this);
                stream.Flush();
                stream.Seek(0, SeekOrigin.Begin);

                args.Message.WriteStream(stream);
            }
            return(true);
        }