private void Document_TextKeyPress(object sender, DocumentEventArgs e) { try { if (this.textevent) { Keys keys = (Keys)sender; if (this.Listm1 != null && this.Listm1.vis) { if (keys == Keys.Return || keys == Keys.Up || keys == Keys.Down || keys == Keys.Left || keys == Keys.Right || keys == Keys.Escape) { this.KeySendPress(keys); e.TextCancle = true; } } else if (this.Topm1 != null && this.Topm1.vis) { if (keys == Keys.Escape) { this.Topm1.vis = false; e.TextCancle = true; } } } } catch (Exception ex) { MessageOpen.Show(ex.Message); } }
private void DocumentCaretPositionChanged(object sender, EventArgs e) { try { if (this.textevent) { if (!this.timershow.Enabled || this.showstate != 0) { if (this.Topm1.vis && !this.Listm1.vis && this.showstate == 1) { while (this.timerlock) { } this.timershow.Enabled = false; this.timershow.Interval = 50; this.timershow.Enabled = true; this.showstate = 1; } else { this.closemessageshow(); } } } } catch (Exception ex) { MessageOpen.Show(ex.Message); } }
private void DocumentMouseMove(object sender, MouseEventArgs e) { try { if (this.textevent) { if (this.textBox1.Document.TextArea.Focused) { int num = e.X - this.mousemovepos.X; int num2 = e.Y - this.mousemovepos.Y; if (num > 3 || num < -3 || num2 > 3 || num2 < -3) { this.mousemovepos = e.Location; if (!this.Listm1.vis) { if (!this.Topm1.vis || this.showstate == 2) { while (this.timerlock) { } this.timershow.Enabled = false; this.timershow.Interval = 500; this.timershow.Enabled = true; this.showstate = 2; } } } } } } catch (Exception ex) { MessageOpen.Show(ex.Message); } }
private static void getvertime() { Win32.timeBeginPeriod(1); int i = Win32.getver_retry; int num = Win32.getvershorttime; Win32.findchaotime = Win32.getverlongtime; int num2 = 100; try { while (i >= 0) { int j = 0; Thread thread = new Thread(new ThreadStart(Win32.findver)); thread.Start(); while (j < Win32.findchaotime) { Thread.Sleep(num2); if (!thread.IsAlive && j > num) { i = -1; break; } j += num2; } if (thread.IsAlive) { thread.Abort(); } i--; Win32.findchaotime = Win32.getver_retrytime; } } catch (Exception ex) { MessageOpen.Show(ex.Message); } if (datasize.dowloadurl == "") { if (Win32.getvertishi_ok) { MessageOpen.Show("当前版本已是最新版本!".Language()); } } else if (datasize.dowloadurl == "err") { if (Win32.getvertishi_err) { MessageOpen.Show("服务器连接失败,无法检测最新版本,请检查你的网络连接,以确保你使用的是最新的HMI编辑软件".Language()); } } else if (Win32.getverautoshowdown) { new download(datasize.dowloadurl).ShowDialog(); } datasize.findendstate = true; }
public unsafe static void SPI_Flash_Read(byte *bt1, uint add, uint qyt) { try { byte[] array = new byte[qyt]; Readdata.myapp.upapp.filesr.BaseStream.Position = (long)((ulong)add); Readdata.myapp.upapp.filesr.BaseStream.Read(array, 0, (int)qyt); array.BytesToptr(bt1); } catch (Exception ex) { MessageOpen.Show(ex.Message); } }
private void timershow_Tick(object sender, EventArgs e) { try { this.timerlock = true; this.timershow.Enabled = false; this.KeywordoffsetChange(); this.textBox1.Focus(); this.timerlock = false; } catch (Exception ex) { MessageOpen.Show(ex.Message); } }
public void KeyWordChange(string str, mpage dpage, Point point, bool isnewline, int thisline, byte state) { try { this.showstate = state; if (str == null || str == "" || str.Length > 50) { this.Topm1.vis = false; this.Listm1.vis = false; } else if (state == 1) { this.Listm1.vis = false; if ((!this.Topm1.vis || this.showline == thisline) && this.CheckComShow(str, point, (int)state)) { this.showline = thisline; } else { this.Topm1.vis = false; } } else if (state == 2) { this.Listm1.vis = false; if (this.CheckComShow(str, point, (int)state)) { this.showline = thisline; } else { this.Topm1.vis = false; } } else { this.Topm1.vis = false; if (this.CheckKewordShow(str, dpage, point, isnewline)) { this.showline = thisline; } } } catch (Exception ex) { MessageOpen.Show(ex.Message); } }
public static string getxiangqingstring(string id) { string text = php.GethttpBack("http://bbs.tjc1688.com/hmi/ajax.php?do=getFileInfo&" + php.getsafeMD5() + "&id=" + id, ""); string result; if (text == "") { MessageOpen.Show("获取素材详情str内容失败".Language()); result = text; } else { result = text; } return(result); }
public static JObject getfenlei() { string value = php.GethttpBack("http://bbs.tjc1688.com/hmi/ajax.php?do=getType", ""); JObject jObject = (JObject)JsonConvert.DeserializeObject(value); JObject result; if (jObject == null || jObject.Count < 1) { MessageOpen.Show("获取素材分类失败".Language()); result = null; } else { result = jObject; } return(result); }
public void closemessageshow() { try { if (this.Topm1 != null) { this.Topm1.vis = false; } if (this.Listm1 != null) { this.Listm1.vis = false; } } catch (Exception ex) { MessageOpen.Show(ex.Message); } }
public static JObject getxiangqingjson(string id) { string text = php.GethttpBack("http://bbs.tjc1688.com/hmi/ajax.php?do=getFileInfo&" + php.getsafeMD5() + "&id=" + id, ""); JObject jObject = (JObject)JsonConvert.DeserializeObject(text); JObject result; if (jObject == null || jObject.Count < 1) { MessageOpen.Show("获取素材详情JObject失败".Language()); MessageOpen.Show(text); result = null; } else { result = jObject; } return(result); }
private void setidcombox(ComboBox combbox, List <string> fenleiid, string id) { try { for (int i = 0; i < fenleiid.Count; i++) { if (fenleiid[i] == id) { combbox.SelectedIndex = i; break; } } } catch (Exception ex) { MessageOpen.Show(ex.Message); } }
public unsafe static void timerm_5ms(uint tt) { try { myappinf expr_0C_cp_0 = GuiTimer.myapp; expr_0C_cp_0.systime.systemruntime = expr_0C_cp_0.systime.systemruntime + tt; myappinf expr_23_cp_0 = GuiTimer.myapp; expr_23_cp_0.systime.movetime = expr_23_cp_0.systime.movetime + tt; myappinf expr_3A_cp_0 = GuiTimer.myapp; expr_3A_cp_0.systime.guitime_20 = expr_3A_cp_0.systime.guitime_20 + tt; if (GuiTimer.myapp.systime.guitime_20 >= 20u) { try { if (*GuiTimer.myapp.systimerbuf > 0) { for (int i = 0; i < (int)(*GuiTimer.myapp.systimerbuf); i++) { systimer_type *ptr = (systimer_type *)(GuiTimer.myapp.systimerbuf + (i * 5 + 4)); if (ptr->val < 65534 && ptr->val > 0) { systimer_type *expr_B2 = ptr; expr_B2->val = (ushort)(expr_B2->val + 1); } } } } catch { MessageOpen.Show("merry conflict!"); } GuiTimer.myapp.systime.guitime_20 = 0u; } if (GuiTimer.myapp.systime.touchdowntime > 0u) { myappinf expr_121_cp_0 = GuiTimer.myapp; expr_121_cp_0.systime.touchdowntime = expr_121_cp_0.systime.touchdowntime + tt; } } catch (Exception ex) { MessageOpen.Show("timerm_5ms Runerror:" + ex.Message); } }
private void OnKeyenter(object sender, EventArgs e) { try { string value = ((listmessage_type)sender).Value; if (this.KeyTextoffset + this.KeyTextlenth <= this.textBox1.Document.TextLength) { this.textevent = false; this.textBox1.Document.Replace(this.KeyTextoffset, this.KeyTextlenth, value); this.textBox1.Document.TextArea.Caret.Position = this.textBox1.Document.OffsetToPosition(this.KeyTextoffset + value.Length); this.textBox1.Focus(); this.textevent = true; } } catch (Exception ex) { MessageOpen.Show(ex.Message); } }
public void setid(string id) { try { List <string> list = new List <string>(); list.Add(id); string text = this.getparentid(id); while (text != "0") { list.Add(text); text = this.getparentid(text); } switch (list.Count) { case 1: this.setidcombox(this.comboBox1, this.fenleiid1, list[0]); break; case 2: this.setidcombox(this.comboBox1, this.fenleiid1, list[1]); this.setidcombox(this.comboBox2, this.fenleiid2, list[0]); break; case 3: this.setidcombox(this.comboBox1, this.fenleiid1, list[2]); this.setidcombox(this.comboBox2, this.fenleiid2, list[1]); this.setidcombox(this.comboBox3, this.fenleiid3, list[0]); break; case 4: this.setidcombox(this.comboBox1, this.fenleiid1, list[3]); this.setidcombox(this.comboBox2, this.fenleiid2, list[2]); this.setidcombox(this.comboBox3, this.fenleiid3, list[1]); this.setidcombox(this.comboBox4, this.fenleiid3, list[0]); break; } } catch (Exception ex) { MessageOpen.Show(ex.Message); } }
public textmsg(TextEditorControl text1, int codemessageindex) { try { this.messageid = codemessageindex; this.closemessageshow(); if (this.timershow == null) { this.timershow = new Timer(); this.timershow.Enabled = false; this.timershow.Interval = 50; this.timershow.Tick += new EventHandler(this.timershow_Tick); } this.timershow.Enabled = false; this.DisptextBox(); this.inttextBox(text1); if (this.messagecom.Count == 0) { this.messageinit(); } if (this.Listm1 == null) { this.Listm1 = new ListMessage(); this.Listm1.Width = this.ListFormWidth; this.Listm1.Height = 20; this.Listm1.Show(); ListMessage expr_162 = this.Listm1; expr_162.KeyEnter = (EventHandler)Delegate.Combine(expr_162.KeyEnter, new EventHandler(this.OnKeyenter)); } if (this.Topm1 == null) { this.Topm1 = new TopMessage(); this.Topm1.Width = 10; this.Topm1.Height = 10; this.Topm1.Show(); } } catch (Exception ex) { MessageOpen.Show(ex.Message); } }
public static void Hmi_SetHexIndex(int index) { if (Hmi.myapp.Hexstrindex != 65535) { for (int i = 0; i < 8; i++) { if (Hmi.myapp.hishexs[i] == 65535) { Hmi.myapp.hishexs[i] = Hmi.myapp.Hexstrindex; Hmi.myapp.Hexstrindex = (ushort)index; return; } } MessageOpen.Show("recursive depth exceeds the maximum value!"); } else { Hmi.myapp.Hexstrindex = (ushort)index; } }
private void DocumentChanged(object sender, DocumentEventArgs e) { try { if (this.textevent) { while (this.timerlock) { } this.timershow.Enabled = false; this.timershow.Interval = 50; this.timershow.Enabled = true; this.showstate = 0; } } catch (Exception ex) { MessageOpen.Show(ex.Message); } }
public void refbackview() { try { if (this.chexiaobutton != null && this.huifubutton != null) { this.chexiaobutton.Text = this.chexiaobutton.Text.Split(new char[] { '(' })[0] + "(" + (this.objsetcomps.Count / 2 - (this.objsetcomps.Count - this.objsetcomindex) / 2).ToString() + ")"; this.huifubutton.Text = this.huifubutton.Text.Split(new char[] { '(' })[0] + "(" + ((this.objsetcomps.Count - this.objsetcomindex) / 2).ToString() + ")"; } } catch (Exception ex) { MessageOpen.Show("refbackview error:" + ex.Message); } }
public static void Usart_ComRecode(byte Res) { try { if (Usart.myapp.upapp.runapptype == runapptype.run) { while (!Usart.usartzhongduan) { } byte state = Usart.myapp.USART.State; switch (state) { case 0: Commake.Commake_RecvNorComData(Res); break; case 1: break; case 2: break; default: if (state == 23) { GuiCurve.RecCurveTranData(Res); } break; } if (Usart.myapp.sys.ussp > 0) { Usart.myapp.systime.sptime = Usart.myapp.systime.systemruntime; } } } catch (Exception ex) { MessageOpen.Show("Usart_ComRecode RunError:" + ex.Message); } }
public unsafe static byte Showpic_ShowXpic_M(int x, int y, ushort w, ushort h, int x2, int y2, Picturexinxi *mpicture) { try { if ((int)mpicture->pictureid < Showpic.myapp.upapp.images.Count) { lock (Showpic.myapp.upapp.Screenbm) { Graphics.FromImage(Showpic.myapp.upapp.Screenbm).DrawImage(Showpic.myapp.upapp.images[(int)mpicture->pictureid].imagebitbmp, new Rectangle(x, y, (int)w, (int)h), new Rectangle(x2, y2, (int)w, (int)h), GraphicsUnit.Pixel); Showpic.myapp.upapp.Lcdshouxian = 1; } } else { MessageOpen.Show("Images is Error!" + Showpic.myapp.upapp.images.Count.ToString()); } } catch { } return(1); }
private void inttextBox(TextEditorControl text1) { try { this.textBox1 = text1; this.textBox1.Document.TextKeyPress += new DocumentEventHandler(this.Document_TextKeyPress); this.textBox1.Document.DocumentChanged += new DocumentEventHandler(this.DocumentChanged); this.textBox1.Document.TextArea.Caret.PositionChanged += new EventHandler(this.DocumentCaretPositionChanged); this.textBox1.Document.TextArea.MouseMove += new MouseEventHandler(this.DocumentMouseMove); this.textBox1.Document.TextArea.MouseLeave += new EventHandler(this.DocumentMouseLeave); this.textBox1.Document.TextArea.MotherTextAreaControl.VScrollBar.ValueChanged += new EventHandler(this.DocumentScroll); this.textBox1.Document.TextArea.MotherTextAreaControl.HScrollBar.ValueChanged += new EventHandler(this.DocumentScroll); this.textBox1.Document.TextArea.GotFocus += new EventHandler(this.ThisGotFouce); this.textBox1.Document.TextArea.LostFocus += new EventHandler(this.ThisLostFouce); this.textBox1.Document.TextArea.Resize += new EventHandler(this.textresize); } catch (Exception ex) { MessageOpen.Show(ex.Message); } }
public static void gethmiver(int shortms, int longms, int retry, int retrytime, bool tishi_ok, bool tishi_err, bool showdown, int islogin_) { Win32.timeBeginPeriod(1); if (Win32.ugetvertime != null && Win32.ugetvertime.IsAlive) { MessageOpen.Show("正在查询中".Language()); } else { Win32.islogin = islogin_; Win32.getver_retry = retry; Win32.getver_retrytime = retrytime; Win32.getvertishi_ok = tishi_ok; Win32.getvertishi_err = tishi_err; Win32.getverautoshowdown = showdown; Win32.getvershorttime = shortms; Win32.getverlongtime = longms; datasize.findendstate = false; Win32.ugetvertime = new Thread(new ThreadStart(Win32.getvertime)); Win32.ugetvertime.Start(); } }
public static void delay_ms(ushort val) { try { if (Sys.myapp.upapp.runapptype == runapptype.run) { if (Sys.myapp.upapp.Lcdshouxian > 0) { Sys.myapp.upapp.ScreenRef(1); } DateTime now = DateTime.Now; while (Win32.Win32GetTime(now) < (uint)val) { if (Sys.myapp.upapp.runstate == 0) { break; } Thread.Sleep(1); } } else { while (val > 0) { if (Sys.myapp.upapp.runstate == 0) { break; } Thread.Sleep(1); val -= 1; } } } catch (Exception ex) { MessageOpen.Show("delayms is error" + ex.Message); } }
private void DisptextBox() { try { if (this.textBox1 != null) { this.textBox1.Document.TextKeyPress -= new DocumentEventHandler(this.Document_TextKeyPress); this.textBox1.Document.DocumentChanged -= new DocumentEventHandler(this.DocumentChanged); this.textBox1.Document.TextArea.Caret.PositionChanged -= new EventHandler(this.DocumentCaretPositionChanged); this.textBox1.Document.TextArea.MouseMove -= new MouseEventHandler(this.DocumentMouseMove); this.textBox1.Document.TextArea.MouseLeave -= new EventHandler(this.DocumentMouseLeave); this.textBox1.Document.TextArea.MotherTextAreaControl.VScrollBar.ValueChanged -= new EventHandler(this.DocumentScroll); this.textBox1.Document.TextArea.MotherTextAreaControl.HScrollBar.ValueChanged -= new EventHandler(this.DocumentScroll); this.textBox1.Document.TextArea.GotFocus -= new EventHandler(this.ThisGotFouce); this.textBox1.Document.TextArea.LostFocus -= new EventHandler(this.ThisLostFouce); this.textBox1 = null; } } catch (Exception ex) { MessageOpen.Show(ex.Message); } }
public static objmark_ getobjmark(byte mark) { objmark_ result; if (mark < 50) { result = objtype.marks[(int)mark]; } else { foreach (objmark_ current in objtype.marks) { if (current.mark == mark) { result = current; return(result); } } MessageOpen.Show("Error objtype"); result = objtype.marks[0]; } return(result); }
private void opensuolvtu() { try { OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.Filter = "所有文件|*.*".Language(); openFileDialog.Getpath("ftpslvtu"); if (openFileDialog.ShowDialog() == DialogResult.OK) { openFileDialog.Putpath("ftpslvtu"); this.pictureBox1.Load(openFileDialog.FileName); this.suolvtu = openFileDialog.FileName; if (this.linkLabel1.Visible) { this.linkLabel1.Visible = false; } } } catch (Exception ex) { MessageOpen.Show(ex.Message); } }
private void timer1_Tick(object sender, EventArgs e) { try { this.label1.Text = "下载进度:".Language() + this.urldown1.filelenth.ToString(); if (this.urldown1.downok) { download.WinExec(this.tempexepath, 1); Thread.Sleep(200); Environment.Exit(0); } if (this.urldown1.error != "") { this.timer1.Enabled = false; this.button2.Enabled = true; this.button3.Enabled = true; MessageOpen.Show("download error!"); } } catch (Exception ex) { MessageOpen.Show(ex.Message); } }
public static byte Showpic_ShowPic(int x, int y, ushort picindex) { byte result; try { if (picindex >= Showpic.myapp.app.picqyt) { if (picindex == 65535) { result = 1; return(result); } Showpic.myapp.errcode = 4; result = 0; return(result); } else if ((int)picindex < Showpic.myapp.upapp.images.Count) { lock (Showpic.myapp.upapp.Screenbm) { Graphics.FromImage(Showpic.myapp.upapp.Screenbm).DrawImage(Showpic.myapp.upapp.images[(int)picindex].imagebitbmp, new Point(x, y)); Showpic.myapp.upapp.Lcdshouxian = 1; } } else { MessageOpen.Show("Images is Error!" + Showpic.myapp.upapp.images.Count.ToString()); } } catch { } result = 1; return(result); }
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); }