internal void InitializeEvent(CorEventDef evt, out MethodDef addMethod, out MethodDef invokeMethod, out MethodDef removeMethod, out ThreadSafe.IList <MethodDef> otherMethods) { addMethod = null; invokeMethod = null; removeMethod = null; otherMethods = ThreadSafeListCreator.Create <MethodDef>(); var mdi = readerModule.MetaDataImport; uint token = evt.OriginalToken.Raw; uint addToken, removeToken, fireToken; MDAPI.GetEventAddRemoveFireTokens(mdi, token, out addToken, out removeToken, out fireToken); var otherTokens = MDAPI.GetEventOtherMethodTokens(mdi, token); var dict = CreateMethodDict(); addMethod = Lookup(dict, addToken); invokeMethod = Lookup(dict, fireToken); removeMethod = Lookup(dict, removeToken); foreach (uint otherToken in otherTokens) { Add(dict, otherMethods, otherToken); } }
public CorFunction[] GetOtherMethods() { var mod = Module; var tokens = MDAPI.GetEventOtherMethodTokens(mod?.GetMetaDataInterface <IMetaDataImport>(), Token); if (tokens.Length == 0) { return(Array.Empty <CorFunction>()); } var funcs = new CorFunction[tokens.Length]; for (int i = 0; i < tokens.Length; i++) { funcs[i] = mod.GetFunctionFromToken(tokens[i]); } return(funcs); }
public CorFunction[] GetOtherMethods() { var mod = Module; var mdi = mod == null ? null : mod.GetMetaDataInterface <IMetaDataImport>(); var tokens = MDAPI.GetEventOtherMethodTokens(mdi, token); if (tokens.Length == 0) { return(emptyCorFunctions); } var funcs = new CorFunction[0]; for (int i = 0; i < tokens.Length; i++) { funcs[i] = mod.GetFunctionFromToken(tokens[i]); } return(funcs); }