Ejemplo n.º 1
0
        public unsafe static void Sysatt_GetSysname(byte *name, byte lenth, runattinf *att)
        {
            if (lenth < 5)
            {
                uint num = 0u;
                Kuozhan.memcpy((byte *)(&num), name, (int)lenth);
                fixed(void *ptr = (&Sysatt.xitong32[0]))
                {
                    num = Datafind.Datafind_FindU32_Memory(&num, (uint *)ptr, Sysatt.xitong32qyt, (uint)(Marshal.SizeOf(default(xitongtype_32)) / 4));
                }

                if (num != 65535u)
                {
                    Sysatt.Sysatt_GetXitongval(4, (byte)num, att);
                }
            }
            else if (lenth < 9)
            {
                ulong num2 = 0uL;
                Kuozhan.memcpy((byte *)(&num2), name, (int)lenth);
                uint num;
                fixed(void *ptr = (&Sysatt.xitong64[0]))
                {
                    num = Datafind.Datafind_FindU64_Memory(&num2, (uint *)ptr, Sysatt.xitong64qyt, (uint)(Marshal.SizeOf(default(xitongtype_64)) / 4));
                }

                if (num != 65535u)
                {
                    Sysatt.Sysatt_GetXitongval(8, (byte)num, att);
                }
            }
        }
Ejemplo n.º 2
0
    private static unsafe byte Commake_CheckNorComOver()
    {
        byte num = 0;

        if (NorComSta.WrPos > NorComSta.RdPos)
        {
            if (NorComSta.WrPos > 0x3fa)
            {
                if (NorComSta.RdPos > (NorComSta.WrLen + 0x20))
                {
                    Comstrbuf[0] = 0;
                    Kuozhan.memcpy(Comstrbuf + 1, Comstrbuf + (NorComSta.WrPos - NorComSta.WrLen), NorComSta.WrLen);
                    NorComSta.WrPos = (short)(NorComSta.WrLen + 1);
                }
                else
                {
                    num = 1;
                }
            }
        }
        else if (NorComSta.WrPos > (NorComSta.RdPos - 6))
        {
            num = 1;
        }
        if (num > 0)
        {
            Commake_SendBackerr(0x24);
            NorComSta.WrPos = (short)(NorComSta.WrPos - NorComSta.WrLen);
            NorComSta.WrLen = 0;
            NorComSta.State = 4;
        }
        return(num);
    }
Ejemplo n.º 3
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.º 4
0
Archivo: Hmi.cs Proyecto: 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);
        }
Ejemplo n.º 5
0
    // hmitype.Attmake
    public unsafe static byte Attmake_GetAttindex(byte *name, byte lenth)
    {
        byte result;

        if (lenth < 5)
        {
            uint num = 0u;
            Kuozhan.memcpy((byte *)(&num), name, (int)lenth);
            fixed(void *ptr = Attmake.attstr32)
            {
                num = Datafind.Datafind_FindU32_Memory(&num, (uint *)ptr, 53u, (uint)(sizeof(attstrtype_32) / 4));
            }

            if (num == 65535u)
            {
                result = 255;
            }
            else
            {
                result = Attmake.attstr32[(int)((UIntPtr)num)].id;
            }
        }
        else if (lenth < 9)
        {
            ulong num2 = 0uL;
            Kuozhan.memcpy((byte *)(&num2), name, (int)lenth);
            uint num;
            fixed(void *ptr = Attmake.attstr64)
            {
                num = Datafind.Datafind_FindU64_Memory(&num2, (uint *)ptr, 11u, (uint)(sizeof(attstrtype_64) / 4));
            }

            if (num == 65535u)
            {
                result = 255;
            }
            else
            {
                result = Attmake.attstr64[(int)((UIntPtr)num)].id;
            }
        }
        else
        {
            result = 255;
        }
        return(result);
    }
Ejemplo n.º 6
0
        public unsafe static void Strmake_S32ToStr(int num, byte *buf, byte lenth, byte isend)
        {
            byte b = Strmake.Strmake_GetS32strlen(num);

            if (lenth == 0)
            {
                lenth = b;
            }
            if (num == -2147483648)
            {
                *buf = 45;
                buf++;
                byte[] array = "2147483648".GetbytesssASCII();
                fixed(byte *ptr = array)
                {
                    Kuozhan.memcpy(buf, ptr, (int)lenth);
                }

                if (isend == 1)
                {
                    buf[lenth] = 0;
                }
            }
            else
            {
                if (num < 0)
                {
                    num *= -1;
                    *buf = 45;
                    buf++;
                }
                byte b2;
                if (b > lenth)
                {
                    b2 = (byte)(b - lenth);
                    for (int i = 1; i <= (int)b2; i++)
                    {
                        num /= 10;
                    }
                    b2 += 1;
                }
                else
                {
                    b  = lenth;
                    b2 = 1;
                }
                for (int i = (int)b2; i <= (int)b; i++)
                {
                    if (num == 0)
                    {
                        buf[(int)b - i] = Strmake.u8tables[0];
                    }
                    else
                    {
                        buf[(int)b - i] = Strmake.u8tables[num % 10];
                    }
                    num /= 10;
                }
                if (isend == 1)
                {
                    buf[lenth] = 0;
                }
            }
        }
Ejemplo 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);
                }
            }
        }
    }
Ejemplo n.º 8
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);
    }
Ejemplo n.º 9
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);
    }