Exemplo n.º 1
0
 private static unsafe byte Commake_Comyouxian(PosLaction *pos)
 {
     if (Strmake.Strmake_Makestr(Comstrbuf + pos->star, "runmod=", 7) == 1)
     {
         byte val = (byte)(Comstrbuf[pos->star + 7] - 0x30);
         switch (val)
         {
         case 0:
         case 1:
         case 2:
             Sysatt.Sysatt_SetXitongval(0x15, val);
             Commake_SendBacksuc();
             return(1);
         }
         return(0);
     }
     if (Strmake.Strmake_Makestr(Comstrbuf + pos->star, "com_st", 6) == 1)
     {
         if (Strmake.Strmake_Makestr(Comstrbuf + pos->star, "com_star", 8) == 1)
         {
             NorComSta.runmod = 1;
             return(1);
         }
         if (Strmake.Strmake_Makestr(Comstrbuf + pos->star, "com_stop", 8) == 1)
         {
             NorComSta.runmod = 0;
             return(1);
         }
     }
     return(0);
 }
Exemplo n.º 2
0
        public unsafe static ushort Strmake_StrSubstring(byte *buf, PosLaction *bufpos, byte *val, byte starmod)
        {
            ushort num  = bufpos->star;
            ushort num2 = 0;
            ushort result;

            while (num <= bufpos->end)
            {
                if (buf[num] == val[num2])
                {
                    num2 += 1;
                    if (val[num2] == 0)
                    {
                        result = num;
                        return(result);
                    }
                }
                else
                {
                    if (starmod == 0)
                    {
                        result = 65535;
                        return(result);
                    }
                    num2 = 0;
                }
                num += 1;
            }
            result = 65535;
            return(result);
        }
Exemplo n.º 3
0
        public unsafe static byte Strmake_StrGetcanshu(byte *buf, PosLaction *poscode, PosLaction *cancode, byte canshuqyt)
        {
            ushort     num = poscode->star;
            PosLaction posLaction;

            posLaction.end = poscode->end;
            byte result;

            if (canshuqyt == 0)
            {
                if (poscode->star > poscode->end)
                {
                    result = 1;
                }
                else
                {
                    result = 0;
                }
            }
            else
            {
                ushort num2 = 0;
                while (num2 < (ushort)canshuqyt)
                {
                    if (num > poscode->end)
                    {
                        result = 0;
                        return(result);
                    }
                    posLaction.star    = num;
                    cancode[num2].star = num;
                    num = Strmake.Findfenge(buf, &posLaction);
                    if (num == 65535)
                    {
                        if (num2 != (ushort)(canshuqyt - 1))
                        {
                            result = 0;
                            return(result);
                        }
                        cancode[num2].end = poscode->end;
                        result            = 1;
                        return(result);
                    }
                    else
                    {
                        if (num == cancode[num2].star)
                        {
                            result = 0;
                            return(result);
                        }
                        cancode[num2].end = (ushort)(num - 1);
                        num  += 1;
                        num2 += 1;
                    }
                }
                result = 0;
            }
            return(result);
        }
Exemplo n.º 4
0
Arquivo: Hmi.cs Projeto: 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);
        }
Exemplo n.º 5
0
        private unsafe static ushort Findfenge(byte *buf, PosLaction *bufPos)
        {
            ushort num = bufPos->star;
            byte   b   = 0;
            ushort result;

            while (num <= bufPos->end)
            {
                if (buf[num] < 9)
                {
                    num += 5;
                    if (num > bufPos->end)
                    {
                        result = 65535;
                        return(result);
                    }
                }
                if (buf[num] != 44 || b != 0)
                {
                    if (buf[num] == 34)
                    {
                        if (num == bufPos->star)
                        {
                            b = 1;
                        }
                        else if (buf[num - 1] != 92)
                        {
                            if (b == 0)
                            {
                                b = 1;
                            }
                            else
                            {
                                b = 0;
                            }
                        }
                    }
                    num += 1;
                    continue;
                }
                result = num;
                return(result);
            }
            result = 65535;
            return(result);
        }
Exemplo n.º 6
0
    public static unsafe byte Commake_GetComm(PosLaction *pos)
    {
        byte num = Comstrbuf[NorComSta.RdPos];

        if ((num == 0) && (NorComSta.RdPos > NorComSta.WrPos))
        {
            NorComSta.RdPos = 0;
            num             = Comstrbuf[NorComSta.RdPos];
        }
        if (num > 0)
        {
            pos->star       = (ushort)(NorComSta.RdPos + 1);
            pos->end        = (ushort)(NorComSta.RdPos + num);
            NorComSta.RdPos = (short)(NorComSta.RdPos + ((short)(num + 1)));
            if ((NorComSta.RdPos >= 0x400) || ((Comstrbuf[NorComSta.RdPos] == 0) && (NorComSta.RdPos > NorComSta.WrPos)))
            {
                NorComSta.RdPos = 0;
            }
            return(1);
        }
        return(0);
    }
Exemplo n.º 7
0
    public static unsafe void Attmake_GetAtt(byte *buf, PosLaction *bufpos, runattinf *att)
    {
        PosLaction laction = new PosLaction();
        pagexinxi  page    = new pagexinxi();
        strxinxi   str     = new strxinxi();
        uint       add     = 0;
        ushort     index   = 0;
        ushort     num5    = 0;
        ushort     num6    = 0;
        ushort     num7    = 0;

        att->datafrom = 0xff;
        att->isref    = 0;
        if (buf[bufpos->star] != 0x2e)
        {
            uint attdatapos;
            if (buf[bufpos->star] == 1)
            {
                Kuozhan.memcpy((byte *)&attdatapos, buf + (bufpos->star + 1), 4);
                attdatapos  = (uint)(attdatapos * datasize.attxinxisize);
                attdatapos += myapp.app.attdatapos;
            }
            else
            {
                for (uint i = bufpos->star; i <= bufpos->end; i++)
                {
                    if (buf[i] < 9)
                    {
                        i += 5;
                    }
                    if ((buf[i] == 0x2e) && (add != 1))
                    {
                        if (num6 == 0)
                        {
                            num6 = (ushort)i;
                            continue;
                        }
                        if (num7 == 0)
                        {
                            num7 = (ushort)i;
                            continue;
                        }
                        return;
                    }
                    if (buf[i] == 0x5b)
                    {
                        add = 1;
                    }
                    else if (buf[i] == 0x5d)
                    {
                        add = 2;
                    }
                }
                if (num6 == 0)
                {
                    Sysatt.Sysatt_GetSysname(buf + bufpos->star, (byte)((bufpos->end - bufpos->star) + 1), att);
                    return;
                }
                laction.star = bufpos->star;
                laction.end  = (ushort)(num6 - 1);
                if (num7 > 0)
                {
                    index = Hmi.Hmi_GetPageid(buf, &laction);
                    if (index == 0xffff)
                    {
                        return;
                    }
                    laction.star = (ushort)(num6 + 1);
                    laction.end  = (ushort)(num7 - 1);
                    if (index == myapp.dpage)
                    {
                        num5       = Hmi.Hmi_GetObjid(buf, &laction, myapp.dobjnameseradd, myapp.dpagexinxi.objqyt);
                        attdatapos = myapp.dpagexinxi.attdatapos;
                    }
                    else
                    {
                        Readdata.Readdata_ReadPage(ref page, index);
                        Readdata.Readdata_ReadStr(ref str, page.zhilingstar);
                        num5       = Hmi.Hmi_GetObjid(buf, &laction, str.addbeg + myapp.app.strdataadd, page.objqyt);
                        attdatapos = page.attdatapos;
                    }
                    laction.star = (ushort)(num7 + 1);
                }
                else
                {
                    index        = myapp.dpage;
                    num5         = Hmi.Hmi_GetObjid(buf, &laction, myapp.dobjnameseradd, myapp.dpagexinxi.objqyt);
                    laction.star = (ushort)(num6 + 1);
                    attdatapos   = myapp.dpagexinxi.attdatapos;
                }
                laction.end = bufpos->end;
                if ((num5 == 0xffff) || (laction.star > laction.end))
                {
                    return;
                }
                num6 = Attmake_GetAttindex(buf + laction.star, (byte)((laction.end - laction.star) + 1));
                if (num6 == 0xff)
                {
                    return;
                }
                if (index != myapp.dpage)
                {
                    add  = myapp.app.objadd + ((uint)(((ushort)(num5 + page.objstar)) * (datasize.objxinxisize + 180)));
                    num7 = 0;
                    Readdata.SPI_Flash_Read((byte *)&num7, add + 15, 1);
                    if (num7 != 1)
                    {
                        return;
                    }
                }
                else
                {
                    add = myapp.app.objadd + ((uint)(((ushort)(num5 + myapp.dpagexinxi.objstar)) * (datasize.objxinxisize + 180)));
                }
                Readdata.SPI_Flash_Read((byte *)&num6, (uint)((add + datasize.objxinxisize) + (num6 * 2)), 2);
                if (num6 == 0xffff)
                {
                    return;
                }
                attdatapos += (uint)(datasize.attxinxisize * num6);
            }
            add = myapp.app.strdataadd + attdatapos;
            Readdata.SPI_Flash_Read((byte *)&att->att, add, (uint)datasize.attxinxisize);
            att->attlei = (byte)(att->att.state & 15);
            if ((att->att.state & 0x10) > 0)
            {
                att->isxiugai = 1;
                att->datafrom = 0xfe;
                att->Pz       = myapp.mymerry + att->att.pos;
            }
            else
            {
                att->isxiugai = 0;
                if (att->attlei != attshulei.Sstr.typevalue)
                {
                    att->datafrom = 0xfd;
                }
                else
                {
                    att->datafrom = 0xfc;
                }
            }
            if ((att->att.state & 0x20) > 0)
            {
                att->isref = 1;
            }
            if (att->attlei != attshulei.Sstr.typevalue)
            {
                att->val = 0;
                if (att->datafrom == 0xfe)
                {
                    if (att->attlei == attshulei.SS16.typevalue)
                    {
                        short num8 = 0;
                        Kuozhan.memcpy((byte *)&num8, myapp.mymerry + att->att.pos, att->att.merrylenth);
                        att->val = num8;
                    }
                    else
                    {
                        Kuozhan.memcpy((byte *)&att->val, myapp.mymerry + att->att.pos, att->att.merrylenth);
                    }
                }
                else
                {
                    Kuozhan.memcpy((byte *)&att->val, (byte *)&att->att.pos, 4);
                }
            }
        }
    }
Exemplo n.º 8
0
    public static unsafe ushort Attmake_GetstrAtt(byte *buf, PosLaction *bufpos, runattinf *att)
    {
        ushort     star    = bufpos->star;
        ushort     num3    = 0;
        ushort     index   = 0;
        PosLaction laction = new PosLaction();

        att->datafrom = 0xff;
        att->isref    = 0;
        if (bufpos->end < bufpos->star)
        {
            myapp.errcode = 0x1a;
            return(0xffff);
        }
        if (buf[star] != 0x22)
        {
            if ((((buf[star] >= 9) || (buf[star] <= 1)) && (buf[star] != 0x2d)) && ((buf[star] <= 0x2f) || (buf[star] >= 0x3a)))
            {
                laction.star = bufpos->star;
                if (Strmake.Strmake_IsAttendbyte(buf[star]) == 1)
                {
                    myapp.errcode = 0x1a;
                    return(0xffff);
                }
                int num = 0;
                while (star <= bufpos->end)
                {
                    num3 = 0;
                    while (star <= bufpos->end)
                    {
                        if (buf[star] < 9)
                        {
                            num3 = (ushort)(num3 + 5);
                            star = (ushort)(star + 5);
                        }
                        if ((num == 0) && (Strmake.Strmake_IsAttendbyte(buf[star]) == 1))
                        {
                            star = (ushort)(star - 1);
                            break;
                        }
                        if (buf[star] == 0x5b)
                        {
                            num++;
                        }
                        else if (buf[star] == 0x5d)
                        {
                            num--;
                        }
                        if (num3 == 0x31)
                        {
                            myapp.errcode = 0x23;
                            return(0xffff);
                        }
                        num3 = (ushort)(num3 + 1);
                        star = (ushort)(star + 1);
                    }
                    if (star > bufpos->end)
                    {
                        star = bufpos->end;
                    }
                    laction.end = star;
                    Attmake_GetAtt(buf, &laction, att);
                    if (att->datafrom == 0xff)
                    {
                        myapp.errcode = 0x1a;
                        return(0xffff);
                    }
                    return(star);
                }
                myapp.errcode = 0x1a;
                return(0xffff);
            }
            if (buf[star] < 9)
            {
                if (buf[star] == 3)
                {
                    Kuozhan.memcpy((byte *)&att->val, buf + (star + 1), 4);
                    att->datafrom       = 0xfd;
                    att->att.merrylenth = 4;
                    att->attlei         = attshulei.SS32.typevalue;
                    att->isxiugai       = 0;
                }
                else if (buf[bufpos->star] == 2)
                {
                    att->datafrom = 0xfc;
                    Kuozhan.memcpy((byte *)&att->att.pos, buf + (bufpos->star + 1), 4);
                    att->att.state = attshulei.Sstr.typevalue;
                    att->isxiugai  = 0;
                }
                else if (buf[bufpos->star] == 4)
                {
                    Sysatt.Sysatt_GetXitongval(buf[bufpos->star + 1], buf[bufpos->star + 2], att);
                }
                return((ushort)(star + 4));
            }
            if (buf[star] == 0x2d)
            {
                star = (ushort)(star + 1);
            }
            while (star <= bufpos->end)
            {
                if ((buf[star] < 0x30) || (buf[star] > 0x39))
                {
                    star = (ushort)(star - 1);
                    break;
                }
                if (star == bufpos->end)
                {
                    break;
                }
                star = (ushort)(star + 1);
            }
        }
        else
        {
            buf[star] = 0;
            star      = (ushort)(star + 1);
            num3      = 0xffff;
            index     = star;
            while (star <= bufpos->end)
            {
                if (buf[star] == 0x5c)
                {
                    if (star == bufpos->end)
                    {
                        myapp.errcode = 0x20;
                        return(0xffff);
                    }
                    star = (ushort)(star + 1);
                    if ((buf[star] == 0x5c) || (buf[star] == 0x22))
                    {
                        buf[index] = buf[star];
                    }
                    else if (buf[star] == 0x72)
                    {
                        buf[index] = 13;
                        index      = (ushort)(index + 1);
                        buf[index] = 10;
                    }
                    else
                    {
                        myapp.errcode = 0x20;
                        return(0xffff);
                    }
                    if (star == bufpos->end)
                    {
                        myapp.errcode = 0x20;
                        return(0xffff);
                    }
                    star  = (ushort)(star + 1);
                    index = (ushort)(index + 1);
                }
                else
                {
                    buf[index] = buf[star];
                    if (buf[star] == 0x22)
                    {
                        buf[index] = 0;
                        num3       = star;
                        break;
                    }
                    star  = (ushort)(star + 1);
                    index = (ushort)(index + 1);
                }
            }
            if (num3 != 0xffff)
            {
                att->att.pos          = (ushort)(bufpos->star + 1);
                att->attlei           = attshulei.Sstr.typevalue;
                att->att.merrylenth   = (ushort)(index - bufpos->star);
                att->datafrom         = 0xfd;
                att->isxiugai         = 0;
                att->Pz               = buf + att->att.pos;
                att->att.encodeh_star = myapp.encodeh_star;
                return(num3);
            }
            myapp.errcode = 0x1a;
            return(0xffff);
        }
        att->val            = Strmake.Strmake_StrToS32(buf + bufpos->star, (byte)((star - bufpos->star) + 1));
        att->datafrom       = 0xfd;
        att->att.merrylenth = 4;
        att->attlei         = attshulei.SS32.typevalue;
        att->isxiugai       = 0;
        return(star);
    }