public AssemblyInfo GetInfo(string asmPath) { AssemblyInfo assemblyInfo = new AssemblyInfo(); Assembly assembly; try { assembly = Assembly.LoadFrom(asmPath); } catch (FileNotFoundException ex) { throw new FileNotFoundException(ex.Message); } catch (BadImageFormatException ex) { throw new BadImageFormatException(ex.Message); } catch (FileLoadException ex) { throw new FileLoadException(ex.Message); } Dictionary <string, MethodDeclaration> extMethods = GetExtMethods(assembly); foreach (TypeInfo defType in assembly.DefinedTypes) { if (!defType.IsNested) { if (!_typesWithExtensionMethods.Contains(defType.Name)) { NamespaceDeclaration namespaceDeclaration = new NamespaceDeclaration(defType.Namespace); Builder builder = new Builder(new TypeBuilder(defType)); TypeDeclaration typeDeclaration = (TypeDeclaration)builder.Create(extMethods); namespaceDeclaration.AddType(typeDeclaration); assemblyInfo.AddOrCreateNamespaceDeclaration(namespaceDeclaration); } } } _typesWithExtensionMethods.Clear(); return(assemblyInfo); }