protected override void OnVisibleChanged(EventArgs e) { base.OnVisibleChanged(e); if (!this.Visible) { this.m_IFFFile = null; this.dataGridViewIff.DataSource = null; this.m_ILFFile = null; this.m_WSFile = null; if (this.m_DynamicByteProviderWS != null) { this.m_DynamicByteProviderWS = null; } if (this.m_DynamicByteProviderIFF != null) { this.m_DynamicByteProviderIFF = null; } this.treeViewIff.Nodes.Clear(); this.toolStripButtonIffSave.Enabled = false; this.toolStripButtonIffSaveAs.Enabled = false; } else { this.hexBoxIff_Resize(this.hexBoxIff, new EventArgs()); } }
private void WSLoadFile(String filename) { this.treeViewIff.ContextMenuStrip = null; this.splitContainerIff.Visible = false; this.dataGridViewIff.Visible = false; this.panelIlf.Visible = false; this.hexBoxIff.Visible = false; this.m_IFFFile = null; this.m_ILFFile = null; this.m_WSFile = new WSFile(filename); try { this.HasChangesChanged -= new HasChangesChangedEvent(FormIFFILFWSEditor_HasChangesChanged); } catch { } if ((this.m_WSFile != null) && (this.m_WSFile.Filename != null) && (this.m_WSFile.Filename != String.Empty)) { if (!this.m_WSFile.Filename.Contains("\\")) { this.m_WSFile.Filename = Path.Combine(this.m_FormNotifyIcon.saveFileDialog.InitialDirectory, this.m_WSFile.Filename); } else if (this.m_WSFile.Filename.StartsWith(Path.GetTempPath())) { this.m_WSFile.Filename = Path.Combine(this.m_FormNotifyIcon.saveFileDialog.InitialDirectory, this.m_WSFile.Filename.Substring(Path.GetTempPath().Length)); } } this.comboBoxWsObject.SuspendLayout(); this.comboBoxWsObject.Items.Clear(); this.comboBoxWsObject.Items.AddRange(this.m_WSFile.Types); this.comboBoxWsObject.ResumeLayout(false); this.treeViewIff.SuspendLayout(); this.treeViewIff.Nodes.Clear(); TreeNode treeNode = new TreeNode(); treeNode.Name = "WSNPFORM"; treeNode.Text = "WSNPFORM"; treeNode.ImageIndex = 1; this.treeViewIff.Nodes.Add(treeNode); this.WSRecurseNode(m_WSFile.Nodes.ToArray(), this.treeViewIff.Nodes[0]); this.treeViewIff.ResumeLayout(false); this.splitContainerIff.Visible = true; this.panelWs.Visible = true; this.toolStripButtonIffManageItems.Visible = true; this.toolStripButtonIffSaveAs.Enabled = true; this.HasChanges = false; this.HasChangesChanged += new HasChangesChangedEvent(FormIFFILFWSEditor_HasChangesChanged); }
internal void IFFLoadFile(String filename) { this.treeViewIff.ContextMenuStrip = null; if (filename.ToLower().EndsWith(".ilf")) { this.ILFLoadFile(filename); return; } if (filename.ToLower().EndsWith(".ws")) { this.WSLoadFile(filename); return; } this.m_ILFFile = null; this.m_WSFile = null; try { try { this.m_IFFFile = new IFFFile(filename); } catch (Exception exception) { MessageBox.Show(exception.Message, "TRE Explorer", MessageBoxButtons.OK, MessageBoxIcon.Error); this.Visible = false; return; } try { this.HasChangesChanged -= new HasChangesChangedEvent(FormIFFILFWSEditor_HasChangesChanged); } catch { } if ((this.m_IFFFile != null) && (this.m_IFFFile.Filename != null) && (this.m_IFFFile.Filename != String.Empty)) { if (!this.m_IFFFile.Filename.Contains("\\")) { this.m_IFFFile.Filename = Path.Combine(this.m_FormNotifyIcon.saveFileDialog.InitialDirectory, this.m_IFFFile.Filename); } else if (this.m_IFFFile.Filename.StartsWith(Path.GetTempPath())) { this.m_IFFFile.Filename = Path.Combine(this.m_FormNotifyIcon.saveFileDialog.InitialDirectory, this.m_IFFFile.Filename.Substring(Path.GetTempPath().Length)); } } this.splitContainerIff.Visible = false; this.dataGridViewIff.Visible = false; this.panelIlf.Visible = false; this.panelWs.Visible = false; this.hexBoxIff.Visible = false; this.m_ILFFile = null; this.hexBoxIff.ByteProvider = null; this.m_DynamicByteProviderIFF = null; this.toolStripSeparator3.Visible = false; this.toolStripTextBoxSearch.Visible = false; this.toolStripButtonSearch.Visible = false; if (this.m_IFFFile.IsDataTable) { this.dataGridViewIff.DataSource = this.m_IFFFile.DataTable; this.dataGridViewIff.Visible = true; } else { this.treeViewIff.ContextMenuStrip = this.contextMenuStripTreeViewIFF; this.treeViewIff.Nodes.Clear(); IFFRecurseNode(this.m_IFFFile.Node, CreateIFFNode(this.m_IFFFile.Node)); this.splitContainerIff.Visible = true; this.hexBoxIff.Visible = true; this.treeViewIff.SelectedNode = this.treeViewIff.Nodes[0]; } this.toolStripButtonIffSaveAs.Enabled = true; this.HasChanges = false; this.HasChangesChanged += new HasChangesChangedEvent(FormIFFILFWSEditor_HasChangesChanged); this.Focus(); } catch (Exception exception) { MessageBox.Show(exception.Message, "TRE Explorer", MessageBoxButtons.OK, MessageBoxIcon.Error); this.Visible = false; } }
private void ILFLoadFile(String filename) { this.treeViewIff.ContextMenuStrip = null; try { this.HasChangesChanged -= new HasChangesChangedEvent(FormIFFILFWSEditor_HasChangesChanged); } catch { } this.splitContainerIff.Visible = false; this.dataGridViewIff.Visible = false; this.panelIlf.Visible = false; this.panelWs.Visible = false; this.hexBoxIff.Visible = false; this.m_IFFFile = null; this.m_WSFile = null; try { this.m_ILFFile = new ILFFile(filename); if ((this.m_ILFFile != null) && (this.m_ILFFile.Filename != null) && (this.m_ILFFile.Filename != String.Empty)) { if (!this.m_ILFFile.Filename.Contains("\\")) { this.m_ILFFile.Filename = Path.Combine(this.m_FormNotifyIcon.saveFileDialog.InitialDirectory, this.m_ILFFile.Filename); } else if (this.m_ILFFile.Filename.StartsWith(Path.GetTempPath())) { this.m_ILFFile.Filename = Path.Combine(this.m_FormNotifyIcon.saveFileDialog.InitialDirectory, this.m_ILFFile.Filename.Substring(Path.GetTempPath().Length)); } } this.treeViewIff.SuspendLayout(); this.treeViewIff.Nodes.Clear(); this.treeViewIff.Nodes.Add("INLYFORM", "INLYFORM"); this.treeViewIff.Nodes[0].ImageIndex = 1; foreach (ILFFile.ILFNode ilfChunk in this.m_ILFFile.Nodes) { TreeNode treeNode = new TreeNode(ilfChunk.Object); treeNode.Name = ilfChunk.Object; treeNode.Tag = ilfChunk.Object; this.treeViewIff.Nodes[0].Nodes.Add(treeNode); } this.treeViewIff.ResumeLayout(false); this.splitContainerIff.Visible = true; this.panelIlf.Visible = true; this.toolStripButtonIffSaveAs.Enabled = true; this.HasChanges = false; this.HasChangesChanged += new HasChangesChangedEvent(FormIFFILFWSEditor_HasChangesChanged); } catch { } }