Ejemplo n.º 1
0
Archivo: Hmi.cs Proyecto: skyclub66/HMI
        public static unsafe void Hmi_Init()
        {
            strxinxi strxinxi = default(strxinxi);
            appinf0  appinf   = default(appinf0);

            Hmi.myapp.delay            = 0;
            Hmi.myapp.brush.sta        = 0;
            Hmi.myapp.brush.pointcolor = 0;
            Hmi.myapp.brush.backcolor  = 0;
            Hmi.myapp.brush.hangjux    = 0;
            Hmi.myapp.brush.hangjuy    = 0;
            Hmi.myapp.brush.xjuzhong   = 0;
            Hmi.myapp.brush.yjuzhong   = 0;
            Hmi.myapp.upapp.lcddev.wup = 255;
            Hmi.myapp.brush.pw         = 0;
            Hmi.myapp.paus             = 0;
            Hmi.myapp.sys.thsp         = 0;
            Hmi.myapp.sys.thsleepup    = 0;
            Hmi.myapp.sys.ussp         = 0;
            Hmi.myapp.touchsendxy      = 0;
            Hmi.myapp.errcode          = 255;
            Hmi.myapp.dpage            = 0;
            Hmi.myapp.Hexstrindex      = 65535;
            Hmi.myapp.downobjid        = 255;
            Hmi.myapp.moveobjstate     = 0;
            Hmi.Hmi_ClearTimer();
            Hmi.Hmi_Clearredian(0);
            Hmi.Hmi_ClearHexstr();
            Hmi.myapp.dpagemerrypos = 0;
            if (Hmi.myapp.binsuc != 1)
            {
                MessageOpen.Show("Data Error!");
            }
            else
            {
                Touch.TP_REST();
                Readdata.Readdata_ReadApp0(ref appinf);
                if (Hmi.myapp.app.strqyt > 0u)
                {
                    Readdata.Readdata_ReadStr(ref strxinxi, 0);
                    if (strxinxi.size < 8192)
                    {
                        Readdata.SPI_Flash_Read(Hmi.myapp.mymerry, Hmi.myapp.app.strdataadd + strxinxi.addbeg, (uint)strxinxi.size);
                        Hmi.myapp.ovemerrys = strxinxi.size;
                    }
                }
                Readdata.Readdata_ReadStr(ref strxinxi, 1);
                Hmi.myapp.pagenameseradd = strxinxi.addbeg + Hmi.myapp.app.strdataadd;
                Hmi.myapp.upapp.Lcd_Set(appinf.guidire);
                uint[] array = new uint[2];
                Hmi.lastpagenamecrc = array;
                Hmi.lastpageid      = new ushort[]
                {
                    65535,
                    65535
                };
                Hmi.lastobjaddr = new uint[]
                {
                    65535u,
                    65535u
                };
                array = new uint[2];
                Hmi.lastobjnamecrc = array;
                Hmi.lastobjid      = new ushort[]
                {
                    65535,
                    65535
                };
            }
        }
Ejemplo n.º 2
0
        public static byte Readdata_ReadBinapp()
        {
            byte[]  array  = new byte[4];
            appinf0 appinf = default(appinf0);
            byte    result;

            if (Readdata.Readdata_ReadApp0(ref appinf) == 0)
            {
                result = 0;
            }
            else
            {
                byte[] array2 = new byte[Marshal.SizeOf(default(appinf1))];
                Readdata.myapp.upapp.filesr.BaseStream.Position = 200L;
                Readdata.myapp.upapp.filesr.BaseStream.Read(array2, 0, Marshal.SizeOf(default(appinf1)));
                Readdata.myapp.upapp.filesr.BaseStream.Position = 396L;
                Readdata.myapp.upapp.filesr.BaseStream.Read(array, 0, 4);
                if ((uint)array.BytesTostruct(0u.GetType()) != array2.getcrc(4294967295u, 0, (int)Readdata.appxinxisize1))
                {
                    result = 0;
                }
                else
                {
                    array2             = array2.Appfree10(datasize.apppasseord, appinf.Modelcrc);
                    Readdata.myapp.app = (appinf1)array2.BytesTostruct(default(appinf1).GetType());
                    progform progform = null;
                    int      num      = 1;
                    int      num2     = 0;
                    if (Readdata.myapp.upapp.runapptype == runapptype.run && Readdata.myapp.upapp.images == null)
                    {
                        Readdata.myapp.upapp.images = new List <guiimagetype>();
                        if (Readdata.myapp.app.picqyt > 0)
                        {
                            num      = (int)(Readdata.myapp.app.zimodataadd - Readdata.myapp.app.picdataadd);
                            num2     = 0;
                            progform = new progform();
                            progform.Show();
                            Application.DoEvents();
                            Thread.Sleep(300);
                        }
                        for (int i = 0; i < (int)Readdata.myapp.app.picqyt; i++)
                        {
                            Picturexinxi pic = default(Picturexinxi);
                            Readdata.Readdata_ReadPic(ref pic, i);
                            guiimagetype item = default(guiimagetype);
                            item.imagebitbmp = new Bitmap((int)pic.W, (int)pic.H);
                            byte[] array3 = new byte[(int)(pic.W * pic.H * 2)];
                            Readdata.myapp.upapp.filesr.BaseStream.Position = (long)(pic.addbeg + Readdata.myapp.app.picdataadd);
                            Readdata.myapp.upapp.filesr.BaseStream.Read(array3, 0, array3.Length);
                            item.imagebitbmp = array3.GetBitmap(pic, datasize.Opentouming);
                            Readdata.myapp.upapp.images.Add(item);
                            num2 += (int)pic.imgbytesize;
                            progform.setprogval(num2 * 100 / num);
                            Application.DoEvents();
                        }
                        if (progform != null)
                        {
                            Application.DoEvents();
                            Thread.Sleep(300);
                            progform.Close();
                        }
                    }
                    result = 1;
                }
            }
            return(result);
        }