private classTreeNode EncodeTree(AssetTreeNode tn, MOG_Properties props, int dialogId) { classTreeNode classNode = new classTreeNode(tn.Text); classNode.ImageIndex = BLUEDOT_INDEX; classNode.SelectedImageIndex = BLUEDOT_INDEX; // Get a local handle for our progress dialog MOG_Progress.ProgressUpdate(dialogId, tn.FullPath); // if this is an asset filename node? if (tn.IsAnAssetFilename) { classNode.Text = classNode.Text; classNode.ForeColor = Color.Blue; classNode.ImageIndex = ARROW_INDEX; classNode.SelectedImageIndex = ARROW_INDEX; classNode.IsAssetFilenameNode = true; // Inherit Properties from parent // 'props' needs to be cloned or else all of these children assets will share the same Properties!!! classNode.props = props; // Make list o' children foreach (AssetTreeNode fileNode in tn.fileNodes) { if (fileNode.IsAFile) { classNode.importFiles.Add(fileNode.FileFullPath); } } // setup gamedatapath string assetDirectoryPath = MOG.CONTROLLER.CONTROLLERASSET.MOG_ControllerAsset.GetCommonDirectoryPath(this.projectRootPath, classNode.importFiles); string relativePath = ""; if (assetDirectoryPath.Length > this.projectRootPath.Length) { relativePath = assetDirectoryPath.Substring(this.projectRootPath.Length + 1); } classNode.props.SyncTargetPath = relativePath; // add it to the list of asset filename nodes for later processing this.assetFilenameNodes.Add(classNode); return(classNode); // don't do children of an asset filename node } // Use our properties to pass along to our children props = MOG_ControllerProject.GetClassificationProperties(tn.FullPath.Replace(tn.TreeView.PathSeparator, "~")); props.SetImmeadiateMode(true); classNode.props = props; // Loop through all of our children nodes sending them our Properties foreach (AssetTreeNode subNode in tn.Nodes) { classNode.Nodes.Add(EncodeTree(subNode, props, dialogId)); } return(classNode); }
private void LoadClassTreeConfigs(TreeNodeCollection nodes) { if (nodes == null) { return; } foreach (classTreeNode tn in nodes) { // load the properties for tn tn.props = MOG_ControllerProject.GetClassificationProperties(tn.FullPath); tn.props.SetImmeadiateMode(true); // tn.props = new MOG_Properties(tn.FullPath); // recurse on tn's children LoadClassTreeConfigs(tn.Nodes); } }
private void tvClassifications_AfterLabelEdit(object sender, System.Windows.Forms.NodeLabelEditEventArgs e) { TreeNodeCollection nodes = this.tvClassifications.Nodes; if (e.Node.Parent != null) { nodes = e.Node.Parent.Nodes; } if (e.Label == "" || Utils.NodesCollectionContainsSubNode(nodes, e.Label)) { MOG_Prompt.PromptResponse("Alert", "Invalid Classification Name", "", MOGPromptButtons.OK, MOG_ALERT_LEVEL.ALERT); e.CancelEdit = true; } if (this.immediateMode) { string className = e.Node.FullPath.Substring(0, e.Node.FullPath.LastIndexOf("~")) + "~" + e.Label; if (e.Label == null) { className = e.Node.FullPath; } if (MOG_ControllerProject.GetProject().ClassificationAdd(className)) { ((classTreeNode)e.Node).props = MOG_ControllerProject.GetClassificationProperties(className); ((classTreeNode)e.Node).props.SetImmeadiateMode(true); } else { e.CancelEdit = true; } } this.tvClassifications.LabelEdit = false; }