Exemplo n.º 1
0
        /// <summary>
        /// Get the namespace members of the given workspace
        /// </summary>
        /// <param name="workspaceFilePaths">The workspace file paths, can be singular</param>
        /// <param name="isSolution">If true, the file is handled as a solution, only used when the workspace file paths contains one value</param>
        /// <param name="includeTestProjects">If true, the testprojects of a solution will be loaded as well</param>
        /// <returns>A list of named type symbols to analyze</returns>
        private async Task <List <INamedTypeSymbol> > GetNamespaceMembers(List <string> workspaceFilePaths, bool isSolution)
        {
            var symbolProvider = new SymbolProvider();

            if (workspaceFilePaths.Count < 1)
            {
                throw new Exception("No workspace file path given.");
            }

            if (workspaceFilePaths.Count > 1)
            {
                return(await symbolProvider.GetNamedTypeSymbolsFromProjectFiles(workspaceFilePaths));
            }

            if (isSolution)
            {
                return(await symbolProvider.GetNamedTypeSymbolsFromSolutionFile(workspaceFilePaths[0]));
            }
            else
            {
                return(await symbolProvider.GetNamedTypeSymbolsFromProjectFile(workspaceFilePaths[0]));
            }
        }