private IEnumerable <Member> GetStaticMembers(string methodName, Type[] parameterTypes) { var pos = methodName.LastIndexOf('.'); if (pos < 0) { yield break; } string typeName = methodName.Substring(0, pos); string methodName2 = methodName.Substring(pos + 1); foreach (var assembly in Assemblies) { foreach (var usingDirective in UsingDirectives.Union(new[] { "" })) { var name = string.IsNullOrEmpty(usingDirective) ? typeName : usingDirective + "." + typeName; var t = assembly.GetType(name); if (t != null) { var methods = TypeExtensions.GetStaticMembers(methodName2, t, parameterTypes); foreach (var method in methods) { yield return(method); } } } } }
public string Generate(string name) { var classDefinition = Generator.ClassDeclaration( name, typeParameters: null, accessibility: Accessibility.Public, modifiers: DeclarationModifiers.Partial, baseType: BaseType, members: Members); ContentDeclarations.Add(classDefinition); var compilationDeclarations = UsingDirectives.Union(ContentDeclarations).ToList(); return(Generator.CompilationUnit(compilationDeclarations).NormalizeWhitespace().ToFullString()); }