示例#1
0
 public RoslynParser(ParserStrings parserStrings)
 {
     _parserStrings  = parserStrings;
     _roslynLoader   = new RoslynLoader();
     _targetFxParser = new SDTargetFxParser();
     _seeTokens      = new Dictionary <SDTargetFx, List <SDToken> >();
 }
示例#2
0
 public RoslynParser(ParserStrings parserStrings)
 {
     _parserStrings = parserStrings;
     _roslynLoader = new RoslynLoader();
     _targetFxParser = new SDTargetFxParser();
     _seeTokens = new Dictionary<SDTargetFx, List<SDToken>>();
 }
示例#3
0
        // 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));
        }
示例#4
0
        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;
        }
示例#5
0
        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);
        }
示例#6
0
        // 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));
        }