예제 #1
0
        private void NavigateProjectFolder(ProjectItems itemCollection)
        {
            if (itemCollection == null)
            {
                return;
            }

            // ================================================================================
            // Navigate through the solution structure and determine whether
            // valid projects exist that we can add.
            // ================================================================================
            foreach (ProjectItem item in itemCollection)
            {
                if (item.SubProject != null)
                {
                    if (VSUtils.IsValidSolutionProject(item.SubProject.Kind))
                    {
                        if (item.SubProject == null)
                        {
                            continue;
                        }
                        else if (item.SubProject is Project)
                        {
                            ISolutionProject subProject = new VSSolutionProject(this._solution, item.SubProject);
                            this._solution.AddProject(subProject);
                        }
                    }
                    else
                    {
                        NavigateProjectFolder(item.SubProject.ProjectItems);
                    }
                }
                else
                {
                    if (item.Object == null)
                    {
                        continue;
                    }
                    else if (item.Object is Project)
                    {
                        ISolutionProject solutionProject = new VSSolutionProject(this._solution, item.Object as Project);
                        this._solution.AddProject(solutionProject);
                    }
                }
            }
        }