Exemple #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);
 }
Exemple #2
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);
                }
            }
        }
    }
Exemple #3
0
    private static unsafe byte SetAtt_gui(runattinf *b1, runattinf *b2, byte yunsuan)
    {
        if (b2->isxiugai == 1)
        {
            if (((b2->attlei != attshulei.Sstr.typevalue) && (b1->attlei != attshulei.Sstr.typevalue)) && (yunsuan == 0))
            {
                if (b2->datafrom == 0xfd)
                {
                    b2->val = b2->val;
                    return(1);
                }
                if ((b1->val > b2->att.maxval) || (b1->val < b2->att.minval))
                {
                    myapp.errcode = 0x1c;
                    return(0);
                }
                if (b2->datafrom == 0xfe)
                {
                    if (b2->att.merrylenth == 2)
                    {
                        if (b1->attlei == attshulei.UU16.typevalue)
                        {
                            ushort val = (ushort)b1->val;
                            Kuozhan.memcpy(b2->Pz, (byte *)&val, b2->att.merrylenth);
                        }
                        else
                        {
                            short num4 = (short)b1->val;
                            Kuozhan.memcpy(b2->Pz, (byte *)&num4, b2->att.merrylenth);
                        }
                    }
                    else
                    {
                        Kuozhan.memcpy(b2->Pz, (byte *)&b1->val, b2->att.merrylenth);
                    }
                    return(1);
                }
                switch (Sysatt.Sysatt_SetXitongval(b2->datafrom, b1->val))
                {
                case 1:
                    return(1);

                case 2:
                    myapp.errcode = 0xff;
                    return(0);
                }
            }
            else if (((b2->attlei == attshulei.Sstr.typevalue) && (b1->attlei == attshulei.Sstr.typevalue)) && (b2->datafrom == 0xfe))
            {
                ushort num3;
                ushort num  = Strmake.Strmake_GetStrlen(b1->Pz);
                ushort num2 = Strmake.Strmake_GetStrlen(b2->Pz);
                byte * pz   = b2->Pz;
                if (yunsuan == 0x2b)
                {
                    pz  += num2;
                    num3 = (ushort)((b2->att.merrylenth - num2) - 1);
                }
                else
                {
                    num3 = (ushort)(b2->att.merrylenth - 1);
                }
                if (num3 > num)
                {
                    num3 = num;
                }
                Kuozhan.memcpy(pz, b1->Pz, num3);
                pz[num3] = 0;
                return(1);
            }
        }
        myapp.errcode = 0x1c;
        return(0);
    }
Exemple #4
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);
    }