public static DLLModel populateUserSelectedClassesAndMethods(DLLModel dllAtHand) { string userAddedClassesAndMethods = ConfigurationManager.AppSettings["methodsToAdd"]; if (userAddedClassesAndMethods == null) { Console.WriteLine("Incorrect configuration, methodsToAdd property not present."); Environment.Exit(0); } string[] colonSeparatedStrings = userAddedClassesAndMethods.Split(';'); for (int i = 0; i < colonSeparatedStrings.Length; i++) { string methodAtHandString = colonSeparatedStrings[i]; Dictionary<string, ClassModel> classesInDll = dllAtHand.getAllClassesInThisDll(); foreach (KeyValuePair<string, ClassModel> pair in classesInDll) { ClassModel classAtHand = pair.Value; if (classAtHand.getAllMethodsInThisClass().ContainsKey(methodAtHandString)) { int indexOfMethodToBeFetched = classAtHand.getAllMethodsInThisClass().IndexOfKey(methodAtHandString); classAtHand.getUserSelectedMethodsInThisClass().Add(methodAtHandString, classAtHand.getAllMethodsInThisClass().ElementAt(indexOfMethodToBeFetched).Value); //Now add this class to the DLL's user selected methods, no duplicates if (!dllAtHand.getUserSelectedClassesInThisDll().ContainsKey(classAtHand.getClassName())) { dllAtHand.getUserSelectedClassesInThisDll().Add(classAtHand.getClassName(), classAtHand); } } } } return dllAtHand; }
public static DLLModel populateUserSelectedClassesAndMethods(DLLModel dllAtHand) { string userAddedClassesAndMethods = PropertyUtil.getUserSelectedMethods(); if (userAddedClassesAndMethods == null) { Console.WriteLine("Incorrect configuration, methodsToAdd property not present."); Environment.Exit(0); } string[] colonSeparatedStrings = userAddedClassesAndMethods.Split(';'); for (int i = 0; i < colonSeparatedStrings.Length; i++) { string methodAtHandString = colonSeparatedStrings[i]; string tmpStringForSplit = new string(methodAtHandString.ToCharArray()); string[] controllerAndActionAliases = tmpStringForSplit.Split(PropertyUtil.methodAndAliasSeparator); Boolean aliasesExist = false; string controllerAlias = null; string actionAlias = null; if (controllerAndActionAliases.Length > 1) { //Aliases Exist, time to fetch them aliasesExist = true; string[] individualAliasNames = controllerAndActionAliases[1].Split(PropertyUtil.aliasSeparator); controllerAlias = individualAliasNames[0]; actionAlias = individualAliasNames[1]; //Lest we pass the method name along with the aliases methodAtHandString = controllerAndActionAliases[0]; } Dictionary<string, ClassModel> classesInDll = dllAtHand.getAllClassesInThisDll(); foreach (KeyValuePair<string, ClassModel> pair in classesInDll) { ClassModel classAtHand = pair.Value; if (classAtHand.getAllMethodsInThisClass().ContainsKey(methodAtHandString)) { int indexOfMethodToBeFetched = classAtHand.getAllMethodsInThisClass().IndexOfKey(methodAtHandString); MethodModel methodAtHand = classAtHand.getAllMethodsInThisClass().ElementAt(indexOfMethodToBeFetched).Value; if (aliasesExist) { methodAtHand.setAliasName(actionAlias); classAtHand.setAliasName(controllerAlias); } classAtHand.getUserSelectedMethodsInThisClass().Add(methodAtHandString, methodAtHand); //Now add this class to the DLL's user selected methods, no duplicates if (!dllAtHand.getUserSelectedClassesInThisDll().ContainsKey(classAtHand.getClassName())) { dllAtHand.getUserSelectedClassesInThisDll().Add(classAtHand.getClassName(), classAtHand); } } } } return dllAtHand; }