Example #1
0
File: Hmi.cs Project: 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);
                        }
                    }
                }
            }
        }
Example #2
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);
    }
Example #3
0
File: Hmi.cs Project: skyclub66/HMI
        public unsafe static ushort Hmi_GetPageid(byte *buf, PosLaction *bufpos)
        {
            byte[]     array      = new byte[14];
            PosLaction posLaction = default(PosLaction);
            ushort     result;

            if (buf[bufpos->star] == 112 && buf[bufpos->star + 1] == 91 && buf[bufpos->end] == 93)
            {
                posLaction.star = (ushort)(bufpos->star + 2);
                posLaction.end  = (ushort)(bufpos->end - 1);
                byte b;
                int  num = CodeRun.strgetS32(buf, &posLaction, &b);
                if (b == 0)
                {
                    result = 65535;
                }
                else
                {
                    result = (ushort)num;
                }
            }
            else
            {
                byte b = (byte)(bufpos->end - bufpos->star + 1);
                if (b > 14)
                {
                    result = 65535;
                }
                else
                {
                    fixed(byte *ptr = array)
                    {
                        Kuozhan.memcpy(ptr, buf + bufpos->star, (int)b);
                    }

                    uint num2 = array.getcrc(0);

                    if (num2 == Hmi.lastpagenamecrc[0])
                    {
                        result = Hmi.lastpageid[0];
                    }
                    else if (num2 == Hmi.lastpagenamecrc[1])
                    {
                        result = Hmi.lastpageid[1];
                    }
                    else
                    {
                        Hmi.lastpagenamecrc[0] = Hmi.lastpagenamecrc[1];
                        Hmi.lastpageid[0]      = Hmi.lastpageid[1];
                        Hmi.lastpagenamecrc[1] = num2;
                        uint num3 = Datafind.Datafind_FindU32_Flash(&num2, Hmi.myapp.pagenameseradd, Hmi.myapp.app.pageqyt, 6);
                        Hmi.lastpageid[1] = (ushort)num3;
                        result            = Hmi.lastpageid[1];
                    }
                }
            }
            return(result);
        }
Example #4
0
        public static void Main(string[] args)
        {
            // Each code module to run implenets the ICodeRunModule interface.
            // Built as a .NET Core class library dll and refernced by its
            // namespace. Call CodeRunModule using CodeRunFramework.run(CodeRunModule)

            var rm = new CodeRunModule();

            CodeRun.Run(rm);
        }
Example #5
0
 public static void GuidataAppinit()
 {
     Sysatt.initstsatt();
     CodeRun.Cominit();
     Attmake.attinit();
     guidatamake.xiliepaichucom64[0] = new ulong[]
     {
         "cfgpio\0\0".strtoU64()
     };
     guidatamake.xiliepaichucom32[0] = new uint[]
     {
         "repo".strtoU32(),
         "wepo".strtoU32(),
         "rept".strtoU32(),
         "wept".strtoU32()
     };
     guidatamake.xiliepaichuxitong32[0] = new uint[]
     {
         "rtc0".strtoU32(),
         "rtc1".strtoU32(),
         "rtc2".strtoU32(),
         "rtc3".strtoU32(),
         "rtc4".strtoU32(),
         "rtc5".strtoU32(),
         "pio0".strtoU32(),
         "pio1".strtoU32(),
         "pio2".strtoU32(),
         "pio3".strtoU32(),
         "pio4".strtoU32(),
         "pio5".strtoU32(),
         "rtc6".strtoU32(),
         "pio6".strtoU32(),
         "pio7".strtoU32(),
         "pwm4".strtoU32(),
         "pwm5".strtoU32(),
         "pwm6".strtoU32(),
         "pwm7".strtoU32(),
         "pwmf".strtoU32()
     };
 }
Example #6
0
 public IActionResult Run([FromBody] CodeParameter parameter)
 {
     return(new JsonResult(ResultHelper.GetOkResult(new { result = CodeRun.Start(parameter.Lang, parameter.Language, parameter.Code, parameter.Classname) })));
 }
Example #7
0
 static void Main(string[] args)
 {
     //CodeRun.Run(new CodeRunTry());
     CodeRun.Run(new CodeRunExample());
 }
Example #8
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);
            }
        }
Example #9
0
        static void Main(string[] args)
        {
            var wd = new WidgetCodeRun();

            CodeRun.Run(wd);
        }