Beispiel #1
0
        private RootNode Generate(RootType type)
        {
            if (type.Type == null)
            {
                return(null);
            }

            if (registeredTypes.ContainsKey(type))
            {
                return(registeredTypes[type]);
            }

            RootType[] referencedTypes;

            RootNode root = registeredTypes[type] = Generate(type, out referencedTypes);

            if (referencedTypes != null)
            {
                for (int i = 0; i < referencedTypes.Length; i++)
                {
                    Generate(referencedTypes[i]);
                }
            }

            return(root);
        }
Beispiel #2
0
        private RootNode Generate(RootType type, out RootType[] referencedTypes)
        {
            registeredTypes.Add(type, null);

            HashSet <RootType> referTypes = new HashSet <RootType>();
            RootNode           root       = new RootNode(type);

            root.Generate(referTypes);
            referencedTypes = referTypes.ToArray();
            return(root);
        }
Beispiel #3
0
 public RootNode(RootType type) : base(type.Type)
 {
     Root = type;
 }
Beispiel #4
0
 public RootNode(Type type) : base(type)
 {
     Root = new RootType(type);
 }
Beispiel #5
0
 public WritePartNode(RootType type, List <FieldInfo> fields) : base(type.Type)
 {
     this.fields = fields;
     rootType    = type;
 }
Beispiel #6
0
 public ReadPartNode(RootType type, List <FieldInfo> fields) : base(type.Type)
 {
     this.fields = fields;
     rootType    = type;
     CreateNew   = type.Type.IsClass && type.Type.GetConstructor(new Type[0]) != null;
 }
Beispiel #7
0
 public TypeNode(RootType type) : base(type.Type)
 {
     rootType        = type;
     customAttribute = TypeUtil.GetCustomAttribute <CustomSerialierAttribute>(type.Type, true);
 }
Beispiel #8
0
 public TypeNode(Type type, CustomSerialierAttribute customAttr = null) : base(type)
 {
     rootType        = new RootType(type, XmlUtil.IsPolymorphicClass(type));
     customAttribute = customAttr ?? TypeUtil.GetCustomAttribute <CustomSerialierAttribute>(type, true);
 }