private static void printOutClassesAndMethods(DLLModel dLLModel)
        {
            Console.WriteLine("Inside Here" + dLLModel.getFullyQualifiedPath());
            Dictionary<string, ClassModel> allClassesInDll =
                dLLModel.getAllClassesInThisDll();
            foreach(KeyValuePair<string, ClassModel> pair in allClassesInDll) {
                ClassModel classAtHand = pair.Value;
                Console.WriteLine("-------------------------------------------");
                Console.WriteLine("");
                Console.WriteLine("Class ---> " + classAtHand.getClassName());
                Console.WriteLine("");
                Console.WriteLine("-------------------------------------------");
                Console.WriteLine("");
                Console.WriteLine("Methods in this class");
                Console.WriteLine("");
                Console.WriteLine("-------------------------------------------");

                SortedList<string, MethodModel> methodsInClass = classAtHand.getAllMethodsInThisClass();
                foreach (KeyValuePair<string, MethodModel> methodPair in methodsInClass)
                {
                    MethodModel methodAtHand = methodPair.Value;
                    Console.WriteLine("  Returns " + methodAtHand.getMethodReturnType() + "-----" + '\t' + methodAtHand.getShortenedName() );
                }
                Console.WriteLine("");
                Console.WriteLine("");
            }
        }
 public static DLLModel populateComplexTypes(DLLModel dllAtHand)
 {
     Assembly dLLAssembly = Assembly.LoadFile(dllAtHand.getFullyQualifiedPath());
     IEnumerable<TypeInfo> myTypes = dLLAssembly.DefinedTypes;
     Dictionary<string, ComplexTypeModel> complexTypesInDll = new Dictionary<string, ComplexTypeModel>();
     foreach (TypeInfo typeInfo in myTypes)
     {
         ComplexTypeModel complexTypeAtHand = createComplexModel(typeInfo.FullName, dLLAssembly);
         complexTypeAtHand.setDllFileThisTypeBelongsTo(dllAtHand.getDllFileName());
         complexTypesInDll = dllAtHand.getAllComplexTypesInDLL();
         if (!complexTypesInDll.ContainsKey(complexTypeAtHand.getActualTypeName()))
         {
             complexTypesInDll.Add(complexTypeAtHand.getActualTypeName(), complexTypeAtHand);
         }
     }
     ObjectProcessor.getComplexTypesAcrossDlls().Add(dllAtHand.getDllFileName(), complexTypesInDll);
     return dllAtHand;
 }
        private DLLModel convertDLLToManaged(DLLModel dLLModel)
        {
            Object typeLib;
            LoadTypeLibEx(dLLModel.getFullyQualifiedPath(), RegKind.RegKind_None, out typeLib);

            if (typeLib == null)
            {
                Console.WriteLine("LoadTypeLibEx failed.");
            }

            TypeLibConverter converter = new TypeLibConverter();
            ConversionEventHandler eventHandler = new ConversionEventHandler();

            string newDllName = dLLModel.getDllFileName()
                + "_converted.dll";
            AssemblyBuilder asm = converter.ConvertTypeLibToAssembly(typeLib, newDllName, 0, eventHandler, null, null, null, null);

            asm.Save(newDllName);
            DLLModel newdLLModel = new DLLModel(AppDomain.CurrentDomain.BaseDirectory + newDllName);
            return newdLLModel;
        }
        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;
        }