Ejemplo n.º 1
0
    public static unsafe byte Commake_ScanComcode()
    {
        PosLaction laction;

        if ((NorComSta.runmod == 1) && (Commake_GetComm(&laction) > 0))
        {
            if (myapp.comcrc > 0)
            {
                uint num2;
                uint num = Kuozhan.CRC32(Comstrbuf + laction.star, Comstrbuf[laction.star - 1] - 4);
                Kuozhan.memcpy((byte *)&num2, Comstrbuf + (laction.end - 3), 4);
                laction.end = (ushort)(laction.end - 4);
                if (num != num2)
                {
                    myapp.errcode = 0x22;
                    Commake_SendBackerr(myapp.errcode);
                    return(1);
                }
            }
            if (CodeRun.Coderun_Run(Comstrbuf, &laction) == 1)
            {
                Commake_SendBacksuc();
            }
            else if (myapp.errcode < 0xff)
            {
                Commake_SendBackerr(myapp.errcode);
            }
            return(1);
        }
        return(0);
    }
Ejemplo n.º 2
0
Archivo: Hmi.cs Proyecto: skyclub66/HMI
        public unsafe static void Hmi_ScanHexCode()
        {
            PosLaction posLaction = default(PosLaction);
            strxinxi   strxinxi   = default(strxinxi);

            Readdata.Readdata_ReadStr(ref strxinxi, (int)Hmi.myapp.Hexstrindex);
            myappinf expr_28 = Hmi.myapp;

            expr_28.Hexstrindex += 1;
            if (strxinxi.size == 0 || strxinxi.size > 2048)
            {
                Hmi.Hmi_CodeEnd();
            }
            else
            {
                Readdata.SPI_Flash_Read(Hmi.Hexstrbuf, Hmi.myapp.app.strdataadd + strxinxi.addbeg, (uint)strxinxi.size);
                if (strxinxi.size == 1 && *Hmi.Hexstrbuf == 69)
                {
                    Hmi.Hmi_CodeEnd();
                }
                else
                {
                    posLaction.star = 0;
                    posLaction.end  = (ushort)(strxinxi.size - 1);
                    if (Hmi.myapp.upapp.runapptype == runapptype.run)
                    {
                        if (CodeRun.Coderun_Run(Hmi.Hexstrbuf, &posLaction) == 0 && Hmi.myapp.errcode < 255)
                        {
                            Commake.Commake_SendBackerr(Hmi.myapp.errcode);
                        }
                    }
                }
            }
        }
Ejemplo n.º 3
0
        // run.objedit
        public unsafe void Chonghuibmp()
        {
            List <byte[]> list = new List <byte[]>();

            byte[]     array      = new byte[1];
            PosLaction posLaction = default(PosLaction);

            try
            {
                if (this.runscr1.myapp.upapp.filesr != null)
                {
                    if (this.dobj.atts[0].zhi[0] == objtype.page)
                    {
                        lock (this.runscr1.myapp.upapp.Screenbm)
                        {
                            Graphics.FromImage(this.runscr1.myapp.upapp.Screenbm).Clear(Color.White);
                        }
                    }
                    else if (this.dobj.Mypage.mypage.pagelock == 0)
                    {
                        lock (this.runscr1.myapp.upapp.Screenbm)
                        {
                            Graphics.FromImage(this.runscr1.myapp.upapp.Screenbm).Clear(Color.FromArgb(0, 0, 0, 0));
                        }
                    }
                    this.runscr1.myapp.upapp.havetouming = false;
                    if (objtype.getobjmark(this.dobj.atts[0].zhi[0]).show == 0)
                    {
                        this.Ref();
                    }
                    else
                    {
                        if (this.dobj.myobj.redian.x < 0 || this.dobj.myobj.redian.endx >= this.Myapp.lcdwidth || this.dobj.myobj.redian.y < 0 || this.dobj.myobj.redian.endy >= this.Myapp.lcdheight)
                        {
                            this.thisbm          = new Bitmap(base.Width, base.Height);
                            this.BackgroundImage = null;
                        }
                        else
                        {
                            if (this.dobj.atts[0].zhi[0] < 50)
                            {
                                objxinxi myobj = this.dobj.myobj;
                                array           = new byte[128000];
                                myobj.attpos    = 0;
                                myobj.attposqyt = this.dobj.GetobjRambytes(ref array, 0);
                                array           = array.subbytes(0, (int)myobj.attposqyt);
                                array.BytesToptr(0, this.runscr1.myapp.mymerry);
                                array = new byte[1];
                                GuiObjControl.GuiObjControls[(int)this.dobj.atts[0].zhi[0]].Init(&myobj, (byte)this.dobj.objid);
                            }
                            else
                            {
                                this.dobj.Getbianji(ref list);
                                if (list.Count > 0)
                                {
                                    posLaction.star = 0;
                                    foreach (byte[] current in list)
                                    {
                                        try
                                        {
                                            fixed(byte *ptr = current)
                                            {
                                                posLaction.end = (ushort)(current.Length - 1);
                                                CodeRun.Coderun_Run(ptr, &posLaction);
                                            }
                                        }
                                        finally
                                        {
                                            byte *ptr = null;
                                        }
                                    }
                                }
                            }
                            if (this.dobj.Mypage.mypage.pagelock == 0)
                            {
                                this.thisbm = new Bitmap(base.Width, base.Height);
                                lock (this.runscr1.myapp.upapp.Screenbm)
                                {
                                    Graphics.FromImage(this.thisbm).DrawImage(this.runscr1.myapp.upapp.Screenbm, new Rectangle(0, 0, base.Width, base.Height), new Rectangle(base.Left, base.Top, base.Width, base.Height), GraphicsUnit.Pixel);
                                }
                                if (base.Parent != null && this.dobj.atts[0].zhi[0] == objtype.page)
                                {
                                    base.Visible = false;
                                    this.Ref();
                                }
                                else if (this.dobj.atts[0].zhi[0] != objtype.page)
                                {
                                    base.Visible = true;
                                    this.Ref();
                                }
                            }
                        }
                        if (this.dobj.Mypage.mypage.pagelock == 1)
                        {
                            base.Enabled = false;
                            if (this.dobj.atts[0].zhi[0] == objtype.page)
                            {
                                string text = "页面已锁定".Language();
                                this.thisbm = new Bitmap(this.runscr1.myapp.upapp.Screenbm.Width, this.runscr1.myapp.upapp.Screenbm.Height);
                                Graphics.FromImage(this.thisbm).Clear(Color.FromArgb(50, 72, 149, 253));
                                Graphics.FromImage(this.thisbm).FillRectangle(new SolidBrush(Color.White), (this.thisbm.Width - this.imageList1.Images[0].Width) / 2 - 20, (this.thisbm.Height - this.imageList1.Images[0].Height) / 2 - 20, this.imageList1.Images[0].Width + 40, this.imageList1.Images[0].Height + 40);
                                Graphics.FromImage(this.thisbm).DrawImage(this.imageList1.Images[0], (this.thisbm.Width - this.imageList1.Images[0].Width) / 2, (this.thisbm.Height - this.imageList1.Images[0].Height) / 2);
                                this.BackgroundImage = this.thisbm;
                                base.Visible         = true;
                            }
                            else
                            {
                                base.Visible = false;
                            }
                        }
                    }
                    if (this.runscr1.myapp.upapp.havetouming)
                    {
                        this.BackColor = Color.FromArgb(0, 0, 0, 0);
                    }
                    if (this.dobj.Mypage.mypage.pagelock == 1 && this.dobj.objid == this.dobj.Mypage.objs.Count - 1)
                    {
                        lock (this.runscr1.myapp.upapp.Screenbm)
                        {
                            this.thisbm = new Bitmap(this.runscr1.myapp.upapp.Screenbm.Width, this.runscr1.myapp.upapp.Screenbm.Height);
                            Graphics.FromImage(this.thisbm).DrawImage(this.runscr1.myapp.upapp.Screenbm, 0, 0);
                            this.runscr1.BackgroundImage = this.thisbm;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageOpen.Show("重绘控件出现错误 ".Language() + ex.Message);
            }
        }