public void AutomapMethods() { foreach (var methodInfo in ComponentType.GetMethods(BindingFlags.Instance | BindingFlags.Public)) { MapMethod(_nextAvailableId++, methodInfo); } }
private void WriteMethods(StreamWriter writer) { writer.WriteLine(); writer.WriteLine("//<editor-fold defaultstate=\"collapsed\" desc=\"Interop Methods\">"); foreach (var method in ComponentType.GetMethods(BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly)) { ///Construtores, acessores de propriedades e de eventos são ignorados if (method.IsConstructor || method.Name.StartsWith("get_") || method.Name.StartsWith("set_") || method.Name.StartsWith("add_") || method.Name.StartsWith("remove_")) { continue; } ///Métodos com ComVisible=False são overloads e devem ser implementados diretamente em Java, não devem ser exportados. ComVisibleAttribute comVisibleAttribute = (ComVisibleAttribute)Attribute.GetCustomAttribute(method, typeof(ComVisibleAttribute)); if (comVisibleAttribute != null && comVisibleAttribute.Value == false) { continue; } WriteMethod(writer, method); } writer.WriteLine(); writer.WriteLine(); writer.WriteLine("//</editor-fold>"); }