コード例 #1
0
 public ProjectInterfaceResolver(IDictionary <string, IClassStructure> analyzedClasses, IDictionary <string, IFileStructure> analyzedFiles, IDoLog logger)
 {
     _resolver        = new ConcurrentDictionary <string, IClassStructure>();
     _analyzedClasses = analyzedClasses;
     _analyzedFiles   = analyzedFiles;
     _logger          = logger;
 }
コード例 #2
0
        /// <summary>
        /// Uses Microsoft.Build.Locator.MSBuildLocator to locate VisualStudio instances and subsequently the MSBuild executable. Then creates a MSBuildWorkspace.
        /// </summary>
        /// <param name="logger">Logger implementing IDoLog</param>
        /// <param name="selectionHandler">Used when multiple VisualStudio instances are found. Defaults to TakeLastVsInstance.<br/>
        /// If you want to ask the user use SelectVsInstanceOnCli or provide your own implementation.</param>
        public WorkspaceCreator(IDoLog logger = null, ISelectionHandler selectionHandler = null)
        {
            var _ = typeof(Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions); //hack needed to copy Microsoft.CodeAnalysis.CSharp.Workspaces

            _selectionHandler = selectionHandler ?? new TakeLastVsInstance();
            _logger           = logger ?? new NullLogger();
        }
コード例 #3
0
 protected AbstractSyntaxDrawer(IInterfaceResolver interfaceResolver, ISyntaxDrawerFactory drawerFactory, StringBuilder diagramToDrawTo, string entryMethod)
 {
     _interfaceResolver = interfaceResolver;
     _diagram           = diagramToDrawTo;
     _entryMethod       = entryMethod;
     _drawerFactory     = drawerFactory;
     _logger            = new NullLogger();
 }
コード例 #4
0
        public SyntaxDrawerFactory(IDictionary <string, IClassStructure> analyzedClasses, string entryMethod, IDoLog logger)
        {
            _analyzedClasses = analyzedClasses;
            _entryMethod     = entryMethod;
            if (logger == null)
            {
                logger = new NullLogger();
            }

            _logger = logger;
        }
コード例 #5
0
        public SolutionLoader(IWorkspaceCreator workspaceCreator, IDoLog logger = null)
        {
            var _ = typeof(Microsoft.CodeAnalysis.CSharp.SymbolDisplay);

            _workspaceCreator = workspaceCreator;

            if (logger == null)
            {
                logger = new NullLogger();
            }
            _logger = logger;
        }
コード例 #6
0
        public ProjectAnalyzer(Solution solution, IEnumerable <string> solutionOutputFiles, IDoLog logger)
        {
            _solution    = solution;
            _outputFiles = solutionOutputFiles;

            if (logger == null)
            {
                logger = new NullLogger();
            }

            _logger = logger;
        }
コード例 #7
0
        public SequenceDiagramGenerator(IDictionary <string, IClassStructure> analyzedClasses, IInterfaceResolver interfaceResolver, IDoLog logger = null)
        {
            _analyzedClasses = analyzedClasses;
            _diagram         = new StringBuilder();
            _ifaceResolver   = interfaceResolver;
            if (_logger == null)
            {
                _logger = new NullLogger();
            }

            _logger = logger;
        }
コード例 #8
0
        private static async Task RunAnalysis(ProgramOptions options)
        {
            _logger = new ConsoleLogger(verbose: options.VerboseLogging, debug: options.DebugLogging);
            using (var solLoader = new SolutionLoader(_logger))
            {
                var solution = await solLoader.LoadSolution(options.PathToSolution);

                var extractor       = new SymbolExtractorWithCompilation(_logger);
                var declaredSymbols = await extractor.FindSymbols(solution, options.FullTypeName, options.MethodName, options.MethodArguments);

                _logger.Info($"Did not find anything for {options.FullTypeName}.{options.MethodName}({string.Join(", ", options.MethodArguments)})");
                await ArgumentExtraction(declaredSymbols, solution, options);
            }
        }
コード例 #9
0
        public SolutionAnalyzer(string solution, IDoLog logger = null)
        {
            if (!File.Exists(solution))
            {
                throw new FileNotFoundException("Solution not found! Was looking for " + solution);
            }
            _solution = solution;

            if (logger == null)
            {
                logger = new NullLogger();
            }
            _logger = logger;
        }
コード例 #10
0
        public SolutionLoader(IDoLog logger, int?defaultVSInstance = null)
        {
            _logger = logger ?? new NullLogger();

            // Attempt to set the version of MSBuild.
            var visualStudioInstances = MSBuildLocator.QueryVisualStudioInstances().ToArray();
            var instance = GetInstance(visualStudioInstances, defaultVSInstance);

            _logger.Info($"Using MSBuild at '{instance.MSBuildPath}' to load projects.");

            // NOTE: Be sure to register an instance with the MSBuildLocator
            //       before calling MSBuildWorkspace.Create()
            //       otherwise, MSBuildWorkspace won't MEF compose.
            if (!MSBuildLocator.IsRegistered)
            {
                MSBuildLocator.RegisterInstance(instance);
            }
            _workspace = MSBuildWorkspace.Create();
        }
コード例 #11
0
 public SelectVsInstanceOnCli(IDoLog logger)
 {
     _logger = logger ?? new NullLogger();
 }
コード例 #12
0
        public static IInterfaceResolver GetInterfaceResolver(ISolutionAnalyzer soltion, IProjectAnalyzer project, IDoLog logger, ConfigContext ctx)
        {
            if (ctx.IFaceResolver == InterfaceResolverType.ProjectLevel)
            {
                return(new ProjectInterfaceResolver(project.AnalyzedClasses, project.AnalyzedFiles, logger));
            }

            throw new NotImplementedException();
        }
コード例 #13
0
 public ConsoleProgressReporter(IDoLog logger)
 {
     _logger = logger ?? new NullLogger();
 }
 public SymbolExtractorWithSymbolFinder(IDoLog logger)
 {
     _logger = logger ?? new NullLogger();
 }
 public SymbolExtractorWithCompilation(IDoLog logger)
 {
     _logger = logger ?? new NullLogger();
 }
コード例 #16
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="hintPath">Overwrites using of default SDK paths to search for dotNETCore SDKs.</param>
 /// <param name="logger">Implementation of a logger according to the IDoLog interface, defaults to NullLogger.</param>
 /// <param name="msBuildLocator">Supply your own search logic to locate MSBuild.dll by implementing the IMsBuildLocator interface.</param>
 public WorkspaceCreator(string hintPath = "", IDoLog logger = null, IMsBuildLocator msBuildLocator = null)
 {
     _logger   = logger ?? new NullLogger();
     _locator  = msBuildLocator ?? new MsBuildLocator();
     _hintPath = hintPath;
 }
コード例 #17
0
 public InvocationArgumentExtractor(IDoLog logger)
 {
     _logger = logger ?? new NullLogger();
 }
コード例 #18
0
 internal void AppendLogger(IDoLog logger)
 {
     _logger = logger;
 }