Beispiel #1
0
        internal static object Initialize(OValue hander, ObjectInitializeContext <OValue> info)
        {
            hander.desers = info.Deserializes;
            object value = info.Deserializer(hander);

            return(value);
        }
Beispiel #2
0
        internal static void CreateContext(Type type, ObjectInitializeContext <OValue> info)
        {
            if (Instance.builder.IsBaseType(type) == true)
            {
                return;
            }

            var fields = type.GetFields(info.Seting.Flags);

            foreach (FieldInfo field in fields)
            {
                if (Utils.IsIgnoreAttribute(field) == false)
                {
                    if (Utils.IsDeep(field.FieldType))
                    {
                        info.DesList.Add(Instance.GetDeserializeSurrogate(field.FieldType));
                        CreateContext(field.FieldType, info);
                    }
                }
            }
            var propertys = type.GetProperties(info.Seting.Flags);

            foreach (PropertyInfo property in propertys)
            {
                if (Utils.IsIgnoreAttribute(property) == false)
                {
                    if (Utils.IsDeep(property.PropertyType))
                    {
                        info.DesList.Add(Instance.GetDeserializeSurrogate(property.PropertyType));
                        CreateContext(property.PropertyType, info);
                    }
                }
            }
        }
Beispiel #3
0
 internal static ObjectInitializeContext <OValue> GetContext(Type type)
 {
     if (types.TryGetValue(type, out var info) == false)
     {
         info = new ObjectInitializeContext <OValue>();
         CreateContext(type, info);
         info.Deserializer = Instance.GetDeserializeSurrogate(type);
         types.Add(type, info);
         if (info != null)
         {
             info.ToArray();
         }
     }
     return(info);
 }