예제 #1
0
        private void buildTree()
        {
            //reset
            treeView1.Nodes.Clear();

            System.Windows.Forms.TreeNode packageRoot = new TreeNode("Packages");
            treeView1.Nodes.Add(packageRoot);

            //retrieve all objects from DB
            List <DatabaseObject> list = new List <DatabaseObject>();

            Editor.LoadObjects(ref list, 0);

            //get all packages...
            List <PackageInfo> packs = new List <PackageInfo>();

            Editor.GetPackages(ref packs);

            foreach (PackageInfo p in packs)
            {
                AddPackage(p);
            }


            foreach (DatabaseObject data in list)
            {
                ClassBase godzClass = ClassBase.findClass(data.classhash);
                if (godzClass != null && godzClass.IsA("ObjectTemplate"))
                {
                    //see if we already added the package
                    Object temp = mPackageMap[data.packageHash];

                    if (temp != null)
                    {
                        PackageNode pnode       = (PackageNode)temp;
                        TreeNode    parent_node = pnode.node;
                        AddTemplateToTree(parent_node, data);
                    }
                }
            }

            treeView1.ExpandAll();
        }