private void PopulateTreeView(SCI32ResourceDirectoryCollection resourceCollection) { this.resourceView.Nodes.Clear(); for (int i = 0; i < resourceCollection.Count; i++) { SCI32ResourceDirectory dir = resourceCollection[i]; // these are our directories TreeNode dirNode = new TreeNode(dir.GetDirectoryNameByType(dir.Type), Icons.GetIconIndex(Helpers.Icon.ClosedFolder), Icons.GetIconIndex(Helpers.Icon.ClosedFolder)); dirNode.Name = dir.GetDirectoryNameByType(dir.Type); dirNode.Tag = "Directory"; for (int j = 0; j < dir.Resources.Count; j++) { SCI32Resource res = dir.Resources[j]; // We want a filename TreeNode childNode = new TreeNode(res.FileName, Icons.GetIconIndexByType(res.ResourceType), Icons.GetIconIndexByType(res.ResourceType)); childNode.Name = res.FileName; childNode.Tag = "File"; // check here for duplicates dirNode.Nodes.Add(childNode); } dirNode.SortAllChildNodes(); this.resourceView.Nodes.Add(dirNode); } }
private void openResourceFileToolStripMenuItem_Click(object sender, EventArgs e) { // for now we want the resmap.* openFileDialog1.Filter = "Resmap Files|Resmap.*"; openFileDialog1.Multiselect = true; openFileDialog1.Title = "View Resources packed in SCI32 format."; DialogResult result = openFileDialog1.ShowDialog(); if (result == System.Windows.Forms.DialogResult.OK) { try { this.ResourceDirectories = new SCI32ResourceDirectoryCollection(); this.ResourceDirectories.ProcessResmap(openFileDialog1.FileName); PopulateTreeView(this.ResourceDirectories); } catch (IOException io) { MessageBox.Show(io.Message, "Error Loading Resource!", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } }