Exemple #1
0
        public static void ScanType(Type type)
        {
            foreach (Type nestedType in type.GetNestedTypes())
            {
                ScanType(nestedType);
            }

            LispCustomSerializerAttribute customSerializer =
                (LispCustomSerializerAttribute)
                Attribute.GetCustomAttribute(type, typeof(LispCustomSerializerAttribute));

            if (customSerializer != null)
            {
                object instance = CreateObject(type);
                typeSerializers.Add(customSerializer.Type, (ILispSerializer)instance);
                return;
            }

            LispRootAttribute rootAttrib = (LispRootAttribute)
                                           Attribute.GetCustomAttribute(type, typeof(LispRootAttribute));

            if (rootAttrib != null)
            {
                LispRootSerializer serializer = new LispRootSerializer(type);
                typeSerializers.Add(type, serializer);
                return;
            }
        }
Exemple #2
0
        internal static ILispSerializer CreateRootSerializer(Type type)
        {
            LispRootSerializer serializer = new LispRootSerializer(type);

            typeSerializers.Add(type, serializer);

            return(serializer);
        }
        public static void ScanType(Type type)
        {
            foreach(Type nestedType in type.GetNestedTypes())
                ScanType(nestedType);

            LispCustomSerializerAttribute customSerializer =
                (LispCustomSerializerAttribute)
                Attribute.GetCustomAttribute(type, typeof(LispCustomSerializerAttribute));
            if(customSerializer != null) {
                object instance = CreateObject(type);
                typeSerializers.Add(customSerializer.Type, (ILispSerializer) instance);
                return;
            }

            LispRootAttribute rootAttrib = (LispRootAttribute)
                Attribute.GetCustomAttribute(type, typeof(LispRootAttribute));
            if(rootAttrib != null) {
                LispRootSerializer serializer = new LispRootSerializer(type);
                typeSerializers.Add(type, serializer);
                return;
            }
        }
        internal static ILispSerializer CreateRootSerializer(Type type)
        {
            LispRootSerializer serializer = new LispRootSerializer(type);
            typeSerializers.Add(type, serializer);

            return serializer;
        }