Esempio n. 1
0
 private MethodModel extractParametersFromMethod(MethodModel methodAtHand, MethodInfo methodInfo)
 {
     ParameterInfo[] paramInfo = methodInfo.GetParameters();
     for (int i = 0; i < paramInfo.Length; i++)
     {
         string paramName = paramInfo[i].Name;
         Type paramType = paramInfo[i].ParameterType;
         string paramShortName = paramType + " " + paramName;
         ParameterModel paramAtHand = new ParameterModel(paramName, paramType, i + 1, methodAtHand);
         methodAtHand.getAllParametersInThisMethod().Add(i + 1, paramAtHand);
         if (i != paramInfo.Length - 1)
         {
             paramShortName = paramShortName + ",";
         }
         methodAtHand.setShortenedMethodName(methodAtHand.getShortenedName() + paramShortName);
     }
     methodAtHand.setNumberOfMethodParameters(paramInfo.Length);
     return methodAtHand;
 }
Esempio n. 2
0
 private ClassModel extractMethodsFromClass(ClassModel classAtHand, Type classType)
 {
     int i = 0;
     foreach (MethodInfo methodInfo in classType.GetMethods())
     {
         i++;
         string nameOfMethodAtHand = methodInfo.Name;
         string classThisMethodBelongsTo = classAtHand.getClassName();
         Type returnTypeOfMethodAtHand = methodInfo.ReturnType;
         MethodModel methodAtHand = new MethodModel(nameOfMethodAtHand,
                   classAtHand, returnTypeOfMethodAtHand);
         methodAtHand.setShortenedMethodName(classAtHand.getClassName()
             + "." +methodAtHand.getMethodName() + "(");
         this.extractParametersFromMethod(methodAtHand, methodInfo);
         methodAtHand.setShortenedMethodName(methodAtHand.getShortenedName() + ")");
         classAtHand.getAllMethodsInThisClass().Add(methodAtHand.getShortenedName(), methodAtHand);
     }
     return classAtHand;
 }