Пример #1
0
 private void checkBox_Click(object sender, EventArgs e)
 {
     if (this.tabControl1.SelectedTab != null && this.tabControl1.SelectedTab.Tag != null)
     {
         int num = this.tabControl1.SelectedTab.Tag.ToString().Getint();
         if (num == 4)
         {
             if (this.checkBox1.Checked)
             {
                 mobj expr_76_cp_0_cp_0 = this.dobj;
                 expr_76_cp_0_cp_0.myobj.redian.sendkey = Convert.ToByte(expr_76_cp_0_cp_0.myobj.redian.sendkey | 2);
             }
             else
             {
                 mobj expr_98_cp_0_cp_0 = this.dobj;
                 expr_98_cp_0_cp_0.myobj.redian.sendkey = Convert.ToByte((expr_98_cp_0_cp_0.myobj.redian.sendkey & 1));
             }
         }
         else if (num == 6)
         {
             if (this.checkBox1.Checked)
             {
                 mobj expr_D9_cp_0_cp_0 = this.dobj;
                 expr_D9_cp_0_cp_0.myobj.redian.sendkey = Convert.ToByte(expr_D9_cp_0_cp_0.myobj.redian.sendkey | 1);
             }
             else
             {
                 mobj expr_FB_cp_0_cp_0 = this.dobj;
                 expr_FB_cp_0_cp_0.myobj.redian.sendkey = Convert.ToByte(expr_FB_cp_0_cp_0.myobj.redian.sendkey & 2);
             }
         }
         this.changatt(this, null);
         this.refheadmsg();
     }
 }
Пример #2
0
        public int jiancechongdie(int x, int y, int endx, int endy, mobj paichuobj)
        {
            int result;

            if (x < 0 || y < 0 || endx < 0 || endy < 0)
            {
                result = -1;
            }
            else if (x >= (int)this.Myapp.lcdwidth || y >= (int)this.Myapp.lcdwidth || endx >= (int)this.Myapp.lcdwidth || endy >= (int)this.Myapp.lcdheight)
            {
                result = -1;
            }
            else
            {
                for (int i = this.objs.Count - 1; i > 0; i--)
                {
                    if (this.objs[i] != paichuobj && objtype.getobjmark(this.objs[i].myobj.objType).show == 1)
                    {
                        if ((int)this.objs[i].myobj.redian.x == x && (int)this.objs[i].myobj.redian.y == y && (int)this.objs[i].myobj.redian.endx == endx && (int)this.objs[i].myobj.redian.endy == endy)
                        {
                            result = i;
                            return(result);
                        }
                    }
                }
                result = 0;
            }
            return(result);
        }
Пример #3
0
 public void LoadObj(mobj obj)
 {
     if (objtype.getobjmark(obj.myobj.objType).show == 0)
     {
         this.LoadpanelObj___(obj);
     }
     else
     {
         this.LoadObj___(obj);
     }
 }
Пример #4
0
        private void LoadpanelObj___(mobj obj)
        {
            objedit objedit = new objedit();

            try
            {
                objedit.dobj     = obj;
                objedit.Location = new Point(5, 3);
                if (this.tobjs.Count > 0)
                {
                    Point panelLocation = this.tobjs[this.tobjs.Count - 1].GetPanelLocation();
                    panelLocation.X += 40;
                    objedit.Location = panelLocation;
                }
                objedit.Width                 = 0x23;
                objedit.Height                = 0x23;
                objedit.IsMove                = false;
                objedit.BackColor             = (obj.atts[0].zhi[0] == objtype.page) ? Color.FromArgb(0, 0x48, 0x95, 0xfd) : Color.FromArgb(50, 0x48, 0x95, 0xfd);
                objedit.ObjMousedown         += new EventHandler(this.T_objMousedown);
                objedit.ObjXYchang           += new EventHandler(this.T_objXYchang);
                objedit.ObjKeyDown           += new EventHandler(this.T_objKeyDown);
                objedit.Myapp                 = this.Myapp;
                objedit.runscr1               = this;
                objedit.BackgroundImageLayout = ImageLayout.None;
                this.objpanel.Controls.Add(objedit);
                objedit.Chonghuibmp();
                objedit.BringToFront();
                objedit.Visible = true;
                this.allobjedits.Add(objedit);
                if (!this.objpanel.Visible)
                {
                    if (this.objpanel.Height != 60)
                    {
                        this.objpanel.Height = 60;
                    }
                    this.objpanel.Visible = true;
                    if (this.Objpanelresize != null)
                    {
                        this.Objpanelresize(null, null);
                    }
                }
                this.tobjs.Add(objedit);
            }
            catch (Exception exception)
            {
                MessageOpen.Show("加载控件出现错误 ".Language() + exception.Message);
            }
        }
Пример #5
0
        public void addobj(mobj obj)
        {
            objsetcom item  = default(objsetcom);
            objsetcom item2 = default(objsetcom);

            if (this.dcomp0 != null)
            {
                item2.lei     = "addobj";
                item2.id      = 65535;
                item2.backobj = obj.copyobj();
                item.lei      = "delobj";
                item.id       = this.objs.Count;
                this.dcomp0.objset.Add(item);
                this.dcomp1.objset.Add(item2);
            }
            this.objs.Add(obj);
            this.Myapp.RefobjID(this);
        }
Пример #6
0
        private bool objjiance(mobj dobj)
        {
            bool result = true;

            if (dobj.myobj.redian.x < 0 || dobj.myobj.redian.endx >= this.Myapp.lcdwidth || dobj.myobj.redian.y < 0 || dobj.myobj.redian.endy >= this.Myapp.lcdheight)
            {
                this.Myapp.Addbianyierr(string.Concat(new string[]
                {
                    "页面:".Language(),
                    this.pagename,
                    " ",
                    "失败:".Language(),
                    dobj.objname,
                    " ",
                    "坐标无效".Language()
                }));
                result = false;
            }
            for (int i = 0; i < dobj.atts.Count; i++)
            {
                if (dobj.checkatt(dobj.atts[i]))
                {
                    string text = dobj.checkattval(dobj.atts[i]);
                    if (text != "")
                    {
                        this.Myapp.Addbianyierr(string.Concat(new string[]
                        {
                            "页面:".Language(),
                            this.pagename,
                            " ",
                            "失败:".Language(),
                            dobj.objname,
                            ".",
                            dobj.atts[i].name.Getstring(datasize.Myencoding),
                            " ",
                            "初始值无效:".Language(),
                            text
                        }));
                        result = false;
                    }
                }
            }
            return(result);
        }
Пример #7
0
        public void LoadAllObj()
        {
            string str = "";

            for (int i = 0; i < this.Myapp.pages[this.myapp.dpage].objs.Count; i++)
            {
                this.LoadObj(this.Myapp.pages[this.myapp.dpage].objs[i]);
                mobj mobj = this.Myapp.pages[this.myapp.dpage].objs[i];
                if ((objtype.getobjmark(mobj.myobj.objType).show == 1) && ((((mobj.myobj.redian.x < 0) || (mobj.myobj.redian.endx >= this.Myapp.lcdwidth)) || (mobj.myobj.redian.y < 0)) || (mobj.myobj.redian.endy >= this.Myapp.lcdheight)))
                {
                    str = str + mobj.objname + ",";
                }
            }
            if (str != "")
            {
                str = str.Substring(0, str.Length - 1);
                MessageOpen.Show("控件".Language() + ":" + str + " " + "超出显示区域范围,加载被取消".Language());
            }
        }
Пример #8
0
 public void insertobj(int index, mobj obj)
 {
     if (index < this.objs.Count)
     {
         objsetcom item  = default(objsetcom);
         objsetcom item2 = default(objsetcom);
         if (this.dcomp0 != null)
         {
             item2.lei     = "insertobj";
             item2.id      = index;
             item2.backobj = obj.copyobj();
             item.lei      = "delobj";
             item.id       = this.objs.Count;
             this.dcomp0.objset.Add(item);
             this.dcomp1.objset.Add(item2);
         }
         this.objs.Insert(index, obj);
         this.Myapp.RefobjID(this);
     }
 }
Пример #9
0
        public bool moveobjid(int index, int newindex)
        {
            bool result;

            if (index >= this.objs.Count || newindex >= this.objs.Count || index == newindex)
            {
                result = false;
            }
            else
            {
                objsetcom item  = default(objsetcom);
                objsetcom item2 = default(objsetcom);
                if (this.dcomp0 != null)
                {
                    this.dcomp0.Refpage = true;
                    this.dcomp1.Refpage = true;
                    item2.lei           = "moveobjid";
                    item2.id            = index;
                    item2.Tag           = newindex.ToString();
                    item.lei            = "moveobjid";
                    item.id             = newindex;
                    item.Tag            = index.ToString();
                    this.dcomp0.objset.Add(item);
                    this.dcomp1.objset.Add(item2);
                }
                mobj item3 = this.objs[index];
                this.objs.Remove(item3);
                if (newindex == this.objs.Count)
                {
                    this.objs.Add(item3);
                }
                else
                {
                    this.objs.Insert(newindex, item3);
                }
                this.Myapp.RefobjID(this);
                result = true;
            }
            return(result);
        }
Пример #10
0
 private void Close()
 {
     try
     {
         this.SaveCodes();
         this.dpage = null;
         this.dobj  = null;
         for (int i = 0; i < this.tabControl1.Tabs.Count; i++)
         {
             this.tabControl1.Tabs[i].Tag = null;
         }
         this.textBox1.Visible       = false;
         this.labetextBox1l1.Visible = false;
         this.label2.Visible         = false;
         this.checkBox1.Visible      = false;
         this.tabControl1.Visible    = false;
     }
     catch (Exception ex)
     {
         MessageOpen.Show("clear attoo errer" + ex.Message);
     }
 }
Пример #11
0
        private void LoadObj___(mobj obj)
        {
            objedit objedit = new objedit();

            try
            {
                objedit.dobj     = obj;
                objedit.Location = new Point(objedit.dobj.myobj.redian.x, objedit.dobj.myobj.redian.y);
                objedit.Width    = (objedit.dobj.myobj.redian.endx - objedit.dobj.myobj.redian.x) + 1;
                objedit.Height   = (objedit.dobj.myobj.redian.endy - objedit.dobj.myobj.redian.y) + 1;
                objedit.IsMove   = obj.atts[0].zhi[0] != objtype.page;
                if (objedit.Width < 3)
                {
                    objedit.Width = 3;
                }
                if (base.Height < 3)
                {
                    objedit.Height = 3;
                }
                objedit.BackColor     = (obj.atts[0].zhi[0] == objtype.page) ? Color.FromArgb(0, 0x48, 0x95, 0xfd) : Color.FromArgb(50, 0x48, 0x95, 0xfd);
                objedit.ObjMousedown += new EventHandler(this.T_objMousedown);
                objedit.ObjXYchang   += new EventHandler(this.T_objXYchang);
                objedit.ObjKeyDown   += new EventHandler(this.T_objKeyDown);
                objedit.Dragobj      += new EventHandler(this.T_dragobj);
                objedit.Moveobj      += new EventHandler(this.T_moveobj);
                objedit.Myapp         = this.Myapp;
                objedit.runscr1       = this;
                objedit.Visible       = true;
                base.Controls.Add(objedit);
                objedit.BringToFront();
                objedit.Chonghuibmp();
                this.allobjedits.Add(objedit);
            }
            catch (Exception exception)
            {
                MessageOpen.Show("加载控件出现错误 ".Language() + exception.Message);
            }
        }
Пример #12
0
 public void Refobj(Myapp_inf app, mpage page, mobj obj)
 {
     if (app == null || page == null || obj == null)
     {
         this.Close();
     }
     else
     {
         if (this.Myapp != null && this.dpage != null && this.dobj != null && this.textBox1.Visible)
         {
             if (this.Myapp == app && this.dpage == page && this.dobj == obj)
             {
                 return;
             }
         }
         if (this.textmsg1 == null)
         {
             this.textmsg1 = new textmsg(this.textBox1, 0);
             this.textBox1.Document.DocumentChanged  += new DocumentEventHandler(this.DocumentChanged);
             this.textBox1.Document.TextArea.KeyDown += new System.Windows.Forms.KeyEventHandler(this.Document_KeyDown);
         }
         this.textmsg1.Myapp = app;
         this.textmsg1.dpage = page;
         this.SaveCodes();
         this.issave = false;
         this.Myapp  = app;
         this.dpage  = page;
         this.dobj   = obj;
         this.refhead();
         if (this.tabControl1.SelectedTab != null && this.tabControl1.SelectedTab.Tag != null)
         {
             this.attload(this.tabControl1.SelectedTab.Tag.ToString().Getint());
         }
         this.issave = true;
     }
 }
Пример #13
0
        public static bool readdatathis(this Myapp_inf Myapp, StreamReader sr)
        {
            byte[]        array   = new byte[4];
            List <byte[]> list    = new List <byte[]>();
            appinf0       appinf  = default(appinf0);
            appinf1       appinf2 = default(appinf1);
            bool          result;

            try
            {
                sr.BaseStream.Position = 0L;
                byte[] array2 = new byte[datasize.appxinxisize0];
                sr.BaseStream.Read(array2, 0, datasize.appxinxisize0);
                appinf = (appinf0)array2.BytesTostruct(default(appinf0).GetType());
                if (appinf.banbenh > 0 || appinf.banbenl > 35)
                {
                    sr.BaseStream.Position = 196L;
                    sr.BaseStream.Read(array, 0, 4);
                    if ((uint)array.BytesTostruct(0u.GetType()) != array2.getcrc(4294967295u, 0, datasize.appxinxisize0))
                    {
                        result = false;
                        return(result);
                    }
                }
                if (appinf.banbenh == 0 && appinf.banbenl < 33)
                {
                    sr.BaseStream.Position = 0L;
                    array2 = new byte[datasize.appxinxisize0];
                    sr.BaseStream.Read(array2, 0, 16);
                    appinf = (appinf0)array2.BytesTostruct(default(appinf0).GetType());
                    sr.BaseStream.Position = 16L;
                    array2 = new byte[datasize.appxinxisize1];
                    sr.BaseStream.Read(array2, 0, 45);
                    appinf2 = (appinf1)array2.BytesTostruct(default(appinf1).GetType());
                }
                else
                {
                    sr.BaseStream.Position = 200L;
                    array2 = new byte[datasize.appxinxisize1];
                    sr.BaseStream.Read(array2, 0, datasize.appxinxisize1);
                }
                if (appinf.banbenh == 0 && appinf.banbenl > 32 && appinf.banbenl < 36)
                {
                    byte b    = (byte)appinf.Modelcrc;
                    byte mark = appinf.mark;
                    byte b2   = (byte)(appinf.Modelcrc >> 1);
                    byte b3   = (byte)(datasize.hmibiaoshiH >> 1);
                    for (int i = 0; i < 16; i++)
                    {
                        byte[] expr_249_cp_0 = array2;
                        int    expr_249_cp_1 = i;
                        expr_249_cp_0[expr_249_cp_1] ^= b3;
                        byte[] expr_261_cp_0 = array2;
                        int    expr_261_cp_1 = i;
                        expr_261_cp_0[expr_261_cp_1] ^= b2;
                        byte[] expr_279_cp_0 = array2;
                        int    expr_279_cp_1 = i;
                        expr_279_cp_0[expr_279_cp_1] ^= mark;
                        byte[] expr_291_cp_0 = array2;
                        int    expr_291_cp_1 = i;
                        expr_291_cp_0[expr_291_cp_1] ^= b;
                    }
                }
                else if (appinf.banbenh > 0 || appinf.banbenl > 35)
                {
                    if (appinf.filever < 3)
                    {
                        sr.BaseStream.Position = 396L;
                        sr.BaseStream.Read(array, 0, 4);
                        if ((uint)array.BytesTostruct(0u.GetType()) != array2.getcrc(4294967295u, 0, datasize.appxinxisize1 - 14))
                        {
                            result = false;
                            return(result);
                        }
                    }
                    else if (appinf.filever == 3)
                    {
                        sr.BaseStream.Position = 396L;
                        sr.BaseStream.Read(array, 0, 4);
                        if ((uint)array.BytesTostruct(0u.GetType()) != array2.getcrc(4294967295u, 0, datasize.appxinxisize1 - 12))
                        {
                            result = false;
                            return(result);
                        }
                    }
                    else if (appinf.filever < 17)
                    {
                        sr.BaseStream.Position = 396L;
                        sr.BaseStream.Read(array, 0, 4);
                        if ((uint)array.BytesTostruct(0u.GetType()) != array2.getcrc(4294967295u, 0, datasize.appxinxisize1 - 8))
                        {
                            result = false;
                            return(result);
                        }
                    }
                    else
                    {
                        sr.BaseStream.Position = 396L;
                        sr.BaseStream.Read(array, 0, 4);
                        if ((uint)array.BytesTostruct(0u.GetType()) != array2.getcrc(4294967295u, 0, datasize.appxinxisize1))
                        {
                            result = false;
                            return(result);
                        }
                    }
                }
                if (appinf.filever > 5 && appinf.filever < 10)
                {
                    array2 = array2.Appfree8(datasize.apppasseord);
                }
                else if (appinf.filever >= 10)
                {
                    array2 = array2.Appfree10(datasize.apppasseord, appinf.Modelcrc);
                }
                appinf2 = (appinf1)array2.BytesTostruct(default(appinf1).GetType());
                Myapp.images.Clear();
                sr.BaseStream.Position = (long)((ulong)appinf2.picxinxiadd);
                int j;
                for (j = 0; j < (int)appinf2.picqyt; j++)
                {
                    guiimagetype guiimagetype = default(guiimagetype);
                    array2 = new byte[datasize.picxinxisize];
                    sr.BaseStream.Read(array2, 0, datasize.picxinxisize);
                    guiimagetype.picturexinxi = (Picturexinxi)array2.BytesTostruct(default(Picturexinxi).GetType());
                    Myapp.images.Add(guiimagetype);
                }
                sr.BaseStream.Position = (long)((ulong)appinf2.picdataadd);
                for (j = 0; j < Myapp.images.Count; j++)
                {
                    guiimagetype guiimagetype = Myapp.images[j];
                    guiimagetype.imagebytes = new byte[guiimagetype.picturexinxi.imgbytesize];
                    sr.BaseStream.Read(guiimagetype.imagebytes, 0, guiimagetype.imagebytes.Length);
                    Myapp.images[j] = guiimagetype;
                }
                sr.BaseStream.Position = (long)((ulong)appinf2.zimoxinxiadd);
                Myapp.zimos.Clear();
                for (j = 0; j < (int)appinf2.zimoqyt; j++)
                {
                    array2 = new byte[datasize.zimoxinxisize];
                    sr.BaseStream.Read(array2, 0, datasize.zimoxinxisize);
                    zimoxinxi item = (zimoxinxi)array2.BytesTostruct(default(zimoxinxi).GetType());
                    Myapp.zimos.Add(item);
                }
                sr.BaseStream.Position = (long)((ulong)appinf2.zimodataadd);
                Myapp.zimodatas.Clear();
                for (j = 0; j < Myapp.zimos.Count; j++)
                {
                    array2 = new byte[Myapp.zimos[(int)((ushort)j)].size];
                    sr.BaseStream.Read(array2, 0, array2.Length);
                    Myapp.zimodatas.Add(array2);
                }
                sr.BaseStream.Position = (long)((ulong)appinf2.strxinxiadd);
                readdata0.strs.Clear();
                j = 0;
                while ((long)j < (long)((ulong)appinf2.strqyt))
                {
                    array2 = new byte[datasize.strxinxisize];
                    sr.BaseStream.Read(array2, 0, datasize.strxinxisize);
                    readdata0.strs.Add((strxinxi)array2.BytesTostruct(default(strxinxi).GetType()));
                    j++;
                }
                sr.BaseStream.Position = (long)((ulong)appinf2.strdataadd);
                readdata0.strbytes.Clear();
                for (j = 0; j < readdata0.strs.Count; j++)
                {
                    array2 = new byte[(int)readdata0.strs[(int)((ushort)j)].size];
                    sr.BaseStream.Read(array2, 0, array2.Length);
                    readdata0.strbytes.Add(array2);
                }
                sr.BaseStream.Position = (long)((ulong)appinf2.pageadd);
                readdata0.Lpages.Clear();
                for (j = 0; j < (int)appinf2.pageqyt; j++)
                {
                    array2 = new byte[datasize.pagexinxisize_up];
                    sr.BaseStream.Read(array2, 0, array2.Length);
                    readdata0.Lpages.Add((pagexinxi_up)array2.BytesTostruct(default(pagexinxi_up).GetType()));
                }
                sr.BaseStream.Position = (long)((ulong)appinf2.objadd);
                readdata0.Lobjs.Clear();
                for (j = 0; j < (int)appinf2.objqyt; j++)
                {
                    array2 = new byte[datasize.objxinxisize];
                    if (appinf.banbenh == 0 && appinf.banbenl < 33)
                    {
                        sr.BaseStream.Read(array2, 0, array2.Length - 8);
                        array2[array2.Length - 1] = array2[array2.Length - 8 - 1];
                        array2[array2.Length - 2] = array2[array2.Length - 8 - 2];
                        array2[array2.Length - 3] = array2[array2.Length - 8 - 3];
                        array2[array2.Length - 4] = array2[array2.Length - 8 - 4];
                    }
                    else
                    {
                        sr.BaseStream.Read(array2, 0, array2.Length);
                    }
                    readdata0.Lobjs.Add((objxinxi)array2.BytesTostruct(default(objxinxi).GetType()));
                }
                for (j = 0; j < Myapp.zimos.Count; j++)
                {
                    zimoxinxi value = Myapp.zimos[j];
                    if ((int)value.encode < datasize.encodes_App.Length)
                    {
                        if (value.ver == 0 || value.ver == 1)
                        {
                            if (value.encode == 0)
                            {
                                if (value.state == 0 && datasize.Language == 1)
                                {
                                    value.encode = (byte)((value.qyt < 100u) ? 1 : 3);
                                }
                                else
                                {
                                    value.encode = 2;
                                }
                            }
                            value.codelT0    = 255;
                            value.codelV0    = 0;
                            value.codeh_star = datasize.encodes_App[(int)value.encode].codeh_star;
                            value.codeh_end  = datasize.encodes_App[(int)value.encode].codeh_end;
                            value.codel_star = datasize.encodes_App[(int)value.encode].codel_star;
                            value.codel_end  = datasize.encodes_App[(int)value.encode].codel_end;
                        }
                        if (value.ver != 0)
                        {
                            value.ver = datasize.zikuver;
                        }
                        Myapp.zimos[j] = value;
                    }
                    else
                    {
                        Myapp.zimos.RemoveAt(j);
                        Myapp.zimodatas.RemoveAt(j);
                        j--;
                    }
                }
                if (appinf.banbenh == 0 && appinf.banbenl < 33)
                {
                    appinf2.encode = 0;
                    if (readdata0.strbytes.Count > 1)
                    {
                        string @string = Encoding.ASCII.GetString(readdata0.strbytes[1]);
                        if (@string.Length >= 7 && @string.Substring(0, 7) == "encode:")
                        {
                            appinf2.encode = readdata0.strbytes[1][7];
                        }
                    }
                    if ((appinf.old_screenw == 800 && appinf.old_screenh == 480) || (appinf.old_screenw == 480 && appinf.old_screenh == 272))
                    {
                        appinf.lcdscreenw = appinf.old_screenw;
                        appinf.lcdscreenh = appinf.old_screenh;
                        appinf.guidire    = appinf.old_lcddire;
                    }
                    else
                    {
                        appinf.lcdscreenw = appinf.old_screenh;
                        appinf.lcdscreenh = appinf.old_screenw;
                        appinf.guidire    = (byte)((appinf.old_lcddire == 0) ? 1 : 0);
                    }
                    Myapp.guidire = appinf.guidire;
                    new datazhuan(Myapp).ShowDialog();
                }
                Myapp.myencode = appinf2.encode;
                if (Myapp.myencode == 0 || (int)Myapp.myencode >= datasize.encodes_App.Length)
                {
                    Myapp.myencode = ((datasize.Language == 0) ? "gb2312".GetencodeId() : "iso-8859-1".GetencodeId());
                }
                datasize.Myencoding = Encoding.GetEncoding(datasize.encodes_App[(int)Myapp.myencode].encodename);
                Myapp.xilie         = (byte)((appinf.xilie > 2) ? 0 : appinf.xilie);
                Myapp.guidire       = appinf.guidire;
                Myapp.lcdwidth      = ((Myapp.guidire % 2 == 0) ? appinf.lcdscreenw : appinf.lcdscreenh);
                Myapp.lcdheight     = ((Myapp.guidire % 2 == 0) ? appinf.lcdscreenh : appinf.lcdscreenw);
                Myapp.Model         = datasize.Getmodelxinxi(appinf.Modelcrc, (int)Myapp.xilie);
                if (appinf.banbenh == 0 && appinf.banbenl < 30)
                {
                    datasize.Opentouming = false;
                    for (int k = 0; k < Myapp.images.Count; k++)
                    {
                        for (j = 0; j < Myapp.images[k].imagebytes.Length - 1; j += 2)
                        {
                            if ((ushort)Myapp.images[k].imagebytes[j] == datasize.Color_touming && Myapp.images[k].imagebytes[j + 1] == 0)
                            {
                                Myapp.images[k].imagebytes[j] = (byte)datasize.Color_toumingtihuan;
                            }
                        }
                    }
                }
                else
                {
                    datasize.Opentouming = false;
                }
                progform progform = null;
                int      num      = 1;
                int      num2     = 0;
                if (Myapp.images.Count > 0)
                {
                    progform = new progform();
                    num      = (int)(appinf2.zimodataadd - appinf2.picdataadd);
                    num2     = 0;
                    progform.Show();
                    Application.DoEvents();
                    Thread.Sleep(300);
                }
                for (int k = 0; k < Myapp.images.Count; k++)
                {
                    guiimagetype guiimagetype = Myapp.images[k];
                    if (appinf.filever > 6)
                    {
                        guiimagetype.imgxulie    = guiimagetype.imagebytes.subbytes((int)guiimagetype.picturexinxi.imgxuliebeg, (int)((long)guiimagetype.imagebytes.Length - (long)((ulong)guiimagetype.picturexinxi.imgxuliebeg)));
                        guiimagetype.imagebitbmp = (guiimagetype.imgxulie.BytesToClass() as Bitmap);
                        guiimagetype.imagebytes  = guiimagetype.imagebytes.subbytes(0, (int)guiimagetype.picturexinxi.imgxuliebeg);
                        guiimagetype.picturexinxi.imgbytesize = (uint)guiimagetype.imagebytes.Length;
                    }
                    else
                    {
                        guiimagetype.imagebitbmp = Myapp.images[k].imagebytes.GetBitmap(Myapp.images[k].picturexinxi, datasize.Opentouming);
                        guiimagetype.imgxulie    = guiimagetype.imagebitbmp.ClassToBytes();
                    }
                    Myapp.images[k] = guiimagetype;
                    num2           += (int)guiimagetype.picturexinxi.imgbytesize;
                    progform.setprogval(num2 * 100 / num);
                    Application.DoEvents();
                }
                if (progform != null)
                {
                    Application.DoEvents();
                    Thread.Sleep(300);
                    progform.Close();
                }
                Myapp.pages.Clear();
                for (int l = 0; l < readdata0.Lpages.Count; l++)
                {
                    mpage mpage = new mpage(Myapp);
                    if (readdata0.Lpages[l].objqyt == 0)
                    {
                        pagexinxi_up value2 = readdata0.Lpages[l];
                        value2.objqyt       = (byte)((ushort)value2.pagelock - value2.objstar + 1);
                        readdata0.Lpages[l] = value2;
                    }
                    if (appinf.banbenh == 0 && appinf.banbenl < 42)
                    {
                        pagexinxi_up value3 = readdata0.Lpages[l];
                        value3.pagelei      = 0;
                        value3.pagelock     = 0;
                        value3.password     = 0u;
                        readdata0.Lpages[l] = value3;
                    }
                    if (appinf.filever < 13)
                    {
                        pagexinxi_up value3 = readdata0.Lpages[l];
                        value3.password     = 0u;
                        readdata0.Lpages[l] = value3;
                    }
                    mpage.mypage   = readdata0.Lpages[l];
                    mpage.pagename = mpage.mypage.name.structToBytes().Getstring(datasize.Myencoding);
                    if (mpage.mypage.pagelei == 0 && mpage.pagename.ishefaname() != "")
                    {
                        mpage.pagename    = Myapp.getpagename_key(mpage.pagename);
                        mpage.mypage.name = (bytes_14)mpage.pagename.GetbytesssASCII(14).BytesTostruct(default(bytes_14).GetType());
                    }
                    if (mpage.mypage.objqyt > 0)
                    {
                        int num3 = (int)(mpage.mypage.objstar + (ushort)mpage.mypage.objqyt - 1);
                        for (j = (int)mpage.mypage.objstar; j <= num3; j++)
                        {
                            mobj mobj = new mobj(Myapp, mpage);
                            mobj.myobj   = readdata0.Lobjs[j];
                            mobj.objname = readdata0.Lobjs[j].name.structToBytes().Getstring(datasize.Myencoding);
                            list.Clear();
                            for (int m = (int)readdata0.Lobjs[j].zhilingstar; m < (int)(readdata0.Lobjs[j].zhilingend + 1); m++)
                            {
                                list.Add(readdata0.strbytes[m]);
                            }
                            if (appinf.filever < 5)
                            {
                                mobj.Putcodes(list, "end", appinf.filever);
                            }
                            else
                            {
                                mobj.Putcodes(list, "E", appinf.filever);
                            }
                            if (appinf.banbenh == 0 && appinf.banbenl < 36 && mobj.myobj.objType == objtype.Timer)
                            {
                                mobj.Codes[7].AddListString(mobj.Codes[2]);
                                mobj.Codes[2].Clear();
                            }
                            mpage.objs.Add(mobj);
                        }
                    }
                    mpage.objs[0].objname = mpage.pagename;
                    Myapp.pages.Add(mpage);
                }
                Myapp.RefAllID();
                if (appinf.banbenh == 0 && appinf.banbenl == 8)
                {
                    foreach (mpage current in Myapp.pages)
                    {
                        if (current.objs[0].atts.Count == 4 && current.objs[0].atts[2].name.Getstring(datasize.Myencoding) == "pco")
                        {
                            current.objs[0].atts[2].name = "bco".GetbytesssASCII(8);
                        }
                    }
                }
                result = true;
            }
            catch (Exception ex)
            {
                MessageOpen.Show(ex.Message);
                result = false;
            }
            return(result);
        }
Пример #14
0
        private static bool StructHtoL(this Myapp_inf Myapp, ref appinf0 app0, ref appinf1 app1)
        {
            dataput.strdatasize = 0;
            dataput.strbytes.Clear();
            dataput.strxinxis.Clear();
            dataput.pages_down.Clear();
            dataput.Lobjs.Clear();
            dataput.Lobjattdatapianyi.Clear();
            dataput.strbytes.Clear();
            dataput.LcCL_L.Clear();
            dataput.LcCL_S.Clear();
            byte[]        array = new byte[0];
            List <byte[]> list  = new List <byte[]>();
            List <byte[]> list2 = new List <byte[]>();
            pagexinxi     item  = default(pagexinxi);

            app0.lcdscreenw   = ((Myapp.guidire % 2 == 0) ? Myapp.lcdwidth : Myapp.lcdheight);
            app0.lcdscreenh   = ((Myapp.guidire % 2 == 0) ? Myapp.lcdheight : Myapp.lcdwidth);
            app0.guidire      = Myapp.guidire;
            app1.encode       = Myapp.myencode;
            app0.xilie        = Myapp.xilie;
            app0.old_screenw  = ((Myapp.lcdwidth > Myapp.lcdheight) ? Myapp.lcdwidth : Myapp.lcdheight);
            app0.old_screenh  = ((Myapp.lcdwidth > Myapp.lcdheight) ? Myapp.lcdheight : Myapp.lcdwidth);
            app0.old_lcddire  = 0;
            Myapp.xunhuanmark = 0;
            bool flag = true;

            array = new byte[256000];
            ushort num = 0;
            int    i;
            bool   result;

            if (dataput.bianyi == 1)
            {
                Myapp.databianyi.PrivateMemorys = new List <byte[]>();
                Myapp.Staticstring.Clear();
                for (i = 0; i < Myapp.pages.Count; i++)
                {
                    for (int j = 0; j < Myapp.pages[i].objs.Count; j++)
                    {
                        Myapp.pages[i].objs[j].myobj.merry   = Myapp.pages[i].objs[j].atts[1].zhi[0];
                        Myapp.pages[i].objs[j].myobj.objType = Myapp.pages[i].objs[j].atts[0].zhi[0];
                        if (Myapp.pages[i].objs[j].myobj.merry == 1)
                        {
                            Myapp.pages[i].objs[j].myobj.attpos = num;
                            int k = (int)Myapp.pages[i].objs[j].GetobjRambytes(ref array, (int)num);
                            Myapp.pages[i].objs[j].myobj.attposqyt = (ushort)k;
                            num += (ushort)k;
                        }
                    }
                }
                Myapp.databianyi.PublicMemorys = array.subbytes(0, (int)num);
                for (i = 0; i < Myapp.pages.Count; i++)
                {
                    array = new byte[256000];
                    num   = (ushort)(Marshal.SizeOf(default(pageobjs_)) * Myapp.pages[i].objs.Count);
                    for (int j = 0; j < Myapp.pages[i].objs.Count; j++)
                    {
                        new pageobjs_
                        {
                            vis        = 1,
                            touchstate = 1,
                            refFlag    = 1
                        }.structToBytes().CopyTo(array, j * Marshal.SizeOf(default(pageobjs_)));
                        Myapp.pages[i].objs[j].myobj.merry   = Myapp.pages[i].objs[j].atts[1].zhi[0];
                        Myapp.pages[i].objs[j].myobj.objType = Myapp.pages[i].objs[j].atts[0].zhi[0];
                        if (Myapp.pages[i].objs[j].myobj.merry == 0)
                        {
                            Myapp.pages[i].objs[j].myobj.attpos = (ushort)((int)num + Myapp.databianyi.PublicMemorys.Length);
                            int k = (int)Myapp.pages[i].objs[j].GetobjRambytes(ref array, (int)num);
                            Myapp.pages[i].objs[j].myobj.attposqyt = (ushort)k;
                            num += (ushort)k;
                        }
                    }
                    Myapp.databianyi.PrivateMemorys.Add(array.subbytes(0, (int)num));
                }
                dataput.Lstrbyteaddstring(Myapp.databianyi.PublicMemorys, false);
                if (!Myapp.Getpagenamecrcbytes(ref array))
                {
                    result = false;
                    return(result);
                }
                dataput.Lstrbyteaddstring(array, false);
                Myapp.addbianyisuc("全局内存占用:".Language() + Myapp.databianyi.PublicMemorys.Length.ToString());
                Myapp.addbianyisuc("图片总大小:".Language() + Myapp.Getallimgsize(1).ToString("000,000"));
                Myapp.addbianyisuc("字库总大小:".Language() + Myapp.Getallzimosize(true).ToString("000,000"));
                Application.DoEvents();
                int num2 = 0;
                for (i = 0; i < Myapp.pages.Count; i++)
                {
                    Myapp.pages[i].attpos = (uint)num2;
                    Myapp.pages[i].refallatt();
                    num2 += Myapp.pages[i].allattnames.Count;
                }
            }
            i = 0;
            while (i < Myapp.pages.Count)
            {
                Myapp.systimers.Clear();
                if (dataput.bianyi != 1)
                {
                    goto IL_6A5;
                }
                if (Myapp.pages[i].bianyi())
                {
                    goto IL_6A5;
                }
                flag = false;
IL_ABF:
                i++;
                continue;
IL_6A5:
                Application.DoEvents();
                list.Add(Myapp.pages[i].pagename.GetbytesssASCII(15));
                if (dataput.bianyi == 1)
                {
                    item         = default(pagexinxi);
                    item.objqyt  = (byte)Myapp.pages[i].objs.Count;
                    item.objstar = (ushort)dataput.Lobjs.Count;
                }
                else
                {
                    Myapp.pages[i].mypage.name    = (bytes_14)Myapp.pages[i].pagename.GetbytesssASCII(14).BytesTostruct(default(bytes_14).GetType());
                    Myapp.pages[i].mypage.objstar = (ushort)dataput.Lobjs.Count;
                    Myapp.pages[i].mypage.objqyt  = (byte)Myapp.pages[i].objs.Count;
                }
                if (Myapp.pages[i].objs.Count > 0)
                {
                    for (int j = 0; j < Myapp.pages[i].objs.Count; j++)
                    {
                        mobj mobj = Myapp.pages[i].objs[j];
                        mobj.myobj.name = (bytes_14)mobj.objname.GetbytesssASCII(14).BytesTostruct(default(bytes_14).GetType());
                        list2.Clear();
                        if (dataput.bianyi == 1)
                        {
                            if (!mobj.BianyiCodes(ref list2))
                            {
                                result = false;
                                return(result);
                            }
                        }
                        else
                        {
                            mobj.Getcodes(ref list2);
                        }
                        if (list2.Count > 0)
                        {
                            mobj.myobj.zhilingstar = (ushort)dataput.strxinxis.Count;
                            dataput.strdatasize.structToBytes().CopyTo(mobj.attstrpianyi, 0);
                            for (int k = 0; k < list2.Count; k++)
                            {
                                dataput.Lstrbyteaddstring(list2[k], true);
                            }
                            mobj.myobj.zhilingend = (ushort)((int)mobj.myobj.zhilingstar + list2.Count - 1);
                        }
                        else
                        {
                            MessageOpen.Show("检测到控件代码为0,保存的资源文件可能会出现异常".Language());
                            mobj.myobj.zhilingstar = 65535;
                            mobj.myobj.zhilingend  = 65535;
                        }
                        dataput.Lobjs.Add(mobj.myobj);
                        dataput.Lobjattdatapianyi.Add(mobj.attstrpianyi);
                    }
                }
                else if (dataput.bianyi == 1)
                {
                    item.objstar = 65535;
                }
                else
                {
                    Myapp.pages[i].mypage.objstar = 65535;
                }
                if (dataput.bianyi == 1)
                {
                    item.zhilingstar = (ushort)dataput.strxinxis.Count;
                    for (int k = 0; k < Myapp.pages[i].Codes.Count; k++)
                    {
                        dataput.Lstrbyteaddstring(Myapp.pages[i].Codes[k], true);
                    }
                    item.zhilingqyt = (ushort)(dataput.strxinxis.Count - (int)item.zhilingstar);
                    dataput.pages_down.Add(item);
                }
                if (Myapp.systimers.Count > 6)
                {
                    Myapp.Addbianyierr("页面:".Language() + Myapp.pages[i].pagename + " " + "失败! 系统定时任务数量不能超过6条".Language());
                    result = false;
                    return(result);
                }
                goto IL_ABF;
            }
            if (dataput.bianyi == 1)
            {
                dataput.makestrsbytes();
            }
            if (!flag)
            {
                result = flag;
            }
            else
            {
                if (dataput.bianyi == 1)
                {
                    app1.staticstringbeg = (uint)dataput.strdatasize;
                    if (Myapp.Staticstring.Count > 0)
                    {
                        byte[] array2 = new byte[Myapp.getstaticstringdataqyt()];
                        int    num3   = 0;
                        foreach (byte[] array3 in Myapp.Staticstring)
                        {
                            array3.CopyTo(array2, num3);
                            num3 += array3.Length;
                        }
                        dataput.Lstrbyteaddstring(array2, false);
                    }
                    app1.attdatapos = (uint)dataput.strdatasize;
                    for (i = 0; i < Myapp.pages.Count; i++)
                    {
                        pagexinxi value = dataput.pages_down[i];
                        value.attdatapos      = (uint)dataput.strdatasize;
                        dataput.pages_down[i] = value;
                        dataput.Lstrbyteaddstring(Myapp.pages[i].allattbytes, false);
                    }
                }
                app0.Modelcrc   = Myapp.Model.Modelcrc;
                app1.pageqyt    = (ushort)Myapp.pages.Count;
                app1.objqyt     = (ushort)dataput.Lobjs.Count;
                app1.zimoqyt    = (ushort)Myapp.zimos.Count;
                app1.picqyt     = (ushort)Myapp.images.Count;
                app1.picdataadd = 400u;
                if (dataput.bianyi == 1)
                {
                    app1.picdataadd = 4096u;
                }
                app1.zimodataadd = (uint)((ulong)app1.picdataadd + (ulong)((long)Myapp.Getallimgsize(dataput.bianyi)));
                app1.strdataadd  = (uint)((ulong)app1.zimodataadd + (ulong)((long)Myapp.Getallzimosize(false)));
                if (dataput.bianyi == 1)
                {
                    uint num4 = app1.strdataadd % 4096u;
                    if (num4 != 0u)
                    {
                        app1.strdataadd += 4096u - num4;
                    }
                }
                app0.hexaddr       = (uint)((ulong)app1.strdataadd + (ulong)((long)dataput.strdatasize));
                app0.oldgujianqyt  = 0u;
                app0.driverqyt     = 0u;
                app0.hexlenth      = 0u;
                app0.syscomqyt     = 0u;
                app1.inputdatasize = 0;
                if (dataput.bianyi == 1)
                {
                    StreamReader streamReader = new StreamReader(Application.StartupPath + "\\asp" + app0.xilie.ToString() + ".dll");
                    hexhead      hexhead      = default(hexhead);
                    byte[]       array3       = new byte[Marshal.SizeOf(default(hexhead))];
                    streamReader.BaseStream.Read(array3, 0, array3.Length);
                    hexhead           = (hexhead)array3.BytesTostruct(default(hexhead).GetType());
                    app0.oldgujianadd = hexhead.F030addr + app0.hexaddr;
                    app0.oldgujianqyt = hexhead.F030datalenth;
                    app0.hexlenth     = (uint)streamReader.BaseStream.Length;
                    streamReader.BaseStream.Close();
                    streamReader.Close();
                    streamReader.Dispose();
                    if (hexhead.headver != datasize.lcdbinver)
                    {
                        MessageOpen.Show("asp.dll文件与程序不匹配".Language() + datasize.lcdbinver.ToString() + "-" + hexhead.headver.ToString());
                        Application.Exit();
                        result = false;
                        return(result);
                    }
                    streamReader   = new StreamReader(Application.StartupPath + "\\cd" + app0.xilie.ToString() + ".dll");
                    app0.driverqyt = (uint)streamReader.BaseStream.Length;
                    byte[] array4 = new byte[1];
                    streamReader.BaseStream.Position = 0L;
                    streamReader.BaseStream.Read(array4, 0, 1);
                    streamReader.Close();
                    streamReader.Dispose();
                    if (array4[0] != datasize.lcddriverver)
                    {
                        MessageOpen.Show("cd" + app0.xilie.ToString() + ".dll ver is Error:" + array4[0].ToString());
                        result = false;
                        return(result);
                    }
                    streamReader   = new StreamReader(Application.StartupPath + "\\syscom.bin");
                    app0.syscomqyt = (uint)streamReader.BaseStream.Length;
                    streamReader.Close();
                    streamReader.Dispose();
                    streamReader       = new StreamReader(Application.StartupPath + "\\input.bin");
                    app1.inputdatasize = (ushort)streamReader.BaseStream.Length;
                    array4             = new byte[2];
                    streamReader.BaseStream.Position = 0L;
                    streamReader.BaseStream.Read(array4, 0, array4.Length);
                    app1.inputqyts = (ushort)array4.BytesTostruct(0.GetType());
                    streamReader.Close();
                    streamReader.Dispose();
                }
                app0.driveradd = app0.hexaddr + app0.hexlenth;
                app0.syscomadd = app0.driveradd + app0.driverqyt;
                app1.inputpos  = app0.syscomadd + app0.syscomqyt;
                app1.pageadd   = app1.inputpos + (uint)app1.inputdatasize;
                if (dataput.bianyi == 1)
                {
                    app1.objadd = (uint)((ulong)app1.pageadd + (ulong)((long)(dataput.pages_down.Count * datasize.pagexinxisize)));
                }
                else
                {
                    app1.objadd = (uint)((ulong)app1.pageadd + (ulong)((long)(Myapp.pages.Count * datasize.pagexinxisize_up)));
                }
                app1.picxinxiadd  = (uint)((ulong)app1.objadd + (ulong)((long)((int)app1.objqyt * (datasize.objxinxisize + ((dataput.bianyi == 1) ? 180 : 0)))));
                app1.strxinxiadd  = (uint)((ulong)app1.picxinxiadd + (ulong)((long)(datasize.picxinxisize * (int)app1.picqyt)));
                app1.strqyt       = (uint)dataput.strxinxis.Count;
                app1.zimoxinxiadd = (uint)((ulong)app1.strxinxiadd + (ulong)((long)(datasize.strxinxisize * dataput.strxinxis.Count)));
                app0.datasize     = (uint)((ulong)app1.zimoxinxiadd + (ulong)((long)(datasize.zimoxinxisize * (int)app1.zimoqyt)));
                if (dataput.bianyi == 0)
                {
                    Myapp.codeqyt[0] = Myapp.Getallstrxinxiqyt();
                    if (Myapp.codeqyt[0] > 65534)
                    {
                        MessageOpen.Show("源代码总数超过最大限制(当前使用:".Language() + dataput.strbytes.Count.ToString("000,000") + "最大限制:65534)".Language());
                        result = false;
                        return(result);
                    }
                }
                else
                {
                    Myapp.codeqyt[1] = Myapp.Getallstrxinxiqyt();
                    if (Myapp.codeqyt[1] > 65534)
                    {
                        Myapp.Addbianyierr("编译代码总数超过最大限制(当前使用:".Language() + dataput.strbytes.Count.ToString("000,000") + "最大限制:65534)".Language());
                        result = false;
                        return(result);
                    }
                }
                result = flag;
            }
            return(result);
        }