static void Main(string[] args) { string filename = "1"; XMLBuilder xmlbdr = new XMLBuilder(); List<Elem> table = new List<Elem>(); Elem ns = new Elem(); Elem cl = new Elem(); Elem en = new Elem(); Elem fn = new Elem(); Elem st = new Elem(); Elem it = new Elem(); ns.name = "myNamespace"; ns.type = "namespace"; ns.beginLine = 1; ns.endLine = 100; it.name = "myInterface"; it.type = "interface"; it.beginLine = 10; it.endLine = 20; st.name = "myStruct"; st.type = "struct"; st.beginLine = 30; st.endLine = 35; cl.name = "myClass"; cl.type = "class"; cl.beginLine = 40; cl.endLine = 70; fn.name = "myFunction"; fn.type = "function"; fn.beginLine = 50; fn.endLine = 60; en.name = "myEnum"; en.type = "enum"; en.beginLine = 80; en.endLine = 90; table.Add(ns); table.Add(it); table.Add(st); table.Add(cl); table.Add(fn); table.Add(en); xmlbdr.XMLBuild(table,filename); }
// function that display the analysis results static void display(List<Elem> table, object file, bool relation, bool xml) { Console.Write("\n\n#############################################################################################"); Console.Write("\n\n Processing file {0}", file as string); Console.Write("\n\n --------------------------------------------------------------------------------------"); Console.Write("\n TYPE\n"); Console.Write("\n type name size complexity"); foreach (Elem e in table) { Console.Write("\n {0,10} {1,25} {2,5} {3,5}", e.type, e.name, e.end - e.begin + 1, e.complexity); } if (relation == true) // display relationship between types { Console.Write("\n\n --------------------------------------------------------------------------------------"); Console.Write("\n RELATIONSHIP"); foreach (Elem e in table) { if (e.type == "class" || e.type == "interface" || e.type == "struct") { Console.Write("\n\n {0} - {1}\n", e.type, e.name); Console.Write("\n using:{0}", e.usingrelationship); Console.Write("\n inheritance:{0}", e.inheritance); Console.Write("\n composition:{0}", e.composition); Console.Write("\n aggregation:{0}\n", e.aggregation); } } } if (xml == true) // display XML tree and it to .xml file { XMLBuilder xb = new XMLBuilder(); string filename = (string)file; xb.XMLBuild(table, filename); } }