public SerializeNode(Type type, NodeCategory nodeCategory, TypeNode typeNode = null, CustomSerialierAttribute customAttr = null) : base(type) { Category = nodeCategory; TypeNode = typeNode; customAttribute = customAttr; }
public static SerializeNode Create(Type fieldType, CustomSerialierAttribute customAttribute = null) { var type = fieldType; if (type.IsArray) { return(new SerializeNode(type, NodeCategory.ARRAY, customAttr: customAttribute)); } if (type == typeof(SerializableTimeSpan)) { return(new SerializeNode(type, NodeCategory.TIMESPAN, customAttr: customAttribute)); } if (type == typeof(DateTime)) { return(new SerializeNode(type, NodeCategory.DATETIME, customAttr: customAttribute)); } if (TypeUtil.IsSubclassOfDictionary(type)) { return(new SerializeNode(type, NodeCategory.DICTIONARY, customAttr: customAttribute)); } if (TypeUtil.IsSubclassOfList(type)) { return(new SerializeNode(type, NodeCategory.LIST, customAttr: customAttribute)); } if (TypeUtil.IsNullable(type)) { return(new NullableSerializationNode(type, Create(TypeUtil.GetNullableValueType(type)), customAttribute)); } if (type.IsPrimitive) { return(new SerializeNode(type, NodeCategory.PRIMITIVE, customAttr: customAttribute)); } if (type.IsEnum) { return(new SerializeNode(type, NodeCategory.ENUM, customAttr: customAttribute)); } if (XmlUtil.IsPolymorphicClass(type)) { return(new SerializeNode(type, NodeCategory.POLY_CLASS, customAttr: customAttribute)); } if (type.IsClass) { return(new SerializeNode(type, NodeCategory.CLASS, customAttr: customAttribute)); } if (type.IsValueType) { return(new SerializeNode(type, NodeCategory.STRUCT, customAttr: customAttribute)); } return(null); }
public NullableSerializationNode(Type type, SerializeNode subTypeNode, CustomSerialierAttribute customAttribute) : base(type, NodeCategory.NULLABLE, customAttr: customAttribute) { Serialize = subTypeNode; }
public FieldNode(Type type, FieldInfo field) : base(type) { this.field = field; customAttribute = TypeUtil.GetCustomAttribute <CustomSerialierAttribute>(field, true); }
public TypeNode(RootType type) : base(type.Type) { rootType = type; customAttribute = TypeUtil.GetCustomAttribute <CustomSerialierAttribute>(type.Type, true); }
public TypeNode(Type type, CustomSerialierAttribute customAttr = null) : base(type) { rootType = new RootType(type, XmlUtil.IsPolymorphicClass(type)); customAttribute = customAttr ?? TypeUtil.GetCustomAttribute <CustomSerialierAttribute>(type, true); }