Ejemplo n.º 1
0
        static protected void assetTreeViewCreate_AddIndividualNodes(string versionInfoFilename, string name,
                                                                     TreeView tree, TreeNode parent, guiAssetTreeTag.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 guiAssetTreeTag(fullname.GetEncodedFilename(), level, true);
            }
            else
            {
                tag = new guiAssetTreeTag(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 != guiAssetTreeTag.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);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// AssetTreeViewCreate creates tree nodes based on a valid version.info file.  It does so one level at a time and not all at once.
        /// </summary>
        /// <param name="versionInfoFilename"></param>
        /// <param name="tree"></param>
        /// <param name="parent"></param>
        /// <param name="level"></param>
        static public void AssetTreeViewCreate(string versionInfoFilename, TreeView tree, TreeNode parent, guiAssetTreeTag.TREE_FOCUS level, bool createVersionNode)
        {
            /// Changes to this function could have side-effects in many other areas...
            int defaultImageIndex = 0;
//			if (level == guiAssetTreeTag.TREE_FOCUS.BASE)
//			{
//				bFullRootView = true;
//			}

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

// TODO Rewrite this!
//			switch(level)
//			{
//				case guiAssetTreeTag.TREE_FOCUS.BASE:
//					contents = MOG_DBAssetAPI.GetAllUniqueProjectKeys();
//					break;
//				case guiAssetTreeTag.TREE_FOCUS.KEY:
//					if (parent != null)
//					{
//						// Takes project key from last iteration
//						contents = MOG_DBAssetAPI.GetAllUniqueAssetTypes(parent.Text);
//					}
//					else
//					{
//						contents = MOG_DBAssetAPI.GetAllUniqueAssetTypes(MOG_ControllerProject.GetProject().GetProjectKey());
//					}
//					break;
//				case guiAssetTreeTag.TREE_FOCUS.CLASS:
//					if (parent.Parent != null)
//					{
//						contents = MOG_DBAssetAPI.GetAllUniqueAssetGroups(parent.Parent.Text, parent.Text);
//					}
//					else
//					{
//						contents = MOG_DBAssetAPI.GetAllUniqueAssetGroups(MOG_ControllerProject.GetProject().GetProjectKey(), parent.Text);
//					}
//					break;
//				case guiAssetTreeTag.TREE_FOCUS.SUBCLASS:
//					if (parent.Parent.Parent != null)
//					{
//						contents = MOG_DBAssetAPI.GetAllUniqueAssetSubGroups(parent.Parent.Parent.Text, parent.Parent.Text, parent.Text);
//					}
//					else
//					{
//						contents = MOG_DBAssetAPI.GetAllUniqueAssetSubGroups(MOG_ControllerProject.GetProject().GetProjectKey(), parent.Parent.Text, parent.Text);
//					}
//					break;
//				case guiAssetTreeTag.TREE_FOCUS.LABEL:
//					// If we have a super-parent and this node's parent does not have a filename in it.
//					if (parent.Parent.Parent.Parent != null && parent.Text.IndexOf(".") == -1)
//					{
//						// Check to see if this super-Parent.Text is the name of a package
//						if(parent.Parent.Parent.Parent.Text.IndexOf("\\") == -1)
//						{
//							contents = MOG_DBAssetAPI.GetAllUniqueFullAssetLabels(parent.Parent.Parent.Parent.Text, parent.Parent.Parent.Text, parent.Parent.Text, parent.Text);
//						}
//						else
//						{
//							string[] assetParts = parent.Text.Split('.');
//							if(assetParts.Length > 3)
//								contents = MOG_DBAssetAPI.GetAllUniqueFullAssetLabels(assetParts[0], assetParts[1], assetParts[2], assetParts[3]);
//							else
//								return;
//						}
//					}
//					else
//					{
//						ArrayList assets = MOG_DBAssetAPI.GetSyncTargetFileAssetLinksFileNameOnly( parent.Text );
//						if(assets.Count > 0)
//						{
//							string assetName = (string)assets[0];
//							contents.Add( assetName );
//						}
//					}
//					break;
//				case guiAssetTreeTag.TREE_FOCUS.VERSION:
//					assetTreeViewCreate_AddVersionNodes(tree, parent, defaultImageIndex);
//					return;
//				case guiAssetTreeTag.TREE_FOCUS.SUBVERSION:
//					// Add the files nodes
//					assetTreeViewCreate_AddFilesNodes(parent, defaultImageIndex);
//					MOG_Filename asset =  new MOG_Filename(((guiAssetTreeTag)parent.Tag).FullFilename);
//					// If this is an asset only, add a package node placeholder for further expansion
//					if(!asset.IsPackage())
//					{
//						MOG_Properties pProperties = new MOG_Properties(asset);
//						bool isPackaged = pProperties.IsPackagedAsset();
//						if(isPackaged)
//						{
//							TreeNode packageRoot = new TreeNode("Packages", defaultImageIndex, 0);
//							packageRoot.Tag = parent.Tag;
//							((guiAssetTreeTag)packageRoot.Tag).Level = guiAssetTreeTag.TREE_FOCUS.SUBVERSION;
//							packageRoot.Nodes.Add(new TreeNode(""));
//							parent.Nodes.Add(packageRoot);
//						}
//						return;
//					}
//					else
//					{
//						//GLK: Fill up contained assets for a package
//						TreeNode assetRoot = new TreeNode("Contained Assets", defaultImageIndex, 0);
//						guiAssetTreeTag parentTag = (guiAssetTreeTag)parent.Tag;
//						assetRoot.Tag = new guiAssetTreeTag(parentTag.FullFilename,
//							guiAssetTreeTag.TREE_FOCUS.SUBCLASS, true);
//						((guiAssetTreeTag)assetRoot.Tag).Level = guiAssetTreeTag.TREE_FOCUS.SUBCLASS;
//						string packageName;
//						// If this node is not a Version Node
//						if(parent.Parent.Text != VERSION_TOKEN)
//							packageName = parent.Parent.Text;
//						else
//							packageName = parent.Parent.Parent.Text;
//						//assetRoot.Nodes.Add(new TreeNode(""));
//
//						//GLK: Not fully implemented yet.  I can use MOG_Filename(parentTag.FullFilename) to get the version.
//						MOG_Filename parentFilename = new MOG_Filename(parentTag.FullFilename);
//						contents = MOG_DBPackageAPI.GetAllAssetsInPackage( parentFilename, parentFilename.GetVersionTimeStamp() );
//
//						assetTreeViewCreate_AddNodes(contents, versionInfoFilename, tree, assetRoot,
//							guiAssetTreeTag.TREE_FOCUS.LABEL, defaultImageIndex, createVersionNode);
//						parent.Nodes.Add(assetRoot);
//						return;
//					}
//					// At this level (below), we go back to TREE_FOCUS.LABEL for recursion
//				case guiAssetTreeTag.TREE_FOCUS.PACKAGE:
//					assetTreeViewCreate_AddPackagesNodes(parent, defaultImageIndex);
//					return;
//			}

            // Add nodes for any TREE_FOCUS other than the last three (above)
            assetTreeViewCreate_AddNodes(contents, versionInfoFilename, tree, parent,
                                         level, defaultImageIndex, createVersionNode);
        }
Ejemplo n.º 3
0
 static protected void assetTreeViewCreate_AddNodes(ArrayList contents, string versionInfoFilename,
                                                    TreeView tree, TreeNode parent, guiAssetTreeTag.TREE_FOCUS level, int defaultImageIndex, bool createChildNode)
 {
     foreach (string name in contents)
     {
         assetTreeViewCreate_AddIndividualNodes(versionInfoFilename, name, tree, parent, level,
                                                defaultImageIndex, createChildNode);
     }
 }