コード例 #1
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;
 }
コード例 #2
0
        public DLLModel processDLL(DLLModel dLLAtHand)
        {
            if (!dLLAtHand.isDLLManaged())
            {
                dLLAtHand = convertDLLToManaged(dLLAtHand);
            }

            Console.WriteLine(dLLAtHand.ToString());
            Console.WriteLine(dLLAtHand.getFullyQualifiedPath());
            Assembly dLLAssembly = Assembly.LoadFile(dLLAtHand.getFullyQualifiedPath());

            foreach (Type memberType in dLLAssembly.GetTypes())
            {
                int i = 0;
                if (memberType.IsClass)
                {
                    i++;
                    ClassModel classAtHand = new ClassModel(memberType.FullName);
                    this.extractMethodsFromClass(classAtHand, memberType);
                    classAtHand.setDllThisClassBelongsTo(dLLAtHand);
                    dLLAtHand.getAllClassesInThisDll().Add(classAtHand.getClassName(), classAtHand);
                }
            }

            return dLLAtHand;
        }