/// <summary> /// Adds a new file node to the hierarchy from an existing one. /// NOTE:The file has already been copied. /// </summary> /// <param name="parentNode">The parent of the new fileNode</param> /// <param name="fileName">The file name</param> protected override void AddNewFileNodeToHierarchyFrom(HierarchyNode parentNode, string fileName, string aOriginalFile) { HierarchyNode lChild; // In the case of subitem, we want to create dependent file node // and set the DependentUpon property if (this.CanFileNodesHaveChilds && (parentNode is FileNode || parentNode is DependentFileNode)) { lChild = this.CreateDependentFileNode(fileName); lChild.ItemNode.SetMetadata(ProjectFileConstants.DependentUpon, parentNode.ItemNode.GetMetadata(ProjectFileConstants.Include)); // Make sure to set the HasNameRelation flag on the dependent node if it is related to the parent by name if (string.Compare(lChild.GetRelationalName(), parentNode.GetRelationalName(), true, CultureInfo.InvariantCulture) == 0) { lChild.HasParentNodeNameRelation = true; } } else { //Create and add new filenode to the project lChild = this.CreateFileNode(fileName); } parentNode.AddChild(lChild); // TODO : We need to call DelphiDPRFileNode AddUnitFile once it exits. AddDelphiDirectiveFiles(lChild as DelphiFileNode, Path.GetDirectoryName(aOriginalFile)); this.Tracker.OnItemAdded(fileName, VSADDFILEFLAGS.VSADDFILEFLAGS_NoFlags); }
/// <summary> /// Renames the file in the hierarchy by removing old node and adding a new node in the hierarchy. /// </summary> /// <param name="oldFileName">The old file name.</param> /// <param name="newFileName">The new file name</param> /// <param name="newParentId">The new parent id of the item.</param> /// <returns>The newly added FileNode.</returns> /// <remarks>While a new node will be used to represent the item, the underlying MSBuild item will be the same and as a result file properties saved in the project file will not be lost.</remarks> private FileNode RenameFileNode(string oldFileName, string newFileName, HierarchyNode newParent) { if (CommonUtils.IsSamePath(oldFileName, newFileName)) { // We do not want to rename the same file return(null); } if (newParent.IsNonMemberItem) { ErrorHandler.ThrowOnFailure(newParent.IncludeInProject(false)); } ProjectMgr.OnItemDeleted(this); this.Parent.RemoveChild(this); this.ID = this.ProjectMgr.ItemIdMap.Add(this); this.ItemNode.Rename(CommonUtils.GetRelativeFilePath(ProjectMgr.ProjectHome, newFileName)); this.ItemNode.RefreshProperties(); this.ProjectMgr.SetProjectFileDirty(true); newParent.AddChild(this); this.Parent = newParent; ProjectMgr.ReDrawNode(this, UIHierarchyElement.Caption); //Update the new document in the RDT. DocumentManager.RenameDocument(this.ProjectMgr.Site, oldFileName, newFileName, ID); //Select the new node in the hierarchy ExpandItem(EXPANDFLAGS.EXPF_SelectItem); RenameChildNodes(this); return(this); }
/// <summary> /// A direct copy of AddFileNodeToNode as that method is private in the base class. /// </summary> private HierarchyNode AddFileNodeToNode(BuildItem item, HierarchyNode parentNode) { FileNode node = this.CreateFileNode(new ProjectElement(this, item, false)); parentNode.AddChild(node); return(node); }
private IEnumerable <IPackage> BuildModuleHierarchy(HierarchyNode parent, IEnumerable <IPackage> modules, IReadOnlyDictionary <string, DependencyNode> recycle) { if (modules == null) { return(Enumerable.Empty <IPackage>()); } var newModules = new List <IPackage>(); foreach (var package in modules) { DependencyNode child; if (recycle.ContainsKey(package.Name)) { child = recycle[package.Name]; child.Package = package; } else { child = new DependencyNode(_projectNode, parent as DependencyNode, package); parent.AddChild(child); newModules.Add(package); } ReloadHierarchy(child, package.Modules); if (ProjectMgr.ParentHierarchy != null) { child.ExpandItem(EXPANDFLAGS.EXPF_CollapseFolder); } } return(newModules); }
/// <summary> /// Adds a directory to the project hierarchy with the specified parent. /// </summary> protected void AddDirectory(HierarchyNode parent, bool isSearchPath, string subfolder) { var existing = parent.FindChild(Path.GetFileName(subfolder)); if (existing == null) { FolderNode folderNode = CreateFolderNode(subfolder); parent.AddChild(folderNode); CreateHierarchy(folderNode, subfolder, isSearchPath); } }
/// <summary> /// Renames the file in the hierarchy by removing old node and adding a new node in the hierarchy. /// </summary> /// <param name="oldFileName">The old file name.</param> /// <param name="newFileName">The new file name</param> /// <param name="newParentId">The new parent id of the item.</param> /// <returns>The newly added FileNode.</returns> /// <remarks>While a new node will be used to represent the item, the underlying MSBuild item will be the same and as a result file properties saved in the project file will not be lost.</remarks> internal FileNode RenameFileNode(string oldFileName, string newFileName, HierarchyNode newParent) { if (CommonUtils.IsSamePath(oldFileName, newFileName)) { // We do not want to rename the same file return(null); } //If we are included in the project and our parent isn't then //we need to bring our parent into the project if (!this.IsNonMemberItem && newParent.IsNonMemberItem) { ErrorHandler.ThrowOnFailure(newParent.IncludeInProject(false)); } // Retrieve child nodes to add later. List <HierarchyNode> childNodes = this.GetChildNodes(); FileNode renamedNode; using (this.ProjectMgr.ExtensibilityEventsDispatcher.Suspend()) { // Remove this from its parent. ProjectMgr.OnItemDeleted(this); this.Parent.RemoveChild(this); // Update name in MSBuild this.ItemNode.Rename(CommonUtils.GetRelativeFilePath(ProjectMgr.ProjectHome, newFileName)); // Request a new file node be made. This is used to replace the old file node. This way custom // derived FileNode types will be used and correctly associated on rename. This is useful for things // like .txt -> .js where the file would now be able to be a startup project/file. renamedNode = this.ProjectMgr.CreateFileNode(this.ItemNode); renamedNode.ItemNode.RefreshProperties(); renamedNode.UpdateCaption(); newParent.AddChild(renamedNode); renamedNode.Parent = newParent; } UpdateCaption(); ProjectMgr.ReDrawNode(renamedNode, UIHierarchyElement.Caption); renamedNode.ProjectMgr.ExtensibilityEventsDispatcher.FireItemRenamed(this, oldFileName); //Update the new document in the RDT. DocumentManager.RenameDocument(renamedNode.ProjectMgr.Site, oldFileName, newFileName, renamedNode.ID); //Select the new node in the hierarchy renamedNode.ExpandItem(EXPANDFLAGS.EXPF_SelectItem); // Add children to new node and rename them appropriately. childNodes.ForEach(x => renamedNode.AddChild(x)); RenameChildNodes(renamedNode); return(renamedNode); }
private static void AddNonMemberFileItems(WixProjectNode project, IList <string> fileList) { if (fileList == null) { throw new ArgumentNullException("fileList"); } foreach (string fileKey in fileList) { HierarchyNode parentNode = project; string[] pathItems = fileKey.Split(new char[] { Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar }); if (String.Equals(fileKey, project.ProjectFile, StringComparison.OrdinalIgnoreCase)) { continue; } WixFolderNode topFolderNode = null; foreach (string fileOrDir in pathItems) { string childNodeId = Path.Combine(parentNode.VirtualNodeName, fileOrDir); FileInfo fileOrDirInfo = new FileInfo(Path.Combine(project.ProjectFolder, childNodeId)); if ((fileOrDirInfo.Attributes & FileAttributes.Hidden) == FileAttributes.Hidden) { break; } HierarchyNode childNode = parentNode.FindChild(childNodeId); if (childNode == null) { if (topFolderNode == null) { topFolderNode = parentNode as WixFolderNode; if (topFolderNode != null && (!topFolderNode.IsNonMemberItem) && topFolderNode.IsExpanded) { topFolderNode = null; } } ProjectElement element = new ProjectElement(project, null, true); element.Rename(childNodeId); element.SetMetadata(ProjectFileConstants.Name, childNodeId); childNode = project.CreateFileNode(element); parentNode.AddChild(childNode); break; } parentNode = childNode; } if (topFolderNode != null) { topFolderNode.CollapseFolder(); } } }
/// <summary> /// Create a new folderNode as a child node to a containernode (folder or project) /// </summary> /// <param name="project"></param> /// <param name="folderPath"></param> /// <returns></returns> internal static FolderNode CreateFolder(ProjectNode project, string folderPath, HierarchyNode containerNode) { FolderNode folderNode = project.CreateFolderNode(folderPath); containerNode.AddChild(folderNode); //Create Directory associated to this FolderNode folderNode.CreateDirectory(); return(folderNode); }
internal void EnableAutoImport(BaseFileNode node) { var newMods = ModuleTracker.EnableTracking(node.Url); foreach (string mod in newMods) { HierarchyNode parent = this.CreateFolderNodes(Path.GetDirectoryName(mod), false); parent.AddChild(CreateUntrackedNode(mod)); } }
internal void OnNodeIncluded(TrackedFileNode node) { HashSet <string> children = ModuleTracker.AddRootModuleIncremental(node.Url); foreach (string child in children) { HierarchyNode parent = this.CreateFolderNodes(Path.GetDirectoryName(child), false); parent.AddChild(CreateUntrackedNode(child)); } }
/// <summary> /// Create a new folderNode as a child node to a containernode (folder or project) /// </summary> /// <param name="project"></param> /// <param name="folderPath"></param> /// <returns></returns> internal static FolderNode CreateFolder(ProjectNode project, string folderPath, HierarchyNode containerNode) { MethodInfo createFolder = typeof(ProjectNode).GetMethod("CreateFolderNode", BindingFlags.NonPublic | BindingFlags.Instance, null, new Type[] { typeof(string) }, null); FolderNode folderNode = createFolder.Invoke(project, new object[] { folderPath }) as FolderNode; containerNode.AddChild(folderNode); //Create Directory associated to this FolderNode folderNode.CreateDirectory(); return(folderNode); }
/// <summary> /// Adds a file to the project hierarchy with the specified parent. /// </summary> /// <param name="parent"></param> /// <param name="isSearchPath"></param> /// <param name="file"></param> protected void AddFile(HierarchyNode parent, bool isSearchPath, string file) { var existing = parent.FindChild(file); if (existing == null) { FileNode fileNode = CreateFileNode(file); //Files in search path are not considered memebers of the project itself fileNode.SetProperty((int)__VSHPROPID.VSHPROPID_IsNonMemberItem, isSearchPath); parent.AddChild(fileNode); } }
internal void ReparseFileNode(BaseFileNode n) { var diff = ModuleTracker.Reparse(n.Url); foreach (string mod in diff.Removed) { TreeOperations.RemoveSubnodeFromHierarchy(this, mod, false); } foreach (string mod in diff.Added) { HierarchyNode parent = this.CreateFolderNodes(Path.GetDirectoryName(mod), false); parent.AddChild(CreateUntrackedNode(mod)); } }
private static HierarchyNode ReplaceCore(RustProjectNode root, HierarchyNode old, Func<HierarchyNode> newN, HierarchyNode parent) { HierarchyNode newNode = newN(); while (old.FirstChild != null) { HierarchyNode current = old.FirstChild; root.ProjectMgr.OnItemDeleted(current); old.RemoveChild(current); current.ID = root.ProjectMgr.ItemIdMap.Add(current); newNode.AddChild(current); } TreeOperations.RemoveSubnodeFromHierarchy(root, old, false); parent.AddChild(newNode); return newNode; }
private static void AddNonMemberFolderItems(XProjectNode project, IList <string> folderList) { if (folderList == null) { throw new ArgumentNullException("folderList"); } foreach (string folderKey in folderList) { HierarchyNode parentNode = project; string[] folders = folderKey.Split(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar); XFolderNode topFolderNode = null; foreach (string folder in folders) { string childNodeId = Path.Combine(parentNode.VirtualNodeName, folder); FileInfo folderInfo = new FileInfo(Path.Combine(project.ProjectFolder, childNodeId)); if ((folderInfo.Attributes & FileAttributes.Hidden) == FileAttributes.Hidden) { break; } HierarchyNode childNode = parentNode.FindChild(childNodeId); if (childNode == null) { if (topFolderNode == null) { topFolderNode = parentNode as XFolderNode; if (topFolderNode != null && (!topFolderNode.IsNonMemberItem) && topFolderNode.IsExpanded) { topFolderNode = null; } } ProjectElement element = new ProjectElement(project, null, true); childNode = project.CreateFolderNode(childNodeId, element); parentNode.AddChild(childNode); } parentNode = childNode; } ThreadHelper.ThrowIfNotOnUIThread(); if (topFolderNode != null) { topFolderNode.CollapseFolder(); } } }
private static HierarchyNode ReplaceCore(RustProjectNode root, HierarchyNode old, Func <HierarchyNode> newN, HierarchyNode parent) { HierarchyNode newNode = newN(); while (old.FirstChild != null) { HierarchyNode current = old.FirstChild; root.ProjectMgr.OnItemDeleted(current); old.RemoveChild(current); current.ID = root.ProjectMgr.ItemIdMap.Add(current); newNode.AddChild(current); } TreeOperations.RemoveSubnodeFromHierarchy(root, old, false); parent.AddChild(newNode); return(newNode); }
/// <summary> /// Adds the new file node to hierarchy. /// </summary> /// <param name="parentNode">The parent node.</param> /// <param name="fileName">Name of the file.</param> protected override void AddNewFileNodeToHierarchy(HierarchyNode parentNode, string path) { // If a lua file is being added, try to find a related FrameXML node if (MultiverseInterfaceProjectNode.IsPythonFile(path)) { // Try to find a FrameXML node with a matching relational name string fileName = Path.GetFileNameWithoutExtension(path); HierarchyNode childNode = this.FirstChild; // Iterate through the children while (childNode != null) { // If this child is an XML node and its relational name matches, break out of the loop if (childNode is MultiverseInterfaceXmlFileNode && String.Compare(childNode.GetRelationalName(), fileName, StringComparison.OrdinalIgnoreCase) == 0) { parentNode = childNode; break; } // Move over to the next sibling childNode = childNode.NextSibling; } } HierarchyNode child; if (this.CanFileNodesHaveChilds && (parentNode is FileNode || parentNode is DependentFileNode)) { child = this.CreateDependentFileNode(path); child.ItemNode.SetMetadata(ProjectFileConstants.DependentUpon, parentNode.ItemNode.GetMetadata(ProjectFileConstants.Include)); // Make sure to set the HasNameRelation flag on the dependent node if it is related to the parent by name if (String.Compare(child.GetRelationalName(), parentNode.GetRelationalName(), StringComparison.OrdinalIgnoreCase) == 0) { child.HasParentNodeNameRelation = true; } } else { //Create and add new filenode to the project child = this.CreateFileNode(path); } parentNode.AddChild(child); this.Tracker.OnItemAdded(path, VSADDFILEFLAGS.VSADDFILEFLAGS_NoFlags); }
private static void AddNonMemberFileItems(ProjectNode project, IEnumerable<string> fileList) { ErrorHelper.ThrowIsNull(fileList, "fileList"); foreach (string fileKey in fileList) { HierarchyNode parentNode = project; string[] pathItems = fileKey.Split(new[] { Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar }); if (StringComparer.OrdinalIgnoreCase.Equals(fileKey, project.ProjectFile)) continue; NemerleFolderNode topFolderNode = null; foreach (string fileOrDir in pathItems) { string childNodeId = Path.Combine(parentNode.VirtualNodeName, fileOrDir); FileInfo fileOrDirInfo = new FileInfo(Path.Combine(project.ProjectFolder, childNodeId)); if ((fileOrDirInfo.Attributes & FileAttributes.Hidden) == FileAttributes.Hidden) break; HierarchyNode childNode = parentNode.FindChild(childNodeId); if (childNode == null) { if (topFolderNode == null) { topFolderNode = parentNode as NemerleFolderNode; if (topFolderNode != null && (!topFolderNode.IsNonMemberItem) && topFolderNode.IsExpanded) topFolderNode = null; } ProjectElement element = new ProjectElement(project, null, true); element.Rename(childNodeId); element.SetMetadata(ProjectFileConstants.Name, childNodeId); childNode = project.CreateFileNode(element); parentNode.AddChild(childNode); break; } parentNode = childNode; } if (topFolderNode != null) topFolderNode.CollapseFolder(); } }
private TrackedFileNode CreateTrackedNode(ProjectElement elm) { var node = new TrackedFileNode(this, elm); if (!ModuleTracker.IsIncremental) { ModuleTracker.AddRootModule(node.Url); } else { HashSet <string> children = ModuleTracker.AddRootModuleIncremental(node.Url); foreach (string child in children) { HierarchyNode parent = this.CreateFolderNodes(Path.GetDirectoryName(child), false); parent.AddChild(CreateUntrackedNode(child)); } } return(node); }
private static void AddNonMemberFolderItems(ProjectNode project, IEnumerable<string> folderList) { ErrorHelper.ThrowIsNull(folderList, "folderList"); foreach (string folderKey in folderList) { HierarchyNode parentNode = project; string[] folders = folderKey.Split(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar); NemerleFolderNode topFolderNode = null; foreach (string folder in folders) { string childNodeId = Path.Combine(parentNode.VirtualNodeName, folder); FileInfo folderInfo = new FileInfo(Path.Combine(project.ProjectFolder, childNodeId)); if ((folderInfo.Attributes & FileAttributes.Hidden) == FileAttributes.Hidden) break; HierarchyNode childNode = parentNode.FindChild(childNodeId); if (childNode == null) { if (topFolderNode == null) { topFolderNode = parentNode as NemerleFolderNode; if (topFolderNode != null && (!topFolderNode.IsNonMemberItem) && topFolderNode.IsExpanded) topFolderNode = null; } ProjectElement element = new ProjectElement(project, null, true); childNode = project.CreateFolderNode(childNodeId, element); parentNode.AddChild(childNode); } parentNode = childNode; } if (topFolderNode != null) topFolderNode.CollapseFolder(); } }
protected void ReloadCore() { string outputType = GetProjectProperty(ProjectFileConstants.OutputType, true); string entryPoint = GetCrateFileNodePath(outputType); containsEntryPoint = GetCrateFileNode(outputType) != null; ModuleTracker = new ModuleTracker(entryPoint); base.Reload(); // This project for some reason doesn't include entrypoint node, add it if (!containsEntryPoint) { HierarchyNode parent = this.CreateFolderNodes(Path.GetDirectoryName(entryPoint), true); TrackedFileNode node = (TrackedFileNode)this.CreateFileNode(entryPoint); node.IsEntryPoint = true; parent.AddChild(node); } MarkEntryPointFolders(outputType); foreach (string file in ModuleTracker.ExtractReachableAndMakeIncremental()) { HierarchyNode parent = this.CreateFolderNodes(Path.GetDirectoryName(file), false); parent.AddChild(CreateUntrackedNode(file)); } }
protected override void Reload() { string outputType = GetProjectProperty(ProjectFileConstants.OutputType, false); string entryPoint = Path.Combine(Path.GetDirectoryName(this.FileName), outputType == "library" ? @"src\lib.rs" : @"src\main.rs"); containsEntryPoint = false; ModuleTracker = new ModuleTracker(entryPoint); base.Reload(); // This project for some reason doesn't include entrypoint node, add it if (!containsEntryPoint) { HierarchyNode parent = this.CreateFolderNodes(Path.GetDirectoryName(entryPoint), true); TrackedFileNode node = (TrackedFileNode)this.CreateFileNode(entryPoint); node.IsEntryPoint = true; parent.AddChild(node); } foreach (string file in ModuleTracker.ExtractReachableAndMakeIncremental()) { HierarchyNode parent = this.CreateFolderNodes(Path.GetDirectoryName(file), false); parent.AddChild(CreateUntrackedNode(file)); } this.BuildProject.Save(); }
/// <summary> /// Adds a new file node to the hierarchy. /// </summary> /// <param name="parentNode">The parent of the new fileNode</param> /// <param name="fileName">The file name</param> protected virtual void AddNewFileNodeToHierarchy(HierarchyNode parentNode, string fileName) { if (parentNode == null) { throw new ArgumentNullException("parentNode"); } HierarchyNode child; // In the case of subitem, we want to create dependent file node // and set the DependentUpon property if (this.canFileNodesHaveChilds && (parentNode is FileNode || parentNode is DependentFileNode)) { child = this.CreateDependentFileNode(fileName); child.ItemNode.SetMetadata(ProjectFileConstants.DependentUpon, parentNode.ItemNode.GetMetadata(ProjectFileConstants.Include)); // Make sure to set the HasNameRelation flag on the dependent node if it is related to the parent by name if (!child.HasParentNodeNameRelation && string.Compare(child.GetRelationalName(), parentNode.GetRelationalName(), StringComparison.OrdinalIgnoreCase) == 0) { child.HasParentNodeNameRelation = true; } } else { //Create and add new filenode to the project child = this.CreateFileNode(fileName); } parentNode.AddChild(child); // TODO : Revisit the VSADDFILEFLAGS here. Can it be a nested project? this.tracker.OnItemAdded(fileName, VSADDFILEFLAGS.VSADDFILEFLAGS_NoFlags); }
// !EFW /// <summary> /// Adds a new linked file node to the hierarchy. /// </summary> /// <param name="parentNode">The parent of the new fileNode</param> /// <param name="linkedFileName">The linked filename</param> /// <param name="fileName">The file name in the project heirarchy</param> protected virtual void AddNewLinkedFileNodeToHierarchy( HierarchyNode parentNode, string linkedFileName, string fileName) { // NOTE: The general process should match that of // AddNewFileNodeToHierarchy with the exception of the filename // used and the addition of the Link metadata. HierarchyNode child; // In the case of subitem, we want to create dependent file node // and set the DependentUpon property if(this.canFileNodesHaveChilds && (parentNode is FileNode || parentNode is DependentFileNode)) { child = this.CreateDependentFileNode(linkedFileName); child.ItemNode.SetMetadata(ProjectFileConstants.Link, PackageUtilities.MakeRelative(base.ProjectMgr.FileName, fileName)); child.ItemNode.SetMetadata(ProjectFileConstants.DependentUpon, parentNode.ItemNode.GetMetadata(ProjectFileConstants.Include)); // Make sure to set the HasNameRelation flag on the dependent // node if it is related to the parent by name if(!child.HasParentNodeNameRelation && string.Compare(child.GetRelationalName(), parentNode.GetRelationalName(), StringComparison.OrdinalIgnoreCase) == 0) { child.HasParentNodeNameRelation = true; } } else { //Create and add new filenode to the project child = this.CreateFileNode(linkedFileName); child.ItemNode.SetMetadata(ProjectFileConstants.Link, PackageUtilities.MakeRelative(base.ProjectMgr.FileName, fileName)); } parentNode.AddChild(child); // TODO : Revisit the VSADDFILEFLAGS here. Can it be a nested project? this.tracker.OnItemAdded(fileName, VSADDFILEFLAGS.VSADDFILEFLAGS_NoFlags); }
/// <summary> /// Renames the file in the hierarchy by removing old node and adding a new node in the hierarchy. /// </summary> /// <param name="oldFileName">The old file name.</param> /// <param name="newFileName">The new file name</param> /// <param name="newParentId">The new parent id of the item.</param> /// <returns>The newly added FileNode.</returns> /// <remarks>While a new node will be used to represent the item, the underlying MSBuild item will be the same and as a result file properties saved in the project file will not be lost.</remarks> private FileNode RenameFileNode(string oldFileName, string newFileName, HierarchyNode newParent) { if (CommonUtils.IsSamePath(oldFileName, newFileName)) { // We do not want to rename the same file return null; } if (newParent.IsNonMemberItem) { ErrorHandler.ThrowOnFailure(newParent.IncludeInProject(false)); } ProjectMgr.OnItemDeleted(this); this.Parent.RemoveChild(this); this.ID = this.ProjectMgr.ItemIdMap.Add(this); this.ItemNode.Rename(CommonUtils.GetRelativeFilePath(ProjectMgr.ProjectHome, newFileName)); this.ItemNode.RefreshProperties(); this.ProjectMgr.SetProjectFileDirty(true); newParent.AddChild(this); this.Parent = newParent; ProjectMgr.ReDrawNode(this, UIHierarchyElement.Caption); //Update the new document in the RDT. DocumentManager.RenameDocument(this.ProjectMgr.Site, oldFileName, newFileName, ID); //Select the new node in the hierarchy ExpandItem(EXPANDFLAGS.EXPF_SelectItem); RenameChildNodes(this); return this; }
protected void ReloadHierarchy(HierarchyNode parent, IEnumerable<IPackage> modules) { // We're going to reuse nodes for which matching modules exist in the new set. // The reason for this is that we want to preserve the expansion state of the // hierarchy. If we just bin everything off and recreate it all from scratch // it'll all be in the collapsed state, which will be annoying for users who // have drilled down into the hierarchy var recycle = new Dictionary<string, DependencyNode>(); var remove = new List<HierarchyNode>(); for (var current = parent.FirstChild; null != current; current = current.NextSibling) { var dep = current as DependencyNode; if (null == dep) { if (!(current is GlobalModulesNode) && !(current is LocalModulesNode)) { remove.Add(current); } continue; } if (modules != null && modules.Any( module => module.Name == dep.Package.Name && module.Version == dep.Package.Version && module.IsBundledDependency == dep.Package.IsBundledDependency && module.IsDevDependency == dep.Package.IsDevDependency && module.IsListedInParentPackageJson == dep.Package.IsListedInParentPackageJson && module.IsMissing == dep.Package.IsMissing && module.IsOptionalDependency == dep.Package.IsOptionalDependency)) { recycle[dep.Package.Name] = dep; } else { remove.Add(current); } } foreach (var obsolete in remove) { parent.RemoveChild(obsolete); ProjectMgr.OnItemDeleted(obsolete); } if (modules != null) { foreach (var package in modules) { DependencyNode child; if (recycle.ContainsKey(package.Name)) { child = recycle[package.Name]; child.Package = package; } else { child = new DependencyNode(_projectNode, parent as DependencyNode, package); parent.AddChild(child); } ReloadHierarchy(child, package.Modules); if (ProjectMgr.ParentHierarchy != null) { child.ExpandItem(EXPANDFLAGS.EXPF_CollapseFolder); } } } }
protected void ReloadHierarchy(HierarchyNode parent, IEnumerable <IPackage> modules) { // We're going to reuse nodes for which matching modules exist in the new set. // The reason for this is that we want to preserve the expansion state of the // hierarchy. If we just bin everything off and recreate it all from scratch // it'll all be in the collapsed state, which will be annoying for users who // have drilled down into the hierarchy var recycle = new Dictionary <string, DependencyNode>(); var remove = new List <HierarchyNode>(); for (var current = parent.FirstChild; null != current; current = current.NextSibling) { var dep = current as DependencyNode; if (null == dep) { if (!(current is GlobalModulesNode) && !(current is LocalModulesNode)) { remove.Add(current); } continue; } if (modules != null && modules.Any( module => module.Name == dep.Package.Name && module.Version == dep.Package.Version && module.IsBundledDependency == dep.Package.IsBundledDependency && module.IsDevDependency == dep.Package.IsDevDependency && module.IsListedInParentPackageJson == dep.Package.IsListedInParentPackageJson && module.IsMissing == dep.Package.IsMissing && module.IsOptionalDependency == dep.Package.IsOptionalDependency)) { recycle[dep.Package.Name] = dep; } else { remove.Add(current); } } foreach (var obsolete in remove) { parent.RemoveChild(obsolete); ProjectMgr.OnItemDeleted(obsolete); } if (modules != null) { foreach (var package in modules) { DependencyNode child; if (recycle.ContainsKey(package.Name)) { child = recycle[package.Name]; child.Package = package; } else { child = new DependencyNode(_projectNode, parent as DependencyNode, package); parent.AddChild(child); } ReloadHierarchy(child, package.Modules); if (ProjectMgr.ParentHierarchy != null) { child.ExpandItem(EXPANDFLAGS.EXPF_CollapseFolder); } } } }
/// <summary> /// Add a file node to the hierarchy /// </summary> /// <param name="item">msbuild item to add</param> /// <param name="parentNode">Parent Node</param> /// <returns>Added node</returns> private HierarchyNode AddFileNodeToNode(MSBuild.ProjectItem item, HierarchyNode parentNode) { FileNode node = this.CreateFileNode(new ProjectElement(this, item, false)); parentNode.AddChild(node); return node; }
private HierarchyNode GetOrAddDirectory(HierarchyNode node, List<KeyValuePair<HierarchyNode, HierarchyNode>> addedItems, string dir) { var existingDir = node.FindImmediateChildByName(Path.GetFileName(dir)); if (existingDir == null) { existingDir = CreateFolderNode(dir); addedItems.Add(new KeyValuePair<HierarchyNode, HierarchyNode>(node, existingDir)); node.AddChild(existingDir); } return existingDir; }
private void AddExistingDirectory(HierarchyNode node, string path, List<KeyValuePair<HierarchyNode, HierarchyNode>> addedItems) { foreach (var dir in Directory.GetDirectories(path)) { var existingDir = GetOrAddDirectory(node, addedItems, dir); AddExistingDirectory(existingDir, dir, addedItems); } foreach (var file in Directory.GetFiles(path)) { var existingFile = node.FindImmediateChildByName(Path.GetFileName(file)); if (existingFile == null) { existingFile = CreateFileNode(file); addedItems.Add(new KeyValuePair<HierarchyNode, HierarchyNode>(node, existingFile)); node.AddChild(existingFile); } } }
public virtual int AddNewScript(HierarchyNode parent) { string new_name = "NewScript"; int marker = 1; string name = new_name + marker.ToString() + ".ctl"; while (!Utilities.IsNameUniqueInFirstLevelOfNode(this, name) && marker < 100) { ++marker; name = new_name + marker.ToString() + ".ctl"; } if (marker < 100) { System.IO.File.Create(ProjectMgr.ProjectFolder + "\\" + name); CogaenEditFile file = new CogaenEditFile(name, this.ProjectMgr, null); parent.AddChild(file); IVsUIHierarchyWindow uiWindow = UIHierarchyUtilities.GetUIHierarchyWindow(this.ProjectMgr.Site, SolutionExplorer); // This happens in the context of adding a new folder. // Since we are already in solution explorer, it is extremely unlikely that we get a null return. // If we do, the newly created folder will not be selected, and we will not attempt the rename // command (since we are selecting the wrong item). if (uiWindow != null) { // we need to get into label edit mode now... // so first select the new guy... int result = uiWindow.ExpandItem(this.ProjectMgr, file.ID, EXPANDFLAGS.EXPF_SelectItem); ErrorHandler.ThrowOnFailure(result); // them post the rename command to the shell. Folder verification and creation will // happen in the setlabel code... IVsUIShell shell = this.ProjectMgr.Site.GetService(typeof(SVsUIShell)) as IVsUIShell; Debug.Assert(shell != null, "Could not get the ui shell from the project"); if (shell == null) { return VSConstants.E_FAIL; } object dummy = null; Guid cmdGroup = VsMenus.guidStandardCommandSet97; ErrorHandler.ThrowOnFailure(shell.PostExecCommand(ref cmdGroup, (uint)VsCommands.Rename, 0, ref dummy)); } return VSConstants.S_OK; } else return VSConstants.E_FAIL; }
// KLiss: body of this method is copy/pasted from base one (and modified), // as base implementation does not allow changing parent node on-the-fly. protected override void AddNewFileNodeToHierarchy(HierarchyNode parentNode, string fileName) { HierarchyNode child; HierarchyNode newParent; // KLiss: try to find possible parent file (ie, Form3.n would be parent for Form3.designer.n bool parentFound = TryFindParentFileNode(parentNode, fileName, out newParent); if (parentFound) { parentNode = newParent; // KLiss: when file is added to project, it is treated as code file, // regardless of SubType value, specified in the template. // SubType is assigned correct value later, and now we will make another // attempt to find out, whether it is OK for an item to have designer, or not. var nemerleParent = parentNode as NemerleFileNode; if (nemerleParent != null) { nemerleParent.InferHasDesignerFromSubType(); } } // In the case of subitem, we want to create dependent file node // and set the DependentUpon property if (parentFound || parentNode is FileNode || parentNode is DependentFileNode) { child = this.CreateDependentFileNode(fileName); child.ItemNode.SetMetadata(ProjectFileConstants.DependentUpon, parentNode.ItemNode.GetMetadata(ProjectFileConstants.Include)); // Make sure to set the HasNameRelation flag on the dependent node if it is related to the parent by name if (!child.HasParentNodeNameRelation && string.Compare(child.GetRelationalName(), parentNode.GetRelationalName(), StringComparison.OrdinalIgnoreCase) == 0) { child.HasParentNodeNameRelation = true; } } else { //Create and add new filenode to the project child = this.CreateFileNode(fileName); } parentNode.AddChild(child); var projectInfo = ProjectInfo; if (projectInfo != null) projectInfo.Engine.RequestOnBuildTypesTree(); //// TODO : Revisit the VSADDFILEFLAGS here. Can it be a nested project? //this.tracker.OnItemAdded(fileName, VSADDFILEFLAGS.VSADDFILEFLAGS_NoFlags); }
protected virtual FolderNode VerifySubFolderExists(string path, HierarchyNode parent) { FolderNode folderNode = null; uint uiItemId; Url url = new Url(this.BaseURI, path); string strFullPath = url.AbsoluteUrl; // Folders end in our storage with a backslash, so add one... this.ParseCanonicalName(strFullPath, out uiItemId); if (uiItemId != (uint)VSConstants.VSITEMID.Nil) { Debug.Assert(this.NodeFromItemId(uiItemId) is FolderNode, "Not a FolderNode"); folderNode = (FolderNode)this.NodeFromItemId(uiItemId); } if (folderNode == null && path != null && parent != null) { // folder does not exist yet... // We could be in the process of loading so see if msbuild knows about it ProjectElement item = null; foreach (MSBuild.ProjectItem folder in buildProject.GetItems(ProjectFileConstants.Folder)) { if (String.Compare(folder.EvaluatedInclude.TrimEnd('\\'), path.TrimEnd('\\'), StringComparison.OrdinalIgnoreCase) == 0) { item = new ProjectElement(this, folder, false); break; } } // If MSBuild did not know about it, create a new one if (item == null) item = this.AddFolderToMsBuild(path); folderNode = this.CreateFolderNode(path, item); parent.AddChild(folderNode); } return folderNode; }
private IEnumerable<IPackage> BuildModuleHierarchy(HierarchyNode parent, IEnumerable<IPackage> modules, IReadOnlyDictionary<string, DependencyNode> recycle) { if (modules == null) { return Enumerable.Empty<IPackage>(); } var newModules = new List<IPackage>(); foreach (var package in modules) { DependencyNode child; if (recycle.ContainsKey(package.Name)) { child = recycle[package.Name]; child.Package = package; } else { child = new DependencyNode(_projectNode, parent as DependencyNode, package); parent.AddChild(child); newModules.Add(package); } ReloadHierarchy(child, package.Modules); if (ProjectMgr.ParentHierarchy != null) { child.ExpandItem(EXPANDFLAGS.EXPF_CollapseFolder); } } return newModules; }
/// <summary> /// Add a dependent file node to the hierarchy /// </summary> /// <param name="item">msbuild item to add</param> /// <param name="parentNode">Parent Node</param> /// <returns>Added node</returns> private HierarchyNode AddDependentFileNodeToNode(MSBuild.ProjectItem item, HierarchyNode parentNode) { FileNode node = this.CreateDependentFileNode(new ProjectElement(this, item, false)); parentNode.AddChild(node); // Make sure to set the HasNameRelation flag on the dependent node if it is related to the parent by name if (!node.HasParentNodeNameRelation && string.Compare(node.GetRelationalName(), parentNode.GetRelationalName(), StringComparison.OrdinalIgnoreCase) == 0) { node.HasParentNodeNameRelation = true; } return node; }
/// <summary> /// Adds a folder into the project recursing and adding any sub-files and sub-directories. /// /// The user can be prompted to overwrite the existing files if the folder already exists /// in the project. They will be initially prompted to overwrite - if they answer no t /// we'll set promptOverwrite to false and when we recurse we won't prompt. If they say /// yes then we'll set it to true and we will prompt for individual files. /// </summary> private int AddDirectory(VSADDRESULT[] result, HierarchyNode n, string file, bool? promptOverwrite) { // need to recursively add all of the directory contents var fullPath = Path.Combine(GetBaseDirectoryForAddingFiles(n), Path.GetFileName(file)); HierarchyNode targetFolder = n.FindChild(fullPath, false); if (targetFolder == null) { var newChild = CreateFolderNode(fullPath); n.AddChild(newChild); targetFolder = newChild; } else if (promptOverwrite == null) { var res = MessageBox.Show( String.Format( @"This folder already contains a folder called '{0}'. If the files in the existing folder have the same names as files in the folder you are copying, do you want to replace the existing files?", Path.GetFileName(file)), "Merge Folders", MessageBoxButtons.YesNoCancel ); // yes means prompt for each file // no means don't prompt for any of the files // cancel means forget what I'm doing switch (res) { case DialogResult.Cancel: result[0] = VSADDRESULT.ADDRESULT_Cancel; return (int)OleConstants.OLECMDERR_E_CANCELED; case DialogResult.No: promptOverwrite = false; return VSConstants.S_OK; case DialogResult.Yes: promptOverwrite = true; break; } } // add the files... var dirFiles = Directory.GetFiles(file); Guid empty = Guid.Empty; var subRes = AddItemWithSpecificInternal( targetFolder.ID, VSADDITEMOPERATION.VSADDITEMOP_CLONEFILE, null, (uint)dirFiles.Length, dirFiles, IntPtr.Zero, 0, ref empty, null, ref empty, result, promptOverwrite: promptOverwrite ); if (ErrorHandler.Failed(subRes)) { return subRes; } // add any subdirectories... var subDirs = Directory.GetDirectories(file); return AddItemWithSpecificInternal( targetFolder.ID, VSADDITEMOPERATION.VSADDITEMOP_CLONEFILE, null, (uint)subDirs.Length, subDirs, IntPtr.Zero, 0, ref empty, null, ref empty, result, promptOverwrite: promptOverwrite ); }
/// <summary> /// Renames the file in the hierarchy by removing old node and adding a new node in the hierarchy. /// </summary> /// <param name="oldFileName">The old file name.</param> /// <param name="newFileName">The new file name</param> /// <param name="newParentId">The new parent id of the item.</param> /// <returns>The newly added FileNode.</returns> /// <remarks>While a new node will be used to represent the item, the underlying MSBuild item will be the same and as a result file properties saved in the project file will not be lost.</remarks> internal FileNode RenameFileNode(string oldFileName, string newFileName, HierarchyNode newParent) { if (CommonUtils.IsSamePath(oldFileName, newFileName)) { // We do not want to rename the same file return null; } //If we are included in the project and our parent isn't then //we need to bring our parent into the project if (!this.IsNonMemberItem && newParent.IsNonMemberItem) { ErrorHandler.ThrowOnFailure(newParent.IncludeInProject(false)); } // Retrieve child nodes to add later. List<HierarchyNode> childNodes = this.GetChildNodes(); FileNode renamedNode; using (this.ProjectMgr.ExtensibilityEventsDispatcher.Suspend()) { // Remove this from its parent. ProjectMgr.OnItemDeleted(this); this.Parent.RemoveChild(this); // Update name in MSBuild this.ItemNode.Rename(CommonUtils.GetRelativeFilePath(ProjectMgr.ProjectHome, newFileName)); // Request a new file node be made. This is used to replace the old file node. This way custom // derived FileNode types will be used and correctly associated on rename. This is useful for things // like .txt -> .js where the file would now be able to be a startup project/file. renamedNode = this.ProjectMgr.CreateFileNode(this.ItemNode); renamedNode.ItemNode.RefreshProperties(); renamedNode.UpdateCaption(); newParent.AddChild(renamedNode); renamedNode.Parent = newParent; } UpdateCaption(); ProjectMgr.ReDrawNode(renamedNode, UIHierarchyElement.Caption); renamedNode.ProjectMgr.ExtensibilityEventsDispatcher.FireItemRenamed(this, oldFileName); //Update the new document in the RDT. DocumentManager.RenameDocument(renamedNode.ProjectMgr.Site, oldFileName, newFileName, renamedNode.ID); //Select the new node in the hierarchy renamedNode.ExpandItem(EXPANDFLAGS.EXPF_SelectItem); // Add children to new node and rename them appropriately. childNodes.ForEach(x => renamedNode.AddChild(x)); RenameChildNodes(renamedNode); return renamedNode; }
// the .vstemplate does the work for me!!! Yehay! ///// <summary> ///// Overriding to provide customization of files on add files. ///// This will replace tokens in the file with actual value (namespace, class name,...) ///// </summary> ///// <param name="source">Full path to template file.</param> ///// <param name="target">Full path to destination file.</param> ///// <exception cref="FileNotFoundException">Template file is not founded.</exception> ////public override void AddFileFromTemplate(string source, string target) //{ // if (!File.Exists(source)) // { // throw new FileNotFoundException(string.Format("Template file not found: {0}", source)); // } // if (Path.GetExtension(source).ToUpper() != ".RES") // { // // The class name is based on the new file name // string fileName = Path.GetFileNameWithoutExtension(target); // string nameSpace = this.FileTemplateProcessor.GetFileNamespace(target, this); // this.FileTemplateProcessor.AddReplace("%className%", fileName); // this.FileTemplateProcessor.AddReplace("%namespace%", nameSpace); // try // { // this.FileTemplateProcessor.UntokenFile(source, target); // } // catch (Exception exceptionObj) // { // throw new FileLoadException(Resources.ResourceManager.GetString("MsgFailedToLoadTemplateFile"), target, exceptionObj); // } // } //} /// <summary> /// Copies files to the visual studio project from the absolute file path provided or /// the current working directory for releative paths. /// </summary> /// <param name="aFileList">List of files to copy</param> /// <param name="aParentNode">What parent node to place under null = project</param> /// <param name="aMayHaveDirectiveFiles">The files may have dependent files that need to be copied</param> private void CopyFilesToVSProject(string[] aFileList, HierarchyNode aParentNode, bool aMayHaveDirectiveFiles) { string lNewFile; FileNode lFileNode; if (aParentNode == null) { aParentNode = this; } string lDestPath = Path.GetDirectoryName(aParentNode.Url); foreach (string lFile in aFileList) { /* * This code Preserves the folder structure * and will do no copying if the file exists in the * parent node folder */ // Check to see if the file has an absolute path if (!Path.IsPathRooted(lFile)) { // build a path to the new project folder based on the relative path found in file string lPath = Path.GetDirectoryName(lFile); // the path can be empty either because this is a dependent file or the file will be placed in the dest path. // ie "" or "MyCode\" or "..\..\MyCode" or ".\" lPath = Path.Combine(lDestPath, lPath); // removed any .\ or ..\ lPath = Path.GetFullPath(lPath); // check to see if in the new location the folder does not exist. if (!Directory.Exists(lPath)) { Directory.CreateDirectory(lPath);// create it. } lNewFile = Path.Combine(lPath, Path.GetFileName(lFile)); } else { // If the file is rooted thats a No No and it will be copied to the project aDestPath or lNewFile = System.IO.Path.Combine(lDestPath, System.IO.Path.GetFileName(lFile)); } if (!File.Exists(lNewFile)) { System.IO.File.Copy(lFile, lNewFile); } lNewFile = Utilities.GetFileNameInProperCase(lNewFile); // by creating the node it addes it to the MSBuild project file if (aParentNode is DelphiFileNode) { // if there is a parent node where this project belongs lets add it as dependent lFileNode = this.CreateDependentFileNode(lNewFile); aParentNode.AddChild(lFileNode); lFileNode.ItemNode.SetMetadata(ProjectFileConstants.DependentUpon, aParentNode.ItemNode.GetMetadata(ProjectFileConstants.Include)); // TODO: A method is needed on the depenent node to rename it with the same name so that // the parent will update its filename reference to the correct relative path. } else { lFileNode = this.CreateFileNode(lNewFile); } // the delphi file may have directive files files {$R filename} or {$I filename} lets attach them as dependents. if (aMayHaveDirectiveFiles && lFileNode is DelphiFileNode) { // // TODO: if the lFile is an absolute path we need to copy all files over to the same folder // the reason fo this is the directive file may be on {$I 'E:\myinc.inc'} but the main file // is on C:\Files and VS does not like it. // // Most cases the directive files are in the same path // but for the corner case where it is not we need to // change the working dir to the path of the current file string lSourcePath = Path.GetDirectoryName(Path.GetFullPath(lFile)); // save it first string lOldPath = Environment.CurrentDirectory; try { Environment.CurrentDirectory = lSourcePath; CopyFilesToVSProject(((DelphiFileNode)lFileNode).GetDirectiveFiles(), lFileNode, false); } finally { // put it back even after error. // trying to avoid a bad state even though it may occur anyway Environment.CurrentDirectory = lOldPath; } } } }
/// <summary> /// Описание иерархии /// </summary> /// <param name="joints"></param> /// <returns></returns> private static HierarchyNode BuildTree(JointCollection joints) { var root = new HierarchyNode(new SkeletonPoint(), JointType.HipCenter, ConstBodyPoints.Hips); HierarchyNode node = null; //Ветка: Корень - Левая часть рутового креста - Левое бедро - левая коленка - левая лодыжка - Энд сайт(Также пусть будет лодыжка) node = root.AddChild(new HierarchyNode(new SkeletonPoint(), JointType.CrossLeft, ConstBodyPoints.LeftCross)); node = node.AddChild(new HierarchyNode(new SkeletonPoint(), JointType.HipLeft, ConstBodyPoints.LeftHip)); node = node.AddChild(new HierarchyNode(new SkeletonPoint(), JointType.KneeLeft, ConstBodyPoints.LeftKnee)); node = node.AddChild(new HierarchyNode(new SkeletonPoint(), JointType.AnkleLeft, ConstBodyPoints.LeftAnkle)); node.AddChild(new HierarchyNode(new SkeletonPoint(), JointType.FootLeft, ConstBodyPoints.Site)); //Ветка: Корень - Правое бедро - правая коленка - правая лодыжка - Энд сайт node = root.AddChild(new HierarchyNode(new SkeletonPoint(), JointType.CrossRight, ConstBodyPoints.RightCross)); node = node.AddChild(new HierarchyNode(new SkeletonPoint(), JointType.HipRight, ConstBodyPoints.RightHip)); node = node.AddChild(new HierarchyNode(new SkeletonPoint(), JointType.KneeRight, ConstBodyPoints.RightKnee)); node = node.AddChild(new HierarchyNode(new SkeletonPoint(), JointType.AnkleRight, ConstBodyPoints.RightAnkle)); node.AddChild(new HierarchyNode(new SkeletonPoint(), JointType.FootRight, ConstBodyPoints.Site)); //Ветка: Корень - Верхняя часть рутового креста - Поясница - Левая ключица - Левое плечо - Левый локоть - Левая кисть - Энд сайт node = root.AddChild(new HierarchyNode(new SkeletonPoint(), JointType.CrossUp, ConstBodyPoints.UpCross)); var chestNode = node.AddChild(new HierarchyNode(new SkeletonPoint(), JointType.Spine, ConstBodyPoints.Chest)); node = chestNode.AddChild(new HierarchyNode(new SkeletonPoint(), JointType.ShoulderCenter, ConstBodyPoints.LeftCollar)); node = node.AddChild(new HierarchyNode(new SkeletonPoint(), JointType.ShoulderLeft, ConstBodyPoints.LeftShoulder)); node = node.AddChild(new HierarchyNode(new SkeletonPoint(), JointType.ElbowLeft, ConstBodyPoints.LeftElbow)); node = node.AddChild(new HierarchyNode(new SkeletonPoint(), JointType.WristLeft, ConstBodyPoints.LeftWrist)); node.AddChild(new HierarchyNode(new SkeletonPoint(), JointType.HandLeft, ConstBodyPoints.Site)); //Ветка:Поясница - Левая ключица - Левое плечо - Левый локоть - Левая кисть - Энд сайт node = chestNode.AddChild(new HierarchyNode(new SkeletonPoint(), JointType.ShoulderCenter, ConstBodyPoints.RightCollar)); node = node.AddChild(new HierarchyNode(new SkeletonPoint(), JointType.ShoulderRight, ConstBodyPoints.RightShoulder)); node = node.AddChild(new HierarchyNode(new SkeletonPoint(), JointType.ElbowRight, ConstBodyPoints.RightElbow)); node = node.AddChild(new HierarchyNode(new SkeletonPoint(), JointType.WristRight, ConstBodyPoints.RightWrist)); node.AddChild(new HierarchyNode(new SkeletonPoint(), JointType.HandRight, ConstBodyPoints.Site)); //Ветка: Шея - Средняя точка головы - Энд Сайт node = chestNode.AddChild(new HierarchyNode(new SkeletonPoint(), JointType.ShoulderCenter, ConstBodyPoints.Neck)); node = node.AddChild(new HierarchyNode(new SkeletonPoint(), JointType.Head, ConstBodyPoints.Head)); node.AddChild(new HierarchyNode(new SkeletonPoint(), JointType.Head, ConstBodyPoints.Site)); return root; }
/// <summary> /// Initializes and adds a file or folder visible only when Show All files is enabled /// </summary> private void AddAllFilesNode(HierarchyNode parent, HierarchyNode newNode) { newNode.IsVisible = IsShowingAllFiles; newNode.ID = ItemIdMap.Add(newNode); parent.AddChild(newNode); }