Exemplo n.º 1
0
        public void MONITOR(MainForm f, out bool wait_for_instruction)
        {
            var buf = Read(MessagesSizes[eInstruction.MONITOR]);

            wait_for_instruction = false;

            byte   cpu    = buf[0];
            UInt32 ramuse = BitConverter.ToUInt32(buf, 1);
            UInt32 rammax = BitConverter.ToUInt32(buf, 5);

            f.Invoke(f.Monitor, new object[] { cpu, ramuse, rammax });
        }
Exemplo n.º 2
0
        public void WriteLog(string text)
        {
            if (_form.InvokeRequired)
            {
                Action <string> m = WriteLog;
                _form.Invoke(m, text);
                return;
            }

            string time = $"[{DateTime.Now.ToString("HH:mm:ss")}] ";

            _log.Items.Add(time + text);
        }
Exemplo n.º 3
0
        public void RESULT(MainForm f, out bool wait_for_instruction)
        {
            var buf = Read(MessagesSizes[eInstruction.RESULT]);

            wait_for_instruction = false;

            UInt16 Src   = BitConverter.ToUInt16(buf, 2);
            UInt16 X     = BitConverter.ToUInt16(buf, 4);
            UInt16 Y     = BitConverter.ToUInt16(buf, 6);
            Int32  color = BitConverter.ToInt32(buf, 8);

            f.Invoke(f.DrawPixel, new object[] { Src, X, Y, System.Drawing.Color.FromArgb(color) });
        }
Exemplo n.º 4
0
        private void Disconnect()
        {
            this.CancelAsync();
            if (this.Offline == true)
            {
                return;
            }
            Connection.clientId = 0xffff;

            this.Connection.Disconnect();
            _form.toolStripStatusLabel.Text  = "Disconnected";
            _form.toolStripStatusLabel.Image = Properties.Resources.red;

            try
            {
                _form.Invoke(_form.Connect);
            }
            catch (Exception)
            { }
        }
Exemplo n.º 5
0
        public void CHUNKRESULT(MainForm f, out bool wait_for_instruction)
        {
            var bufhead = Read(MessagesSizes[eInstruction.CHUNKRESULT]);

            wait_for_instruction = false;

            UInt16 Src  = BitConverter.ToUInt16(bufhead, 2);
            UInt16 MinX = BitConverter.ToUInt16(bufhead, 4);
            UInt16 MinY = BitConverter.ToUInt16(bufhead, 6);
            byte   W    = bufhead[8];
            byte   H    = bufhead[9];

            int s = W * H * sizeof(UInt32);

            // dirty
            while (con.Available < s)
            {
            }

            var bufpels = Read((uint)(s));

            f.Invoke(f.DrawChunk, new object[] { Src, W, H, MinX, MinY, bufpels });
        }