void btnItem_Click(object sender, EventArgs e) { btnItemMapRender.Enabled = false; Wz_Node node = Context.SelectedNode1; if (node != null) { Wz_Image img = node.Value as Wz_Image; Wz_File wzFile = node.GetNodeWzFile(); if (img != null && img.TryExtract()) { if (wzFile == null || wzFile.Type != Wz_Type.Map) { if (MessageBoxEx.Show("所选Img不属于Map.wz,是否继续?", "提示", MessageBoxButtons.OKCancel) != DialogResult.OK) { goto exit; } } StringLinker sl = this.Context.DefaultStringLinker; if (!sl.HasValues) //生成默认stringLinker { sl = new StringLinker(); sl.Load(PluginManager.FindWz(Wz_Type.String).GetValueEx <Wz_File>(null)); } //开始绘制 Thread thread = new Thread(() => { #if !DEBUG try { #endif FrmMapRender frm = new MapRender.FrmMapRender(img); frm.StringLinker = sl; frm.Run(); #if !DEBUG } catch (Exception ex) { MessageBoxEx.Show(ex.ToString(), "MapRender"); } #endif }); thread.SetApartmentState(ApartmentState.STA); thread.Start(); goto exit; } } MessageBoxEx.Show("没有选择一个map的img", "MapRender"); exit: btnItemMapRender.Enabled = true; }
///<inheritdoc/> public override void LoadMap(string imgText) { _currentMapImage = WzTreeSearcher.SearchForMap(_wzStructure.WzNode, imgText); Exception ex; _currentMapImage.TryExtract(out ex); if (ex != null) { throw ex; } _stringLinker = new StringLinker(); _stringLinker.Load(PluginManager.FindWz(Wz_Type.String).GetValueEx <Wz_File>(null)); }
void btnItem_Click(object sender, EventArgs e) { Wz_Node node = Context.SelectedNode1; if (node != null) { Wz_Image img = node.Value as Wz_Image; Wz_File wzFile = node.GetNodeWzFile(); if (img != null && img.TryExtract()) { if (wzFile == null || wzFile.Type != Wz_Type.Map) { if (MessageBoxEx.Show("The selected Img does not belong to Map.wz. Continue?", "Message", MessageBoxButtons.OKCancel) != DialogResult.OK) { goto exit; } } StringLinker sl = this.Context.DefaultStringLinker; if (!sl.HasValues) //生成默认stringLinker { sl = new StringLinker(); sl.Load(PluginManager.FindWz(Wz_Type.String).GetValueEx <Wz_File>(null)); } //开始绘制 Thread thread = new Thread(() => { #if !DEBUG try { #endif #if MapRenderV1 if (sender == btnItemMapRender) { if (this.mapRenderGame1 != null) { return; } this.mapRenderGame1 = new FrmMapRender(img) { StringLinker = sl }; try { using (this.mapRenderGame1) { this.mapRenderGame1.Run(); } } finally { this.mapRenderGame1 = null; } } else #endif { if (this.mapRenderGame2 != null) { return; } this.mapRenderGame2 = new FrmMapRender2(img) { StringLinker = sl }; this.mapRenderGame2.Window.Title = "MapRender " + this.Version; try { using (this.mapRenderGame2) { this.mapRenderGame2.Run(); } } finally { this.mapRenderGame2 = null; } } #if !DEBUG } catch (Exception ex) { PluginManager.LogError("MapRender", ex, "MapRender error:"); MessageBoxEx.Show(ex.ToString(), "MapRender"); } #endif }); thread.SetApartmentState(ApartmentState.STA); thread.IsBackground = true; thread.Start(); goto exit; } } MessageBoxEx.Show("Please select a Map Img.", "Message"); exit: return; }