private void ParseProjects(ParserOptions parserOptions) { var projects = parserOptions.CodeSolution.Projects.ToList(); for (int i = 0; i < projects.Count; i++) { var project = projects[i]; ExecuteOnStepMessage(string.Format(_parserStrings.CompilingAndParsing, project.Name)); ExecuteOnStepProgress((int)((double)i / projects.Count * 50)); var projectCompilation = project.GetCompilationAsync().Result; var targetFx = _targetFxParser.GetTargetFx(project.FilePath); var sdRepository = parserOptions.SDSolution.GetExistingOrNew(targetFx); parserOptions.SDRepository = sdRepository; var nparser = new NamespaceParser(parserOptions); nparser.ParseProjectNamespacesRecursively(projectCompilation.Assembly.GlobalNamespace); if (!_seeTokens.ContainsKey(targetFx)) { _seeTokens.Add(targetFx, new List <SDToken>()); } _seeTokens[targetFx].AddRange(parserOptions.SeeTokens); } ExecuteOnStepProgress(40); }
// Workaround since MsTest doesn't have "TestCase" where we can put in parameters private void TestProjectFx(string relativeProjectFile, SDTargetFx expectedFx) { var assemblyDirectory = Path.GetDirectoryName(GetType().Assembly.Location); var fullPath = Path.Combine(assemblyDirectory, relativeProjectFile); var targetFxParser = new SDTargetFxParser(); var actualFx = targetFxParser.GetTargetFx(fullPath); Assert.AreEqual(expectedFx.Identifier, actualFx.Identifier, string.Format("Failed when determining the target fx for '{0}'", relativeProjectFile)); }
private SDSolution ParseSolution(CSharpSolution solution, ICoreConfigSection sharpDoxConfig, Dictionary<string, string> tokens, bool structured) { var sdSolution = new SDSolution(solution.SolutionFile); var targetFxParser = new SDTargetFxParser(); _currentProjectIndex = 1; _totalProjects = solution.Projects.Count; for (var i = 0; i < solution.Projects.Count; i++) { ExecuteOnStepProgress((int)(((double)i / (double)solution.Projects.Count) * 50) + 20); var project = solution.Projects[i]; var projectFileName = project.FileName; var targetFx = targetFxParser.GetTargetFx(projectFileName); var sdRepository = sdSolution.GetExistingOrNew(targetFx); if (structured) { StructureParseNamespaces(project, sdRepository); StructureParseTypes(project, sdRepository); } else { ParseNamespaces(project, sdRepository, sharpDoxConfig, tokens); ParseTypes(project, sdRepository, sharpDoxConfig); // Because of excluding privates, internals and protected members // it is possible, that a namespace has no visible namespaces at all. // It is necessary to remove empty namespaces. RemoveEmptyNamespaces(sdRepository); } _currentProjectIndex++; } ExecuteOnStepProgress(80); if (!structured) { var i = 0; foreach (var sdRepository in sdSolution.Repositories) { ParseMethodCalls(solution, sdRepository); ResolveUses(sdRepository); } } return sdSolution; }
private SDSolution ParseSolution(CSharpSolution solution, ICoreConfigSection sharpDoxConfig, Dictionary <string, string> tokens, bool structured) { var sdSolution = new SDSolution(solution.SolutionFile); var targetFxParser = new SDTargetFxParser(); _currentProjectIndex = 1; _totalProjects = solution.Projects.Count; for (var i = 0; i < solution.Projects.Count; i++) { ExecuteOnStepProgress((int)(((double)i / (double)solution.Projects.Count) * 50) + 20); var project = solution.Projects[i]; var projectFileName = project.FileName; var targetFx = targetFxParser.GetTargetFx(projectFileName); var sdRepository = sdSolution.GetExistingOrNew(targetFx); if (structured) { StructureParseNamespaces(project, sdRepository); StructureParseTypes(project, sdRepository); } else { ParseNamespaces(project, sdRepository, sharpDoxConfig, tokens); ParseTypes(project, sdRepository, sharpDoxConfig); // Because of excluding privates, internals and protected members // it is possible, that a namespace has no visible namespaces at all. // It is necessary to remove empty namespaces. RemoveEmptyNamespaces(sdRepository); } _currentProjectIndex++; } ExecuteOnStepProgress(80); if (!structured) { var i = 0; foreach (var sdRepository in sdSolution.Repositories) { ParseMethodCalls(solution, sdRepository); ResolveUses(sdRepository); } } return(sdSolution); }
// Workaround since MsTest doesn't have "TestCase" where we can put in parameters private void TestProjectFx(string relativeProjectFile, SDTargetFx expectedFx) { var assemblyDirectory = Path.GetDirectoryName(GetType().Assembly.Location); var fullPath = Path.Combine(assemblyDirectory, relativeProjectFile); var targetFxParser = new SDTargetFxParser(); var actualFx = targetFxParser.GetTargetFx(fullPath); Assert.AreEqual(expectedFx.Identifier, actualFx.Identifier, string.Format("Failed when determining the target fx for '{0}'", relativeProjectFile)); }