private void ScanProjectReferences(IList <SolutionProject> projects, SolutionFileVersion solutionFileVersion,
                                           IEnumerable <string> includeFilter, IEnumerable <string> excludeFilter)
        {
            var referencedProjects = new List <SolutionProject>();

            foreach (var project in projects)
            {
                ScanProjectReferences(project, referencedProjects, solutionFileVersion, includeFilter, excludeFilter);
            }

            foreach (var referencedProject in referencedProjects)
            {
                if (!projects.Any(x => x.Path.Equals(referencedProject.Path, StringComparison.InvariantCultureIgnoreCase)))
                {
                    projects.Add(referencedProject);
                }
            }
        }
示例#2
0
        public bool IsProjectFile(SolutionFileVersion solutionFileVersion)
        {
            if (string.IsNullOrEmpty(Path.GetExtension(_fullPath)))
            {
                return false;
            }

            string fileExtension = Path.GetExtension(_fullPath).ToLower().Substring(1); // Remove leading "."
            var projectType = ProjectTypes.Find(fileExtension);
            if (projectType != null && (solutionFileVersion & projectType.SupportedVersions) != 0)
            {
                return GetProjectId() != Guid.Empty;
            }
            else
            {
                return false;
            }
        }
示例#3
0
        public bool IsProjectFile(SolutionFileVersion solutionFileVersion)
        {
            if (string.IsNullOrEmpty(Path.GetExtension(_fullPath)))
            {
                return(false);
            }

            string fileExtension = Path.GetExtension(_fullPath).ToLower().Substring(1); // Remove leading "."
            var    projectType   = ProjectTypes.Find(fileExtension);

            if (projectType != null && (solutionFileVersion & projectType.SupportedVersions) != 0)
            {
                return(GetProjectId() != Guid.Empty);
            }
            else
            {
                return(false);
            }
        }
        private void ScanProjectDirectory(DirectoryInfo dir, IList<SolutionProject> projects, SolutionFileVersion solutionFileVersion,
            IEnumerable<string> includeFilter, IEnumerable<string> excludeFilter, bool recursive)
        {
            FileSystemInfo[] files = dir.GetFileSystemInfos();
            foreach (FileSystemInfo file in files)
            {
                var projectAnalyzer = new ProjectAnalyzer(file.FullName);
                if (projectAnalyzer.IsProjectFile(solutionFileVersion))
                {
                    ProcessProjectFile(file.FullName, projects, includeFilter, excludeFilter, projectAnalyzer, false);
                }
            }

            if (recursive)
            {
                foreach (var subdir in dir.GetDirectories("*"))
                {
                    ScanProjectDirectory(subdir, projects, solutionFileVersion, includeFilter, excludeFilter, recursive);
                }
            }
        }
        private void ScanProjectDirectory(DirectoryInfo dir, IList <SolutionProject> projects, SolutionFileVersion solutionFileVersion,
                                          IEnumerable <string> includeFilter, IEnumerable <string> excludeFilter, bool recursive)
        {
            FileSystemInfo[] files = dir.GetFileSystemInfos();
            foreach (FileSystemInfo file in files)
            {
                var projectAnalyzer = new ProjectAnalyzer(file.FullName);
                if (projectAnalyzer.IsProjectFile(solutionFileVersion))
                {
                    ProcessProjectFile(file.FullName, projects, includeFilter, excludeFilter, projectAnalyzer, false);
                }
            }

            if (recursive)
            {
                foreach (var subdir in dir.GetDirectories("*"))
                {
                    ScanProjectDirectory(subdir, projects, solutionFileVersion, includeFilter, excludeFilter, recursive);
                }
            }
        }
        private void ScanProjectReferences(SolutionProject project, IList <SolutionProject> referencedProjects, SolutionFileVersion solutionFileVersion,
                                           IEnumerable <string> includeFilter, IEnumerable <string> excludeFilter)
        {
            var projectAnalyzer   = new ProjectAnalyzer(Path.Combine(this._options.SolutionFolderPath, project.Path));
            var projectReferences = projectAnalyzer.GetProjectReferences();

            foreach (var projectReference in projectReferences)
            {
                if (File.Exists(projectReference.Path))
                {
                    ProcessProjectFile(projectReference.Path, referencedProjects, includeFilter, excludeFilter, projectAnalyzer, true);
                    ScanProjectReferences(projectReference, referencedProjects, solutionFileVersion, includeFilter, excludeFilter);
                }
            }
        }
 private void ScanProjectReferences(SolutionProject project, IList<SolutionProject> referencedProjects, SolutionFileVersion solutionFileVersion,
     IEnumerable<string> includeFilter, IEnumerable<string> excludeFilter)
 {
     var projectAnalyzer = new ProjectAnalyzer(Path.Combine(this._options.SolutionFolderPath, project.Path));
     var projectReferences = projectAnalyzer.GetProjectReferences();
     foreach (var projectReference in projectReferences)
     {
         if (File.Exists(projectReference.Path))
         {
             ProcessProjectFile(projectReference.Path, referencedProjects, includeFilter, excludeFilter, projectAnalyzer, true);
             ScanProjectReferences(projectReference, referencedProjects, solutionFileVersion, includeFilter, excludeFilter);
         }
     }
 }
        private void ScanProjectReferences(IList<SolutionProject> projects, SolutionFileVersion solutionFileVersion,
            IEnumerable<string> includeFilter, IEnumerable<string> excludeFilter)
        {
            var referencedProjects = new List<SolutionProject>();
            foreach (var project in projects)
            {
                ScanProjectReferences(project, referencedProjects, solutionFileVersion, includeFilter, excludeFilter);
            }

            foreach (var referencedProject in referencedProjects)
            {
                if (!projects.Any(x => x.Path.Equals(referencedProject.Path, StringComparison.InvariantCultureIgnoreCase)))
                {
                    projects.Add(referencedProject);
                }
            }
        }