Exemple #1
0
        private void PopulateDirectories(GenericNodeList nodesToDie, bool recursive)
        {
            foreach (string directory in Directory.GetDirectories(BackingPath))
            {
                if (IsDirectoryExcluded(directory))
                {
                    continue;
                }

                DirectoryNode node;
                if (Tree.NodeMap.ContainsKey(directory))
                {
                    node = Tree.NodeMap[directory] as DirectoryNode;
                    if (node != null) // ASClassWizard injects SimpleDirectoryNode != DirectoryNode
                    {
                        if (recursive)
                        {
                            node.Refresh(recursive);
                        }

                        nodesToDie.Remove(node);
                        continue;
                    }
                    else
                    {
                        Nodes.Remove(node);
                    }
                }

                node = new DirectoryNode(directory);
                InsertNode(Nodes, node);
                node.Refresh(recursive);
                nodesToDie.Remove(node);
            }
        }
        private void PopulateFiles(GenericNodeList nodesToDie, bool recursive)
        {
            string[] files = Directory.GetFiles(BackingPath);

            foreach (string file in files)
            {
                if (IsFileExcluded(file))
                {
                    continue;
                }

                if (Tree.NodeMap.ContainsKey(file))
                {
                    GenericNode node = Tree.NodeMap[file];
                    node.Refresh(recursive);
                    nodesToDie.Remove(node);
                }
                else
                {
                    FileNode node = FileNode.Create(file, project);
                    InsertNode(Nodes, node);
                    node.Refresh(recursive);
                    nodesToDie.Remove(node);
                }
            }

            FileMapping mapping = GetFileMapping(files);

            if (mapping == null)
            {
                return;
            }

            foreach (string file in files)
            {
                if (IsFileExcluded(file))
                {
                    continue;
                }

                GenericNode node = Tree.NodeMap[file];

                // ensure this file is in the right spot
                if (mapping != null && mapping.ContainsKey(file) && Tree.NodeMap.ContainsKey(mapping[file]))
                {
                    EnsureParentedBy(node, Tree.NodeMap[mapping[file]]);
                }
                else
                {
                    EnsureParentedBy(node, this);
                }
            }
        }
 private GenericNode ReuseNode(string absolute, GenericNodeList nodesToDie)
 {
     foreach (GenericNode node in nodesToDie)
     {
         if (node.BackingPath == absolute)
         {
             nodesToDie.Remove(node);
             Nodes.Remove(node);
             return(node);
         }
     }
     return(null);
 }