/// <summary> /// Performs comparisons to identify the existence of dependencies among files /// </summary> /// <param name="typeName"></param> /// <param name="filename"></param> /// <param name="tables"></param> /// <param name="dicRes"></param> public void DoComparison(string typeName, string filename, Dictionary <string, List <Elem> > tables, ref Dictionary <string, HashSet <string> > dicRes) { ITokenCollection semi = Factory.create(); foreach (KeyValuePair <string, List <Elem> > table in tables) { if (table.Key != filename) { semi.open(table.Key as string); while (semi.get().Count > 0) { if (semi.Contains(typeName)) { if (!dicRes.ContainsKey(table.Key)) { HashSet <string> valDic = new HashSet <string>(); dicRes.Add(table.Key, valDic); dicRes[table.Key].Add(filename); break; } else { dicRes[table.Key].Add(filename); break; } } } } } }
static void D_delegate(ITokenCollection semi, String fileName1, String fileName2, List <string> classNames, List <string> interfaceNames, List <string> structureNames, List <string> enumNames, List <string> delegateNames, List <Tuple <string, string> > graph) { foreach (String delegateName in delegateNames) { if (semi.Contains(delegateName)) { graph.Add(new Tuple <string, string>(fileName2, fileName1)); return; } } }
//---------<checks if the enum of one file is present on the other file with same namespace or using or alias name>---------// public static bool secondParseDelegate(ITokenCollection semi, string file1, string file2, List <string> delegateList, List <string> files, List <Tuple <string, string> > graph) { int il = delegateList.Count; while (semi.get().Count > 0) { for (int i = 0; i < il; i++) { if (semi.Contains(delegateList[i])) { graph.Add(new Tuple <string, string>(file2, file1)); return(true); } } } return(false); }
//-----------------< Parse the second file to check for delegate instance >--------- public static bool ParseForDelegate(string firstFile, string SecondFile, ITokenCollection semi, List <List <Elem> > listOfTables, List <Tuple <string, string> > graph) { List <string> listofDelegates = new List <string>(); listofDelegates = GetTypes.delegateList(firstFile, listOfTables); int n = listofDelegates.Count; while (semi.get().Count > 0) { for (int i = 0; i < n; i++) { if (semi.Contains(listofDelegates[i])) { graph.Add(new Tuple <string, string>(SecondFile, firstFile)); return(true); } } } return(false); }