// This method dispalys the total number of types detected. public void displaySum() { TypeModel tm = new TypeModel(); Dictionary<string, List<string>> TypeTable = tm.dictionary(); Console.WriteLine("\n Total Types found in the analyzed files are: {0}", TypeTable.Count); }
// This method detects the dependencies and passes the currentfile and dependent file to the DependencyModel for storage. public void findDependency(List<string> files) { TypeModel tm = new TypeModel(); CStoker.CToker toker = new CStoker.CToker(); toker.returnComments(false); string msg1; foreach (string file in files) { if (!toker.openFile(file)) { msg1 = "Can't open file " + file; Console.Write("\n\n {0}", msg1); Console.Write("\n {0}", new string('-', msg1.Length)); } else { string tok = ""; DependencyModel dm = new DependencyModel(); while ((tok = toker.getTok()) != "") if (tok != "\n") foreach (KeyValuePair<string, List<string>> key in tm.dictionary()) if (key.Key == tok) { foreach (string filename in key.Value) if (file != filename) dm.addDependency(file, filename); } toker.close(); } } }
static void Main(string[] args) { TypeModel types = new TypeModel(); types.addType("X", "XFile"); types.addType("X", "YFile"); types.addType("Y", "ZFile"); TypeView tv = new TypeView(); tv.Display(); Console.Write("\n\n"); }
static void Main(string[] args) { DependencyModel DM = new DependencyModel(); TypeModel TM = new TypeModel(); TM.addType("X", "XFile"); TM.addType("X", "YFile"); TM.addType("Y", "ZFile"); TypeView tv = new TypeView(); tv.Display(); Console.Write("\n\n"); DM.addDependency("XFile", "YFile"); DependencyView depv = new DependencyView(); depv.Display(); }
public override void doAction(CSsemi.CSemiExp semi) { TypeModel tm = new TypeModel(); FileModel fm = new FileModel(); // Console.Write("\n Entering scope: "); if (semi.Contains("class") != -1) { int index = semi.Contains("class"); // Console.Write("class: "); tm.addType(semi[index + 1], fm.CurrentFile); } else if (semi.Contains("struct") != -1) { int index = semi.Contains("struct"); //Console.Write("struct: "); tm.addType(semi[index + 1], fm.CurrentFile); } else if (semi.Contains("interface") != -1) { int index = semi.Contains("class"); //Console.Write("interface: "); tm.addType(semi[index + 1], fm.CurrentFile); } else if (semi.Contains("enum") != -1) { int index = semi.Contains("class"); //Console.Write("enum: "); tm.addType(semi[index + 1], fm.CurrentFile); } else if (semi.Contains("delegte") != -1) { int index = semi.Contains("delegate"); //Console.Write("delegate: "); tm.addType(semi[index + 2], fm.CurrentFile); } else Console.Write(""); }
// This method displays the contents of the TypeTable. public void Display() { Console.Write("\n \n \n TYPE TABLE CONTENTS"); Console.Write("\n --------------------"); TypeModel tm = new TypeModel(); Dictionary<string, List<string>> TypeTable = tm.dictionary(); foreach (string key in TypeTable.Keys) { Console.Write("\n\n\n >>>>>> Type: {0} ", key); foreach (string item in TypeTable[key]) { Console.Write("\n <"); Console.Write("File {0}", item); Console.Write("> <<<<<<"); } } }