public static IMethod GetMethod(this ILType type, AdaptMethod m) { if (m.Method != null) { return(m.Method); } m.Method = type.GetMethod(m.Name, m.ParamCount); if (m.Method == null) { string baseClass = ""; if (type.FirstCLRBaseType != null) { baseClass = type.FirstCLRBaseType.FullName; } else if (type.FirstCLRInterface != null) { baseClass = type.FirstCLRInterface.FullName; } throw new Exception(string.Format("can't find the method: {0}.{1}:{2}, paramCount={3}", type.FullName, m.Name, baseClass, m.ParamCount)); } return(m.Method); }
public static IMethod GetMethod(this ILType type, AdaptMethod m) { if (m.Method != null) { return(m.Method); } m.Method = type.GetMethod(m.Name, m.ParamCount); if (m.Method != null) { return(m.Method); } string baseClass = ""; if (type.FirstCLRBaseType != null) { baseClass = type.FirstCLRBaseType.FullName; } else if (type.FirstCLRInterface != null) { baseClass = type.FirstCLRInterface.FullName; } throw new Exception($"can't find the method: {type.FullName}.{m.Name}:{baseClass}, paramCount={m.ParamCount}"); }
public static IMethod GetMethod(this ILType type, AdaptMethod m) { if (m.IsGotMethod) { return(m.Method); } //获取方法 m.Method = m.ParamCount == -1 ? type.GetMethod(m.Name) : type.GetMethod(m.Name, m.ParamCount); m.IsGotMethod = true; if (m.Method == null) { string baseClass = ""; if (type.FirstCLRBaseType != null) { baseClass = type.FirstCLRBaseType.FullName; } else if (type.FirstCLRInterface != null) { baseClass = type.FirstCLRInterface.FullName; } Log.Warning(Utility.Text.Format("Can't find the method: {0}.{1}:{2}, paramCount={3}", type.FullName, m.Name, baseClass, m.ParamCount));; } return(m.Method); }
public Adapter(AppDomain appdomain, ILTypeInstance instance) { _appDomain = appdomain; ILInstance = instance; mOnCreate = new AdaptMethod(_appDomain, ILInstance, "OnCreate", 0, false); mOnDestroy = new AdaptMethod(_appDomain, ILInstance, "OnDestroy", 0, false); mOnRefresh = new AdaptMethod(_appDomain, ILInstance, "OnRefresh", 0, false); mOnUpdate = new AdaptMethod(_appDomain, ILInstance, "OnUpdate", 0, false); mOnSortDepth = new AdaptMethod(_appDomain, ILInstance, "OnSortDepth", 1, true); mOnSetVisible = new AdaptMethod(_appDomain, ILInstance, "OnSetVisible", 1, true); }