Пример #1
0
        public void populate()
        {
            string[] filePaths = Directory.GetFiles(FilePath);
            foreach (string path in filePaths)
            {
                LibraryTreeNode node = new LibraryTreeNode(getFileNameWithoutExtension(path), clearExtraSlashes(path));

                if (path.EndsWith(".mgfx"))
                {
                    continue;
                }

                int index = AssetManager.indexOf(AssetManager.FILE_ICON_FILE);
                if (path.EndsWith(".state"))
                {
                    index = AssetManager.indexOf(AssetManager.FILE_ICON_FILE_LEVEL);
                }
                if (path.EndsWith(".cs"))
                {
                    index = AssetManager.indexOf(AssetManager.FILE_ICON_FILE_TYPE);

                    if (path.ToLower().StartsWith(WhiskeyEditor.Backend.Managers.ProjectManager.Instance.ActiveProject.PathSrcScripts.ToLower()) || path.StartsWith(WhiskeyEditor.compile_types.CoreTypes.corePathScripts))
                    {
                        index = AssetManager.indexOf(AssetManager.FILE_ICON_FILE_SCRIPT);
                    }
                }
                if (path.EndsWith(".png"))
                {
                    index = AssetManager.indexOf(AssetManager.FILE_ICON_FILE_PICTURE);
                }

                node.ImageIndex         = index;
                node.SelectedImageIndex = index;

                node.IsFile = true;
                Nodes.Add(node);
            }

            string[] dirPaths = Directory.GetDirectories(FilePath);
            foreach (string dir in dirPaths)
            {
                LibraryTreeNode node = new LibraryTreeNode(getFileName(dir), dir);
                node.IsFile             = false;
                node.ImageIndex         = AssetManager.indexOf(AssetManager.FILE_ICON_FLDR);
                node.SelectedImageIndex = AssetManager.indexOf(AssetManager.FILE_ICON_FLDR);;

                Nodes.Add(node);
                node.populate();
            }
        }
Пример #2
0
        public void refreshContent()
        {
            if (this.IsHandleCreated)
            {
                this.Invoke(new NoArgFunction(() =>
                {
                    FileTree.Nodes.Clear();

                    Project p = ProjectManager.Instance.ActiveProject;

                    LibraryTreeNode root = new LibraryTreeNode(p.Name, p.PathBase);

                    //PROPERTIES
                    LibraryTreeNode nodeProp    = new LibraryTreeNode("Properties", p.FileSettingsPath, true);
                    nodeProp.ImageIndex         = AssetManager.indexOf(AssetManager.FILE_ICON_FILE);
                    nodeProp.SelectedImageIndex = AssetManager.indexOf(AssetManager.FILE_ICON_FILE);
                    root.Nodes.Add(nodeProp);

                    //SOURCE-Objects
                    LibraryTreeNode nodeObjects = new LibraryTreeNode("Objects", p.PathSrcObjects);
                    nodeObjects.populate();
                    root.Nodes.Add(nodeObjects);

                    //SOURCE-Scripts
                    LibraryTreeNode nodeScripts = new LibraryTreeNode("Scripts", p.PathSrcScripts);
                    nodeScripts.populate();
                    root.Nodes.Add(nodeScripts);

                    //LEVELS
                    LibraryTreeNode nodeLvl = new LibraryTreeNode("Levels", p.PathStates);
                    nodeLvl.populate();
                    root.Nodes.Add(nodeLvl);

                    //MEDIA
                    LibraryTreeNode nodeArt = new LibraryTreeNode("Media", p.PathMedia);
                    nodeArt.populate();
                    root.Nodes.Add(nodeArt);

                    //CORE-TYPES

                    LibraryTreeNode nodeCoreTypes = new LibraryTreeNode("Shared Objects", WhiskeyEditor.compile_types.CoreTypes.corePathTypes);
                    nodeCoreTypes.populate();
                    root.Nodes.Add(nodeCoreTypes);

                    LibraryTreeNode nodeCoreScripts = new LibraryTreeNode("Shared Scripts", WhiskeyEditor.compile_types.CoreTypes.corePathScripts);
                    nodeCoreScripts.populate();
                    root.Nodes.Add(nodeCoreScripts);

                    FileTree.Nodes.Add(root);


                    //open everything
                    root.ExpandAll();

                    //close common scripts
                    // nodeCoreScripts.Collapse();


                    //fileTree.Update();
                }));
            }
            else
            {
                this.HandleCreated += (s, a) => { refreshContent(); };
            }
        }