public bool IsValidMethod(CustomExportBlock block, MethodBase methodBase) { bool ret = true; if (block == null || methodBase == null) { return(ret); } ParameterInfo[] pi = methodBase.GetParameters(); CustomExportBlock.BlockMethod method; if (block.methodMap.TryGetValue(methodBase.Name, out method)) { ret = isSameMethodParams(method.methodParams, pi); } return(ret); }
public void AddBlockClass(Type type, MethodBase info) { CustomExportBlock block; if (!blockMap.TryGetValue(type.FullName, out block)) { block = new CustomExportBlock(); block.className = type.FullName; blockMap[type.FullName] = block; } CustomExportBlock.BlockMethod method; if (!block.methodMap.TryGetValue(info.Name, out method)) { method = new CustomExportBlock.BlockMethod(); method.methodName = info.Name; block.methodMap[info.Name] = method; } CustomExportBlock.MethodParams methodParams = new CustomExportBlock.MethodParams(); foreach (ParameterInfo param in info.GetParameters()) { methodParams.param.Add(param.ParameterType.Name); } }
/// <summary> /// 过滤员方法 /// </summary> /// <param name="className"></param> /// <param name="info"></param> /// <returns></returns> public bool IsValidMethodInfo(string className, MethodBase info) { CustomExportBlock block = IsValidClass(className); return(IsValidMethod(block, info)); }
/// <summary> /// 过滤成员函数 /// </summary> /// <param name="className">类名</param> /// <param name="cInfo">反射得到的构造函数信息</param> /// <returns></returns> public bool IsValidConstructorInfo(string className, ConstructorInfo cInfo) { CustomExportBlock block = IsValidClass(className); return(IsValidMethod(block, cInfo)); }