private void abrirToolStripMenuItem_Click(object sender, EventArgs e) { open = new OpenFileDialog(); if (open.ShowDialog() == DialogResult.OK) { byte[] opened = File.ReadAllBytes(open.FileName); raw = new ArquivoRAW.RAW(opened, alfa); raw.ListInsert(treeView1, raw, open); fecharToolStripMenuItem.Enabled = true; label1.Text = "Pastas: " + raw.folderCount; alfaToolStripMenuItem.Enabled = false; } }
private void fecharToolStripMenuItem_Click(object sender, EventArgs e) { if (treeView1.Nodes.Count != 0) { treeView1.Nodes.Clear(); } raw = null; open.Dispose(); fecharToolStripMenuItem.Enabled = false; exportarToolStripMenuItem.Enabled = false; exportarTextoToolStripMenuItem.Enabled = false; exportarTexturaToolStripMenuItem.Enabled = false; label1.ResetText(); pictureBox1.Image = null; this.Size = new Size(343, 431); alfaToolStripMenuItem.Enabled = true; }
public void ListInsert(TreeView tree, RAW raw, OpenFileDialog open) { if (tree.Nodes.Count != 0) { tree.Nodes.Clear(); } TreeNode Raiz = new TreeNode(Path.GetFileName(open.FileName)); int i = 0; foreach (var folder in raw.Pastas) { TreeNode Raiz2 = null; if (folder.type == Types.Texto) { Raiz2 = new TreeNode(Path.GetFileName(open.FileName) + "_" + i + " -Texto" + "-" + folder.texto.SeqCount); } else if (folder.type == Types.Textura) { Raiz2 = new TreeNode(Path.GetFileName(open.FileName) + "_" + i + " -Textura"); } else if (folder.type == Types.Unknow) { Raiz2 = new TreeNode(Path.GetFileName(open.FileName) + "_" + i); } try { if (folder.filescount != 0) { int j = 0; foreach (var file in folder.Arquivos) { if (file.type == Types.Texto) { Raiz2.Nodes.Add(Path.GetFileName(open.FileName) + "_" + i + "_" + j + " -Texto" + "-" + file.texto.SeqCount); } else if (file.type == Types.Textura) { TreeNode Raiz3 = new TreeNode(Path.GetFileName(open.FileName) + "_" + i + "_" + j + " -Textura"); int y = 0; foreach (var image in file.textura.images) { Raiz3.Nodes.Add(Path.GetFileName(open.FileName) + "_" + i + "_" + j + "_" + y + " -Imagem"); y++; } Raiz2.Nodes.Add(Raiz3); } else if (file.type == Types.Unknow) { Raiz2.Nodes.Add(Path.GetFileName(open.FileName) + "_" + i + "_" + j); } j++; } } } catch (NullReferenceException) { } Raiz.Nodes.Add(Raiz2); i++; } tree.Nodes.Add(Raiz); }