public virtual IReadOnlyList <IPopulationAnalysisField> AllFieldsOn(PivotArea area) { return(AllFields.Where(f => GetArea(f).Is(area)).OrderBy(GetAreaIndex).ToList()); }
void Init() { (m_Fields = new List <FieldInfo>(AllFields.Where(_ => Check(_)))).SortField(); (m_Events = new List <EventInfo>(AllEvents.Where(_ => Check(_)))).SortEvent(); (m_Propertys = new List <PropertyInfo>(AllPropertys.Where(_ => Check(_)))).SortProperty(); m_Methods.Clear(); foreach (var method in AllMethods) { if (!Check(method)) { continue; } var valid = true; var methodHandle = method.MethodHandle; //判断函数是不是 event add remove 函数 foreach (var eventInfo in AllEvents) { if (eventInfo.GetAddMethod().MethodHandle == methodHandle || eventInfo.GetRemoveMethod().MethodHandle == methodHandle) { if (!Check(eventInfo)) { valid = false; } break; } } if (valid) { //判断函数是不是 get set 函数 foreach (var propertyInfo in AllPropertys) { //如果是struct 并且是 set 属性则屏蔽,强转结构体的set会报错 if (IsStruct && propertyInfo.GetSetMethod()?.MethodHandle == methodHandle) { valid = false; break; } else if (propertyInfo.GetGetMethod()?.MethodHandle == methodHandle || propertyInfo.GetSetMethod()?.MethodHandle == methodHandle) { if (!Check(propertyInfo)) { valid = false; } break; } } } if (valid) { m_Methods.Add(method); } } m_Methods.SortMethod(); m_ExtensionMethods.Clear(); foreach (var extensionInfo in m_Extensions) { var nameSpace = extensionInfo.Namespace; var methods = extensionInfo.GetMethods(Script.BindingFlag); foreach (var methodInfo in methods) { //非扩展函数 if (!Util.IsExtensionMethod(methodInfo) || !Check(methodInfo)) { continue; } var paramterType = methodInfo.GetParameters()[0].ParameterType; //判断是模板函数 if (paramterType.IsGenericParameter && paramterType.BaseType != null && paramterType.BaseType.IsAssignableFrom(m_Type)) { m_ExtensionMethods.Add(methodInfo); } else if (ScorpioReflectUtil.CheckGenericMethod(methodInfo) && paramterType.IsAssignableFrom(m_Type)) { m_ExtensionMethods.Add(methodInfo); } else { continue; } if (!string.IsNullOrWhiteSpace(nameSpace)) { m_ExtensionUsing.Add(nameSpace); } } } m_ExtensionMethods.SortMethod(); m_Methods.ForEach(_ => m_MethodNames.Add(_.Name)); m_ExtensionMethods.ForEach(_ => m_MethodNames.Add(_.Name)); }