コード例 #1
0
        public void AnalyzeEntireSolutionAsync()
        {
			foreach (var project in this.Solution.Projects)
			{
				var compilation = project.GetCompilationAsync().Result;
				var diag = compilation.GetDiagnostics();

				var theAssembly = compilation.Assembly;

				var continuations = new List<Task>();
				foreach (var tree in compilation.SyntaxTrees)
				{
					var provider = new ProjectCodeProvider(project, compilation);
                    var model = compilation.GetSemanticModel(tree);
                    var allMethodsVisitor = new AllMethodsVisitor(model, tree, this.Dispatcher);
					continuations.Add(allMethodsVisitor.Run(tree));
				}
				Task.WhenAll(continuations);
			}
            //if (this.Dispatcher is QueueingDispatcher)
            //{
            //    var qd = (QueueingDispatcher)this.Dispatcher;
            //    while (!qd.IsDoneProcessing)
            //    {
            //        Logger.Instance.Log("Waiting for the queue to empty up...");
            //        Thread.Sleep(1000);
            //    }
            //}

            /*
            if (mainMethod != null)
            {
                var methodDescriptor = new MethodDescriptor(mainMethod);
                callgraph.AddRootMethod(methodDescriptor);

                var mainMethodEntityDescriptor = new MethodEntityDescriptor<AMethod>(new AMethod(mainMethod));
                var mainEntityProcessor = this.Dispatcher.GetEntityWithProcessor(mainMethodEntityDescriptor) as MethodEntityProcessor<ANode,AType,AMethod>;
                
                // Just a test
                //mainEntityProcessor.MethodEntity.CurrentContext = new CallConext<AMethod, ANode>(mainEntityProcessor.MethodEntity.Method, null, null);
                
                var task = mainEntityProcessor.DoAnalysisAsync();
                task.Start();
                task.Wait();

                //var methodEntity = (MethodEntity<ANode, AType, AMethod>)mainEntityProcessor.Entity;
                var methodEntity = mainEntityProcessor.MethodEntity;
                Thread.Sleep(10);

                //if (this.Dispatcher is AsyncDispatcher)
                //{
                //    while (!mainEntityProcessor.HasFinishedAllProgatations())
                //    {
                //        Logger.Instance.Log("Waiting in Main for the queue to empty up... {0}",mainEntityProcessor.MethodEntity.NodesProcessing.Count());
                //        Thread.Sleep(10);
                //    }
                //}
                GenerateCallGraph();
            }*/
        }
コード例 #2
0
        public void AnalyzeEntireSolution()
        {
			foreach (var project in this.Solution.Projects)
			{
				var compilation = project.GetCompilationAsync().Result;
				var diag = compilation.GetDiagnostics();

				var theAssembly = compilation.Assembly;

				foreach (var tree in compilation.SyntaxTrees)
				{
                    var model = compilation.GetSemanticModel(tree);
					var codeProvider = new ProjectCodeProvider(project, compilation);
					var allMethodsVisitor = new AllMethodsVisitor(model, tree, this.Dispatcher);
					allMethodsVisitor.Visit(tree.GetRoot());
				}
			}
            //if (this.Dispatcher is QueueingDispatcher)
            //{
            //    var qd = (QueueingDispatcher)this.Dispatcher;
            //    while (!qd.IsDoneProcessing)
            //    {
            //        Logger.Instance.Log("Waiting for the queue to empty up...");
            //        Thread.Sleep(1000);
            //    }
            //}

            /*
            if (mainMethod != null)
            {
                var methodDescriptor = new MethodDescriptor(mainMethod);
                callgraph.AddRootMethod(methodDescriptor);

				var mainMethodEntityDescriptor = new MethodEntityDescriptor<AMethod>(new AMethod(mainMethod));
				var mainEntityProcessor = this.Dispatcher.GetEntityWithProcessor(mainMethodEntityDescriptor);

				mainEntityProcessor.DoAnalysis();
				GenerateCallGraph();
            }*/
        }