示例#1
0
        public static ITypeSerialize GetByFieldInfo(FieldInfo fieldInfo)
        {
#if USE_HOT
            if (fieldInfo is ILRuntimeFieldInfo)
            {
                return(GetByType(fieldInfo as ILRuntimeFieldInfo));
            }
#endif
            if (fieldInfo.FieldType == typeof(RefType))
            {
                if (RefTypes.TryGetValue(fieldInfo, out var ts))
                {
                    return(ts);
                }

                var att = fieldInfo.GetCustomAttribute <ILSerializable>();
                if (att != null)
                {
                    ts = new RefTypeSerialize(Help.GetTypeByFullName(att.typeName));
                    RefTypes.Add(fieldInfo, ts);
                }
                else
                {
                    return(AnyRefTypeSerialize.instance);
                }

                return(ts);
            }

            return(GetByType(fieldInfo.FieldType));
        }
示例#2
0
        public static ITypeSerialize GetByFieldInfo(FieldInfo fieldInfo)
        {
#if USE_HOT
            if (fieldInfo is ILRuntimeFieldInfo)
            {
                return(GetByType(fieldInfo as ILRuntimeFieldInfo));
            }
#endif
            if (fieldInfo.FieldType == typeof(RefType))
            {
                if (RefTypes.TryGetValue(fieldInfo, out var ts))
                {
                    return(ts);
                }

                ts = new RefTypeSerialize(IL.Help.GetTypeByFullName(fieldInfo.GetCustomAttribute <ILSerializable>().typeName));
                RefTypes.Add(fieldInfo, ts);
                return(ts);
            }

            return(GetByType(fieldInfo.FieldType));
        }