public static CorFunction GetFuntion(string Module, string className, string funtionName) { CorModule module = null; CorFunction fun = null; DebugCache.LoadedModules.TryGetValue(Module, out module); if (module == null) { throw new BreakPointException("Module not loaded " + Module); } int token = 0; try { module.Importer.FindTypeDefByName(className, 0, out token); } catch (Exception) { throw new BreakPointException(className + " class is not found in" + Module); } MetaType type = new MetaType(module.Importer, token); try { MetadataMethodInfo method = type.GetMethod(funtionName); fun = module.GetCorFuntion((uint)method.MetadataToken); } catch (Exception) { throw new BreakPointException(funtionName + " Method is not found in" + className); } return fun; //method.MetadataToken }
public static CorFunction GetFuntion(CorModule module, string className, string funtionName) { CorFunction fun = null; int token = 0; try { module.Importer.FindTypeDefByName(className, 0, out token); } catch (Exception) { throw new BreakPointException(className + " class is not found in" + module.Name); } MetaType type = new MetaType(module.Importer, token); try { MetadataMethodInfo method = type.GetMethod(funtionName); fun = module.GetCorFuntion((uint)method.MetadataToken); } catch (Exception) { throw new BreakPointException(funtionName + " Method is not found in" + className); } return fun; //method.MetadataToken }