Esempio n. 1
0
        internal void IncludeFileNode(UntrackedFileNode node)
        {
            string path = node.Url;

            ModuleTracker.UpgradeModule(path);
            TreeOperations.Replace(this, node, () => CreateFileNode(path));
        }
Esempio n. 2
0
        internal void DisableAutoImport(BaseFileNode node)
        {
            var orphans = ModuleTracker.DisableTracking(node.Url);

            foreach (string mod in orphans)
            {
                TreeOperations.RemoveSubnodeFromHierarchy(this, mod, false);
            }
        }
Esempio n. 3
0
        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));
            }
        }
Esempio n. 4
0
        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);
        }
Esempio n. 5
0
        // 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));
            }
        }
Esempio n. 6
0
        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);
                }
            }
        }
Esempio n. 7
0
        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);
        }
Esempio n. 8
0
 protected virtual void OnFileDeleted()
 {
     TreeOperations.DeleteSubnode(ProjectMgr, this.Url);
 }
Esempio n. 9
0
 private void ReplaceWithTracked()
 {
     TreeOperations.Replace(this.ProjectMgr, this, () => this.ProjectMgr.CreateFolderNode(this.Url));
 }