Beispiel #1
0
        private void FindAllProjectFiles(string solutionFile, List <string> projectFiles, List <DocumentedAssembly> references)
        {
            MatchCollection projectFileMatches = Regex.Matches(solutionFile, V10ProjectPattern);

            foreach (Match current in projectFileMatches)
            {
                if (current.Groups.Count == 2)
                {
                    string projectFile = current.Groups[1].Value;
                    if (ValidExtensions.Contains(Path.GetExtension(projectFile)))
                    {
                        projectFiles.Add(projectFile);
                    }
                }
            }

            foreach (string project in projectFiles)
            {
                string fullProjectPath = Path.GetDirectoryName(FileName) + "\\" + project;
                if (File.Exists(fullProjectPath))
                {
                    ProjectFileReader reader = ProjectFileReader.Create(fullProjectPath, _filesystem);
                    reader.BuildConfiguration = BuildConfiguration;
                    references.AddRange(reader.Read());
                }
            }
        }
Beispiel #2
0
        /// <summary>
        /// Reads and parses the file and returns all of the associated library
        /// references
        /// </summary>
        /// <include file='code-documentation\inputfilereader.xml' path='docs/inputfilereader/member[@name="Read"]/*' />
        public List <DocumentedAssembly> Read(string fileName, string buildConfiguration)
        {
            if (string.IsNullOrEmpty(fileName))
            {
                throw new ArgumentNullException("fileName");
            }

            List <DocumentedAssembly> files = null;
            FileReader reader = null;

            switch (Path.GetExtension(fileName).ToLower())
            {
            case ".sln":
                reader = new SolutionFileReader(fileName, _filesystem);
                break;

            case ".csproj":
            case ".vbproj":
            case ".vcproj":
                reader = ProjectFileReader.Create(fileName, _filesystem);
                break;

            case ".dll":
            case ".exe":
                reader = new LibraryFileReader(fileName);
                break;

            default:
                throw new ArgumentException("Provided filename is for a non valid file type", fileName);
            }

            reader.BuildConfiguration = string.IsNullOrEmpty(buildConfiguration) ? "Debug" : buildConfiguration;
            files = reader.Read();

            return(files);
        }