internal void DisableAutoImport(BaseFileNode node) { var orphans = ModuleTracker.DisableTracking(node.Url); foreach (string mod in orphans) { TreeOperations.RemoveSubnodeFromHierarchy(this, mod, false); } }
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); }
// Mass delete all sbunodes that were orphaned by the // removal of a subnode with path `rootPath` public static void DeleteSubnode(RustProjectNode root, string srcpath) { if (root == null) { throw new ArgumentNullException("root"); } if (String.IsNullOrEmpty(srcpath)) { throw new ArgumentException("srcpath"); } var forRemoval = root.ModuleTracker.DeleteModule(srcpath); foreach (string path in forRemoval.Orphans) { TreeOperations.RemoveSubnodeFromHierarchy(root, path, (!forRemoval.IsReferenced) && path.Equals(srcpath, StringComparison.InvariantCultureIgnoreCase)); } }
internal void ExcludeFileNode(BaseFileNode srcNode) { // Ask mod tracker for a professional opinion string fullPath = srcNode.Url; ModuleRemovalResult downgradeResult = ModuleTracker.DowngradeModule(fullPath); if (downgradeResult.IsReferenced) { TreeOperations.Replace(this, srcNode, () => CreateUntrackedNode(fullPath)); } else { foreach (string path in downgradeResult.Orphans) { TreeOperations.RemoveSubnodeFromHierarchy(this, path, false); } } }
public static bool RemoveSubnodeFromHierarchy(RustProjectNode root, string path, bool deleteFromStorage) { if (root == null) { throw new ArgumentNullException("root"); } if (String.IsNullOrEmpty(path)) { throw new ArgumentException("path"); } uint item; root.ParseCanonicalName(path, out item); if (item != (uint)VSConstants.VSITEMID.Nil) { HierarchyNode node = root.NodeFromItemId(item); if (node != null) { TreeOperations.RemoveSubnodeFromHierarchy(root, node, deleteFromStorage); return(true); } } return(false); }