Esempio n. 1
0
        public void ImportTexture()
        {
            string path;
            int    index = Program.OpenFile(ExportFilters.TEX0, out path);

            if (index == 8)
            {
                TEX0Node node = NodeFactory.FromFile(null, path) as TEX0Node;
                ((BRESNode)_resource).GetOrCreateFolder <TEX0Node>().AddChild(node);

                BaseWrapper w = this.FindResource(node, true);
                w.EnsureVisible();
                w.TreeView.SelectedNode = w;
            }
            else if (index > 0)
            {
                using (TextureConverterDialog dlg = new TextureConverterDialog())
                {
                    dlg.ImageSource = path;
                    if (dlg.ShowDialog(MainForm.Instance, ResourceNode as BRESNode) == DialogResult.OK)
                    {
                        BaseWrapper w = this.FindResource(dlg.TextureNode, true);
                        w.EnsureVisible();
                        w.TreeView.SelectedNode = w;
                    }
                }
            }
        }
Esempio n. 2
0
        public void ImportTexture()
        {
            string path;
            int    index = Program.OpenFile(FileFilters.TEX0, out path);

            if (index == 8)
            {
                TEX0Node node = NodeFactory.FromFile(null, path) as TEX0Node;
                ((BRRESNode)_resource).GetOrCreateFolder <TEX0Node>().AddChild(node);

                string palette = Path.ChangeExtension(path, ".plt0");
                if (File.Exists(palette) && node.HasPalette)
                {
                    PLT0Node n = NodeFactory.FromFile(null, palette) as PLT0Node;
                    ((BRRESNode)_resource).GetOrCreateFolder <PLT0Node>().AddChild(n);
                }

                BaseWrapper w = this.FindResource(node, true);
                w.EnsureVisible();
                w.TreeView.SelectedNode = w;
            }
            else if (index > 0)
            {
                using (TextureConverterDialog dlg = new TextureConverterDialog())
                {
                    dlg.ImageSource = path;
                    if (dlg.ShowDialog(MainForm.Instance, ResourceNode as BRRESNode) == DialogResult.OK)
                    {
                        BaseWrapper w = this.FindResource(dlg.TEX0TextureNode, true);
                        w.EnsureVisible();
                        w.TreeView.SelectedNode = w;
                    }
                }
            }
        }
        private void Append()
        {
            ((VIS0Node)_resource).Append();
            BaseWrapper res = this.FindResource(_resource, false);

            res.EnsureVisible();
            res.TreeView.SelectedNode = res;
        }
Esempio n. 4
0
        public void NewBone()
        {
            VIS0EntryNode node = ((VIS0Node)_resource).CreateEntry();
            BaseWrapper   res  = this.FindResource(node, false);

            res.EnsureVisible();
            res.TreeView.SelectedNode = res;
        }
Esempio n. 5
0
        public void NewTpl()
        {
            TPLNode     node = ((U8FolderNode)_resource).CreateResource <TPLNode>("TPL");
            BaseWrapper res  = this.FindResource(node, true);

            res = res.FindResource(node, false);
            res.EnsureVisible();
            res.TreeView.SelectedNode = res;
        }
Esempio n. 6
0
        public void NewModel()
        {
            MDL0Node    node = ((BRRESNode)_resource).CreateResource <MDL0Node>("NewModel");
            BaseWrapper res  = this.FindResource(node, true);

            res = res.FindResource(node, false);
            res.EnsureVisible();
            res.TreeView.SelectedNode = res;
        }
        private void treeView1_DragDrop(object sender, DragEventArgs e)
        {
            Array a = (Array)e.Data.GetData(DataFormats.FileDrop);

            DragHelper.ImageList_DragLeave(Handle);
            TreeNode dropNode = GetNodeAt(PointToClient(new Point(e.X, e.Y)));

            if (a != null)
            {
                string s = null;
                for (int i = 0; i < a.Length; i++)
                {
                    s = a.GetValue(i).ToString();
                    this.BeginInvoke(m_DelegateOpenFile, s, dropNode);
                }
            }
            else
            {
                if (_dragNode != dropNode)
                {
                    BaseWrapper  drag     = ((BaseWrapper)_dragNode);
                    BaseWrapper  drop     = ((BaseWrapper)dropNode);
                    ResourceNode dragging = drag.Resource;
                    ResourceNode dropping = drop.Resource;

                    if (dropping.Parent == null)
                    {
                        goto End;
                    }

                    bool ok = false;
                    if (ModifierKeys == Keys.Shift)
                    {
                        ok = TryAddChild(dragging, dropping);
                    }
                    else
                    {
                        ok = TryDrop(dragging, dropping);
                    }

                    if (ok)
                    {
                        BaseWrapper b = FindResource(dragging);
                        if (b != null)
                        {
                            b.EnsureVisible();
                            SelectedNode = b;
                        }
                    }

End:
                    _dragNode      = null;
                    _timer.Enabled = false;
                }
            }
        }
Esempio n. 8
0
        public BRRESNode NewBrres()
        {
            BRRESNode   node = ((U8FolderNode)_resource).CreateResource <BRRESNode>("NewBrres");
            BaseWrapper res  = this.FindResource(node, true);

            res = res.FindResource(node, false);
            res.EnsureVisible();
            res.TreeView.SelectedNode = res;
            return(node);
        }
Esempio n. 9
0
        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;
        }
Esempio n. 10
0
        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;
        }
        private void NewCLR()
        {
            CLR0MaterialEntryNode n = ((CLR0Node)this._resource).CreateEntry();

            if (n != null)
            {
                BaseWrapper b = FindResource(n, true);
                if (b != null)
                {
                    b.EnsureVisible();
                }
            }
        }
Esempio n. 12
0
        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;
        }
Esempio n. 13
0
        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;
            }
        }
Esempio n. 14
0
        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;
            }
        }
Esempio n. 15
0
        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;
            }
        }
Esempio n. 16
0
        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);
        }
Esempio n. 17
0
        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);
        }
Esempio n. 18
0
        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);
        }
Esempio n. 19
0
        // 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);
        }
Esempio n. 20
0
        // 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);
        }
Esempio n. 21
0
        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(); }
        }
Esempio n. 23
0
        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;
            }
        }