public U8FolderNode NewFolder() { U8FolderNode node = ((U8FolderNode)_resource).CreateResource <U8FolderNode>("NewFolder"); BaseWrapper res = this.FindResource(node, true); res = res.FindResource(node, false); res.EnsureVisible(); res.TreeView.SelectedNode = res; return(node); }
public void NewClr() { CLR0Node node = ((BRRESNode)_resource).CreateResource <CLR0Node>("NewCLR"); node.Version = 3; BaseWrapper res = this.FindResource(node, true); res = res.FindResource(node, false); res.EnsureVisible(); res.TreeView.SelectedNode = res; }
public void NewSrt() { SRT0Node node = ((BRESNode)_resource).CreateResource <SRT0Node>("NewSRT"); node.Version = 4; BaseWrapper res = this.FindResource(node, true); res = res.FindResource(node, false); res.EnsureVisible(); res.TreeView.SelectedNode = res; }
public BaseWrapper FindResource(ResourceNode node) { BaseWrapper w = null; foreach (BaseWrapper n in Nodes) { if ((w = n.FindResource(node, true)) != null) { break; } } return(w); }
private void NewCLR() { CLR0MaterialEntryNode n = ((CLR0Node)this._resource).CreateEntry(); if (n != null) { BaseWrapper b = FindResource(n, true); if (b != null) { b.EnsureVisible(); } } }
public void ImportChr() { string path; if (Program.OpenFile(FileFilters.CHR0 + "|Raw Text (*.txt)|*.txt", out path) > 0) { CHR0Node node = CHR0Node.FromFile(path); ((BRRESNode)_resource).GetOrCreateFolder <CHR0Node>().AddChild(node); BaseWrapper w = this.FindResource(node, true); w.EnsureVisible(); w.TreeView.SelectedNode = w; } }
public void ImportClr() { string path; if (Program.OpenFile(FileFilters.CLR0, out path) > 0) { CLR0Node node = NodeFactory.FromFile(null, path) as CLR0Node; ((BRRESNode)_resource).GetOrCreateFolder <CLR0Node>().AddChild(node); BaseWrapper w = this.FindResource(node, true); w.EnsureVisible(); w.TreeView.SelectedNode = w; } }
private void ImportFile(string file, TreeNode t) { ResourceNode node = null; if (t == null) { Program.Open(file); } else { ResourceNode dest = ((BaseWrapper)t).ResourceNode; try { if ((node = NodeFactory.FromFile(null, file)) != null) { bool ok = false; if (ModifierKeys == Keys.Shift || dest.Parent == null) { ok = TryAddChild(node, dest); } else { ok = TryDrop(node, dest); } if (!ok) { node.Dispose(); node = null; } else { BaseWrapper b = FindResource(node); if (b != null) { b.EnsureVisible(); SelectedNode = b; } } } else if (dest is TEX0Node || dest is REFTEntryNode || dest is TPLTextureNode) { dest.Replace(file); } } catch { } } _timer.Enabled = false; _dragNode = null; }
public void ImportBrres() { string path; if (Program.OpenFile(FileFilters.BRES, out path) > 0) { BRRESNode node = NodeFactory.FromFile(null, path) as BRRESNode; ((U8FolderNode)_resource).AddChild(node); BaseWrapper w = this.FindResource(node, true); w.EnsureVisible(); w.TreeView.SelectedNode = w; } }
public MSBinNode NewMSBin() { MSBinNode node = new MSBinNode() { FileType = ARCFileType.MiscData }; _resource.AddChild(node); BaseWrapper w = this.FindResource(node, false); w.EnsureVisible(); w.TreeView.SelectedNode = w; return(node); }
public ARCNode NewARC() { ARCNode node = new ARCNode() { Name = _resource.FindName("NewARChive"), FileType = ARCFileType.MiscData }; _resource.AddChild(node); BaseWrapper w = this.FindResource(node, false); w.EnsureVisible(); w.TreeView.SelectedNode = w; return(node); }
public MRGNode NewMRG() { MRGNode node = new MRGNode() { Name = _resource.FindName("NewMRG") }; _resource.AddChild(node); BaseWrapper w = this.FindResource(node, false); w.EnsureVisible(); w.TreeView.SelectedNode = w; return(node); }
// StageBox create TBST public TBSTNode NewTBST(int numEntries) { TBSTNode node = new TBSTNode(null, numEntries) { FileType = ARCFileType.MiscData }; _resource.AddChild(node); BaseWrapper w = this.FindResource(node, false); w.EnsureVisible(); w.TreeView.SelectedNode = w; return(node); }
// StageBox create SCLA public SCLANode NewSCLA(uint index) { SCLANode node = new SCLANode(index) { FileType = ARCFileType.MiscData }; _resource.AddChild(node); BaseWrapper w = this.FindResource(node, false); w.EnsureVisible(); w.TreeView.SelectedNode = w; return(node); }
public void ImportModel() { string path; if (Program.OpenFile(FileFilters.MDL0Import, out path) > 0) { MDL0Node node = MDL0Node.FromFile(path); if (node != null) { ((BRRESNode)_resource).GetOrCreateFolder <MDL0Node>().AddChild(node); BaseWrapper w = this.FindResource(node, true); w.EnsureVisible(); w.TreeView.SelectedNode = w; } } }
public DialogResult ShowDialog(IWin32Window owner, RSARFolderNode parent) { _parentNode = parent; _newNode = null; treeResource.BeginUpdate(); foreach (ResourceNode node in parent.RSARNode.Children) { treeResource.Nodes.Add(BaseWrapper.Wrap(this, node)); } BaseWrapper w = treeResource.FindResource(parent); treeResource.SelectedNode = w; w.EnsureVisible(); w.Expand(); treeResource.EndUpdate(); try { return(base.ShowDialog(owner)); } finally { _parentNode = null; treeResource.Clear(); } }
public void ImportU8() { string path; if (Program.OpenFile("U8 Archive (*.arc)|*.arc|" + "Compressed U8 Archive (*.szs)|*.szs|" + "Archive Pair (*.pair)|*.pair", out path) > 0) { U8Node node = NodeFactory.FromFile(null, path) as U8Node; U8FolderNode n = new U8FolderNode(); foreach (ResourceNode r in node.Children) { n.AddChild(r); } n.Name = node.Name; ((U8FolderNode)_resource).AddChild(n); BaseWrapper w = this.FindResource(n, true); w.EnsureVisible(); w.TreeView.SelectedNode = w; } }
public void Link(ResourceNode res) { Unlink(); if (res != null) { this.Text = res.Name; TreeNodeCollection nodes = Nodes; //Should we continue down the tree? if ((IsExpanded) && (res.HasChildren)) { //Add/link each resource node foreach (ResourceNode n in res.Children) { bool found = false; foreach (BaseWrapper tn in nodes) { if (tn.Text == n.Name) { tn.Link(n); found = true; break; } } if (!found) { nodes.Add(Wrap(_owner, n)); } } //Remove empty nodes for (int i = 0; i < nodes.Count;) { BaseWrapper n = nodes[i] as BaseWrapper; if (n._resource == null) { n.Remove(); } else { i++; } } _discovered = true; } else { //Node will be reset and undiscovered nodes.Clear(); //Collapse(); if (res.HasChildren) { nodes.Add(new GenericWrapper() { _owner = _owner }); _discovered = false; } else { _discovered = true; } } SelectedImageIndex = ImageIndex = (int)res.ResourceType & 0xFF; res.ChildAdded += OnChildAdded; res.ChildRemoved += OnChildRemoved; res.ChildInserted += OnChildInserted; res.Replaced += OnReplaced; res.Restored += OnRestored; res.Renamed += OnRenamed; res.MovedUp += OnMovedUp; res.MovedDown += OnMovedDown; res.UpdateProps += OnUpdateProps; res.UpdateCurrControl += OnUpdateCurrControl; } _resource = res; }