Пример #1
0
        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);
                        }
                    }
                }
            }
        }
Пример #2
0
        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);
        }
Пример #3
0
        public unsafe static byte Strmake_StrGetcanshu(byte *buf, ref PosLaction poscode, ref PosLaction[] cancode, byte canshuqyt)
        {
            byte result;

            fixed(PosLaction *ptr = &poscode)
            {
                fixed(PosLaction *ptr2 = cancode)
                {
                    result = Strmake.Strmake_StrGetcanshu(buf, ptr, ptr2, canshuqyt);
                }
            }

            return(result);
        }
Пример #4
0
        public unsafe static ushort Strmake_StrSubstring(byte *buf, ref PosLaction bufpos, string val, byte starmod)
        {
            byte[] array = Kuozhan.Gethebingbytes(val.GetbytesssASCII(), "".GetbytesssASCII(1));
            ushort result;

            fixed(PosLaction *ptr = &bufpos)
            {
                fixed(byte *ptr2 = array)
                {
                    result = Strmake.Strmake_StrSubstring(buf, ptr, ptr2, starmod);
                }
            }

            return(result);
        }