public void Run() { Solution sln = LoadSolution(); //var externalProject = sln.Projects.FirstOrDefault(x => x.AssemblyName == externalNs); //if (externalProject == null) //{ // var msg = string.Format("Project for given external-facing namespace of {0} not found.", externalNs); // messagePump.OnError(new ArgumentException(msg)); // return; //} SendMessage(string.Format("{1}Using {0} for process discovery{1}", processTypeName ?? DefaultProcessIfxName, Environment.NewLine)); var token = new CancellationToken(); var analyzer = new MIL.Services.ProcessAnalysisService(processIName); //ProcessDefinition processDefinition = null; var excludeList = sln.Projects.Where(x => ExcludedAssemblies.Any(e => x.AssemblyName.Contains(e))).ToList(); if (excludeList.Any()) { SendMessage(string.Format("Ignoring {0} Assemblies{1}", excludeList.Count, Environment.NewLine), () => "Ignored assemblies: " + Environment.NewLine + string.Join(Environment.NewLine, excludeList.Select(x => x.AssemblyName)) + Environment.NewLine); } MilSyntaxWalker treeData = new MilSyntaxWalker(); foreach (var proj in sln.Projects.Except(excludeList)) { SendMessage(".", () => Environment.NewLine + "# Processing assembly " + proj.AssemblyName + Environment.NewLine); MilSemanticAnalyzer semantics = null; MetadataFileReferenceProvider provider = new MetadataFileReferenceProvider(); Compilation compilation = (Compilation)proj.GetCompilationAsync(token).Result .AddReferences(new MetadataFileReference(typeof(object).Assembly.Location)) .AddReferences(new MetadataFileReference(typeof(IEnumerable<>).Assembly.Location)); ; try { semantics = new MilSemanticAnalyzer(compilation); } catch (InvalidOperationException ex) { SendMessage("x", () => string.Join(Environment.NewLine, compilation.GetDeclarationDiagnostics().Select(x => x.ToString())) + Environment.NewLine); continue; } semantics.ExtractMessagingSyntax(treeData); //if (proj.AssemblyName == externalProject.AssemblyName) // continue; //processDefinition = analyzer.GetProcessDefinition(compilation, processTypeName); //if (processDefinition != null) //{ // var procToke = ProcessDefinition.GetTokenFromDefinition(processDefinition); // if (procToke.Token != MilTypeConstant.EmptyToken) // SendMessage(procToke.ToString()); //} //foreach (var pubCall in semantics.GetMessagePublicationData()) //{ // SendMessage(pubCall.ToString()); //} } DumpSyntaxData(treeData); messagePump.OnCompleted(); }
public void Run() { Solution sln = LoadSolution(); //var externalProject = sln.Projects.FirstOrDefault(x => x.AssemblyName == externalNs); //if (externalProject == null) //{ // var msg = string.Format("Project for given external-facing namespace of {0} not found.", externalNs); // messagePump.OnError(new ArgumentException(msg)); // return; //} SendMessage(string.Format("{1}Using {0} for process discovery{1}", processTypeName ?? DefaultProcessIfxName, Environment.NewLine)); var token = new CancellationToken(); var analyzer = new MIL.Services.ProcessAnalysisService(processIName); //ProcessDefinition processDefinition = null; var excludeList = sln.Projects.Where(x => ExcludedAssemblies.Any(e => x.AssemblyName.Contains(e))).ToList(); if (excludeList.Any()) { SendMessage(string.Format("Ignoring {0} Assemblies{1}", excludeList.Count, Environment.NewLine), () => "Ignored assemblies: " + Environment.NewLine + string.Join(Environment.NewLine, excludeList.Select(x => x.AssemblyName)) + Environment.NewLine); } MilSyntaxWalker treeData = new MilSyntaxWalker(); foreach (var proj in sln.Projects.Except(excludeList)) { SendMessage(".", () => Environment.NewLine + "# Processing assembly " + proj.AssemblyName + Environment.NewLine); MilSemanticAnalyzer semantics = null; MetadataFileReferenceProvider provider = new MetadataFileReferenceProvider(); Compilation compilation = (Compilation)proj.GetCompilationAsync(token).Result .AddReferences(new MetadataFileReference(typeof(object).Assembly.Location)) .AddReferences(new MetadataFileReference(typeof(IEnumerable <>).Assembly.Location));; try { semantics = new MilSemanticAnalyzer(compilation); } catch (InvalidOperationException ex) { SendMessage("x", () => string.Join(Environment.NewLine, compilation.GetDeclarationDiagnostics().Select(x => x.ToString())) + Environment.NewLine); continue; } semantics.ExtractMessagingSyntax(treeData); //if (proj.AssemblyName == externalProject.AssemblyName) // continue; //processDefinition = analyzer.GetProcessDefinition(compilation, processTypeName); //if (processDefinition != null) //{ // var procToke = ProcessDefinition.GetTokenFromDefinition(processDefinition); // if (procToke.Token != MilTypeConstant.EmptyToken) // SendMessage(procToke.ToString()); //} //foreach (var pubCall in semantics.GetMessagePublicationData()) //{ // SendMessage(pubCall.ToString()); //} } DumpSyntaxData(treeData); messagePump.OnCompleted(); }