/// <summary> /// Finds event /// </summary> /// <param name="name">Event name</param> /// <returns></returns> public IEnumerable <CorEvent> FindEvents(string name, bool checkBaseClasses = true) { var mdi = Module.GetMetaDataInterface <IMetaDataImport>(); foreach (var edToken in MDAPI.GetEventTokens(mdi, token)) { if (MDAPI.GetEventName(mdi, edToken) == name) { yield return(new CorEvent(this, edToken)); } } if (checkBaseClasses) { var type = GetParameterizedType(CorElementType.Class); if (type != null) { type = type.Base; } if (type != null) { foreach (var evt in type.FindEvents(name, checkBaseClasses)) { yield return(evt); } } } }
/// <summary> /// Finds events /// </summary> /// <param name="name">Event name</param> /// <returns></returns> public IEnumerable <CorEvent> FindEvents(string name, bool checkBaseClasses = true) { for (var type = this; type != null; type = type.Base) { if (!checkBaseClasses && (object)this != (object)type) { break; } if (!type.HasClass) { continue; } var cls = type.Class; if (cls == null) { continue; } var mod = cls.Module; var mdi = mod == null ? null : mod.GetMetaDataInterface <IMetaDataImport>(); foreach (var edToken in MDAPI.GetEventTokens(mdi, cls.Token)) { if (MDAPI.GetEventName(mdi, edToken) == name) { yield return(new CorEvent(cls, edToken)); } } } }
public string GetName() { var mod = Module; var mdi = mod == null ? null : mod.GetMetaDataInterface <IMetaDataImport>(); return(MDAPI.GetEventName(mdi, Token)); }
public DmdEventDefCOMD(DmdComMetadataReader reader, uint rid, DmdType declaringType, DmdType reflectedType) : base(rid, declaringType, reflectedType) { this.reader = reader ?? throw new ArgumentNullException(nameof(reader)); reader.Dispatcher.VerifyAccess(); uint token = 0x14000000 + rid; Name = MDAPI.GetEventName(reader.MetaDataImport, token) ?? string.Empty; Attributes = MDAPI.GetEventAttributes(reader.MetaDataImport, token); var eventTypeToken = MDAPI.GetEventTypeToken(reader.MetaDataImport, token); EventHandlerType = reader.ResolveType((int)eventTypeToken, DeclaringType !.GetGenericArguments(), null, DmdResolveOptions.None) ?? reader.Module.AppDomain.System_Void; }
public string GetName() => MDAPI.GetEventName(Module?.GetMetaDataInterface <IMetaDataImport>(), Token);
void InitNameAndAttrs_NoLock() { var mdi = readerModule.MetaDataImport; uint token = OriginalToken.Raw; Name = Utils.GetUTF8String(MDAPI.GetUtf8Name(mdi, OriginalToken.Raw), MDAPI.GetEventName(mdi, token) ?? string.Empty); Attributes = MDAPI.GetEventAttributes(mdi, token); uint eventType = MDAPI.GetEventTypeToken(mdi, token); EventType = readerModule.ResolveTypeDefOrRefInternal(eventType, new GenericParamContext(ownerType)); }