Exemple #1
0
        ProjectFileNode Find(string[] path, int pathIndex, bool create)
        {
            ProjectFileNode child;

            if (Children.TryGetValue(path[pathIndex], out child))
            {
                if (pathIndex + 1 == path.Length)
                {
                    return(child);
                }

                return(child.Find(path, pathIndex + 1, create));
            }

            if (create)
            {
                child = new ProjectFileNode(this, path[pathIndex]);
                Children.Add(child.FileName, child);

                if (pathIndex + 1 == path.Length)
                {
                    return(child);
                }

                return(child.Find(path, pathIndex + 1, create));
            }

            return(null);
        }
Exemple #2
0
        void ProjectVirtualPathChanged(object sender, ProjectFileVirtualPathChangedEventArgs e)
        {
            ProjectFileNode node;

            // Note: if the OldVirtualPath is null, then it means that a Project was just set on the ProjectFile
            // which means that it hasn't yet been added to our VirtualProjectPath tree.
            if (e.OldVirtualPath.IsNotNull)
            {
                node = root.Find(e.OldVirtualPath, false);
                if (node != null)
                {
                    node.Parent.Children.Remove(node.FileName);
                    PruneEmptyParents(node.Parent);
                }
            }

            node             = root.Find(e.NewVirtualPath, true);
            node.ProjectFile = e.ProjectFile;
        }