//----< processing starts here >--------------------------------- #if (TEST_EXECUTIVE) static void Main(string[] args) { Console.Write("\n Dependency Analysis"); Console.Write("\n =====================\n"); Executive exec = new Executive(); ShowCommandLine(args); // finding files to analyze FileUtilities.Navigate nav = new FileUtilities.Navigate(); nav.Add("*.cs"); nav.go(args[0]); // read path from command line List <string> files = nav.allFiles; exec.typeAnalysis(files); Console.Write("\n TypeTable Contents:"); Console.Write("\n ---------------------"); Repository repo = Repository.getInstance(); repo.typeTable.show(); Console.Write("\n"); ///////////////////////////////////////////////////////////////// // Pass #2 - Find Dependencies Console.Write("\n Dependency Analysis:"); Console.Write("\n ----------------------"); exec.dependencyAnalysis(files); repo.dependencyTable.show(); Console.Write("\n\n building dependency graph"); Console.Write("\n ---------------------------"); CsGraph <string, string> graph = exec.buildDependencyGraph(); graph.showDependencies(); Console.Write("\n\n Strong Components:"); Console.Write("\n --------------------"); graph.strongComponents(); foreach (var item in graph.strongComp) { Console.Write("\n component {0}", item.Key); Console.Write("\n "); foreach (var elem in item.Value) { Console.Write("{0} ", elem.name); } } Console.Write("\n\n"); Console.Read(); }
//----< Generate Dependency Graph of the solution >--------------------------------- public void dependency_graph_test(string[] args) { Console.Write("\n " + "Dependency Graph for project 3 shows below: \n"); Console.Write("\n " + "==================================================== \n"); Console.Write("\n "); CsGraph <string, string> csGraph = new CsGraph <string, string>("Dep_Table"); csGraph = csGraph.Creat_Graph(args); csGraph.showDependencies(); }
//performs strong compoenent analysis void performStrongComp() { Func <CommMessage, CommMessage> performStrongComp = (CommMessage msg) => { CommMessage reply = new CommMessage(CommMessage.MessageType.reply); reply.to = msg.from; reply.from = msg.to; reply.command = "performStrongComp"; Executive exe = new Executive(); foreach (var item in msg.arguments) { string path = System.IO.Path.Combine(Environment.root, item); string b = System.IO.Path.GetFullPath(path); exe.files.Add(b); } exe.typeAnalysis(exe.files); exe.dependencyAnalysis(exe.files); Repository repo = Repository.getInstance(); repo.typeTable.show(); repo.dependencyTable.show(); Console.Write("\n\n Building dependency graph"); Console.Write("\n ---------------------------"); CsGraph <string, string> graph = exe.buildDependencyGraph(); graph.showDependencies(); Console.Write("\n\n Strong Components:"); Console.Write("\n --------------------"); graph.strongComponents(); foreach (var item in graph.strongComp) { Console.Write("\n Component {0}", item.Key); Console.Write("\n "); foreach (var elem in item.Value) { Console.Write("{0} ", elem.name); } } strongCompToString(graph); Console.Write("\n\n"); reply.arguments = strongCompMessage; return(reply); }; messageDispatcher["performStrongComp"] = performStrongComp; }