Ejemplo n.º 1
0
        static public void AssetTreeViewCreate(string versionInfoFilename, TreeView tree, TreeNode parent, guiAssetGamedataTreeTag.TREE_FOCUS level, bool createChildNode)
        {
            /// Changes to this function could have side-effects in many other areas...
            int defaultImageIndex = 0;

            guiAssetGamedataTreeTag currentTag = null;

            if (parent != null)
            {
                currentTag = (guiAssetGamedataTreeTag)parent.Tag;
            }

            // Find the items in the ASSETS section, set value of `contents`
            ArrayList contents = new ArrayList();

            switch (level)
            {
            case guiAssetGamedataTreeTag.TREE_FOCUS.BASE:
// TODO - Check this!
//					contents = MOG_DBAssetAPI.GetAllUniqueProjectKeys();
                break;

            case guiAssetGamedataTreeTag.TREE_FOCUS.PLATFORM:
                string[] platformNames = MOG_ControllerProject.GetProject().GetPlatformNames();
                foreach (string platformName in platformNames)
                {
                    contents.Add(platformName);
                }
                break;

            case guiAssetGamedataTreeTag.TREE_FOCUS.KEY:

                // If we have no ListForNode ArrayList, start fresh
                if (currentTag == null || currentTag.ListForNode.Count < 1)
                {
                    contents = MOG_DBAssetAPI.GetAllProjectSyncTargetFilesForPlatform(parent.Text);
                    assetTreeViewCreate_ParseSyncTargetFileNodes(contents, parent, versionInfoFilename, level);
                }
                //Else we are in a subNode and need to process a ListForNode
                else
                {
                    assetTreeViewCreate_ParseSyncTargetFileNodes(currentTag.ListForNode, parent, versionInfoFilename, level);
                }
                return;

            default:
                return;
            }
            assetTreeViewCreate_AddNodes(contents, versionInfoFilename, tree, parent,
                                         level, defaultImageIndex, true);
        }
Ejemplo n.º 2
0
        static protected void CheckIfAlreadyAdded(ArrayList subContents, string rootName, TreeNode parent,
                                                  string versionInfoFilename, guiAssetGamedataTreeTag.TREE_FOCUS level)
        {
            bool     isAlreadyAdded   = false;
            TreeNode alreadyNamedNode = null;

            foreach (TreeNode node in parent.Nodes)
            {
                if (node.Text.ToLower() == rootName)
                {
                    isAlreadyAdded   = true;
                    alreadyNamedNode = node;
                }
            }
            if (!isAlreadyAdded)
            {
                TreeNode newParent = new TreeNode(rootName);
                // Create a tag for this node with subContents attached by a new reference
                newParent.Tag = new guiAssetGamedataTreeTag("", guiAssetGamedataTreeTag.TREE_FOCUS.PLATFORM,
                                                            false, new ArrayList(subContents));

                // Formerly used for recursion
//				assetTreeViewCreate_ParseSyncTargetFileNodes(subContents, newParent, versionInfoFilename,
//					level, true);
                // Add a blank node for expansion
                newParent.Nodes.Add(new TreeNode(""));
                parent.Nodes.Add(newParent);
            }
            else
            {
                // Add the new data we have in subContents to what this node already has.
                guiAssetGamedataTreeTag alreadyNamedTag = (guiAssetGamedataTreeTag)alreadyNamedNode.Tag;
                ArrayList addMoreToCurrent = new ArrayList();
                foreach (string member in alreadyNamedTag.ListForNode)
                {
                    addMoreToCurrent.Add(member);
                }
                foreach (string member in subContents)
                {
                    addMoreToCurrent.Add(member);
                }
                alreadyNamedNode.Tag = new guiAssetGamedataTreeTag(alreadyNamedTag.FullFilename,
                                                                   alreadyNamedTag.Level, alreadyNamedTag.Execute, new ArrayList(addMoreToCurrent));
                // This was formerly used for recursion...
//				assetTreeViewCreate_ParseSyncTargetFileNodes( subContents, alreadyNamedNode, versionInfoFilename,
//					level, true);
            }
        }
Ejemplo n.º 3
0
        static protected void assetTreeViewCreate_AddIndividualNodes(string versionInfoFilename, string name,
                                                                     TreeView tree, TreeNode parent, guiAssetGamedataTreeTag.TREE_FOCUS level, int defaultImageIndex, bool createChildNode)
        {
            // Set the imageIndex for a new TreeNode, create the TreeNode, and create a blank tag for the new node
            TreeNode        node = assetTreeViewCreate_GetTreeNodeWithIcon(name, defaultImageIndex);
            guiAssetTreeTag tag  = null;

            // If `name` already has the project and projectpath, we need to get rid of it.
            string projectPath = MOG_ControllerProject.GetProject().GetProjectPath() + "\\";
            string newName     = name.Replace(projectPath, "");

            // Get the blessed path for this assetname
            MOG_Filename asset = new MOG_Filename(projectPath + newName);

            if (asset.GetFilenameType() == MOG_FILENAME_TYPE.MOG_FILENAME_Asset)
            {
                MOG_Filename fullname = GetAssetFullname(asset, versionInfoFilename);
                tag = new guiAssetGamedataTreeTag(fullname.GetEncodedFilename(), level, true);
            }
            else
            {
                tag = new guiAssetGamedataTreeTag(asset.GetEncodedFilename(), level, false);
            }

            // Save the type of node this is (Key, Class, Group...)
            node.Tag = tag;

            // Don't add an extra child if we are at the end of the chain
            if (/*level != guiAssetGamedataTreeTag.TREE_FOCUS.LABEL ||*/ createChildNode)
            {
                // Add a blank for this keys child
                node.Nodes.Add("");
            }

            // Check if we should add to the base or to a child
            if (parent == null)
            {
                tree.Nodes.Add(node);
            }
            else
            {
                parent.Nodes.Add(node);
            }
        }