コード例 #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);
                }
            }
        }
コード例 #2
0
ファイル: Hmi.cs プロジェクト: 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);
        }