IsMemberFilter() public static method

public static IsMemberFilter ( MemberInfo mi ) : bool
mi MemberInfo
return bool
コード例 #1
0
        private static void RecordTypeAndBaseType(Type type)
        {
#if ToLuaVersion
            if (ToLuaFacility.toluaRewriteTypes.Contains(type))
            {
                return;
            }
#endif

            if (exportTypeList.Contains(type))
            {
                return;
            }

            if (ToLuaExport.IsMemberFilter(type))
            {
                return;
            }

            exportTypeList.Add(type);
            if (type.BaseType != null && !type.IsEnum)
            {
                RecordTypeAndBaseType(type.BaseType);
            }
        }
コード例 #2
0
        private static void RecordType(Type type)
        {
            if (exportTypeList.Contains(type))
            {
                return;
            }

            if (ToLuaExport.IsMemberFilter(type))
            {
                return;
            }

            exportTypeList.Add(type);
        }
コード例 #3
0
        private static void WriteDelegateTypeDefine()
        {
            List <Type> exportDelegateTypeList = new List <Type>();

            for (int i = 0; i < CustomSettings.customDelegateList.Length; i++)
            {
                exportDelegateTypeList.Add(CustomSettings.customDelegateList[i].type);
            }

            //查找所有导出类型中,是否有用到了委托的
            Action <Type> recordDelegateTypeToList = type =>
            {
                if (typeof(Delegate).IsAssignableFrom(type))
                {
                    if (ToLuaExport.IsMemberFilter(type))
                    {
                        return;
                    }

                    if (!exportDelegateTypeList.Contains(type))
                    {
                        exportDelegateTypeList.Add(type);
                    }
                }
            };

            for (int i = 0; i < exportTypeList.Count; i++)
            {
                Type exportType = exportTypeList[i];
#if ToLuaVersion
                //tolua基础类型的委托事件好像都没有被导出来
                if (ToLuaFacility.toluaBaseTypes.Contains(exportType))
                {
                    continue;
                }
#endif
                MethodInfo[]   methodInfos   = exportType.GetMethods(BindingFlags.Public | BindingFlags.Static);
                FieldInfo[]    fieldInfos    = exportType.GetFields(BindingFlags.Public | BindingFlags.Static);
                PropertyInfo[] propertyInfos = exportType.GetProperties(BindingFlags.Public | BindingFlags.Static);

                for (int j = 0; j < methodInfos.Length; j++)
                {
                    MethodInfo      methodInfo     = methodInfos[j];
                    ParameterInfo[] parameterInfos = methodInfo.GetParameters();
                    for (int k = 0; k < parameterInfos.Length; k++)
                    {
                        ParameterInfo parameterInfo = parameterInfos[k];
                        if (parameterInfo.IsOut || parameterInfo.ParameterType.IsByRef)
                        {
                            recordDelegateTypeToList(parameterInfo.ParameterType.GetElementType());
                        }
                        else
                        {
                            recordDelegateTypeToList(parameterInfo.ParameterType);
                        }
                    }

                    ParameterInfo returnInfo = methodInfo.ReturnParameter;
                    recordDelegateTypeToList(returnInfo.ParameterType);
                }

                for (int j = 0; j < fieldInfos.Length; j++)
                {
                    FieldInfo fieldInfo = fieldInfos[j];
                    recordDelegateTypeToList(fieldInfo.FieldType);
                }

                for (int j = 0; j < propertyInfos.Length; j++)
                {
                    PropertyInfo propertyInfo = propertyInfos[j];
                    recordDelegateTypeToList(propertyInfo.PropertyType);
                }
            }

//            Debug.Log("以下Delegate类型需要导出:");
//            for (int i = 0; i < exportDelegateTypeList.Count; i++)
//            {
//                Debug.Log(exportDelegateTypeList[i].FullName);
//            }

            for (int i = 0; i < exportDelegateTypeList.Count; i++)
            {
                Type delegateType = exportDelegateTypeList[i];
                WriteDelegateTypeComment(delegateType);
                if (delegateType.IsGenericType)
                {
//                    Debug.Log("泛型委托: " + delegateType.FullName);

                    if (string.IsNullOrEmpty(delegateType.FullName))
                    {
                        continue;
                    }

                    tempSb.Clear();
                    tempSb.Append(delegateType.GetGenericTypeFullName().ReplaceDotOrPlusWithUnderscore());

                    Type[] genericTypes = delegateType.GetGenericArguments();
                    for (int j = 0; j < genericTypes.Length; j++)
                    {
//                        Debug.Log("包含泛型参数类型: " + genericTypes[j].FullName);
                        tempSb.AppendFormat("_{0}", genericTypes[j].ToCSharpTypeFullName().ReplaceDotOrPlusWithUnderscore());
                    }

                    tempSb.AppendFormat(" = {0}", delegateType.GetGenericTypeFullName());
                    for (int j = 0; j < genericTypes.Length; j++)
                    {
                        tempSb.AppendFormat("_{0}", genericTypes[j].ToCSharpTypeFullName().ReplaceDotOrPlusWithUnderscore());
                    }

                    sb.AppendLine(tempSb.ToString());
                }
                else
                {
                    sb.AppendLine(string.Format("{0} = {1}", delegateType.FullName.ReplaceDotOrPlusWithUnderscore(),
                                                delegateType.FullName.ReplacePlusWithDot()));
                }
            }
        }