예제 #1
0
        public fsSerializer()
        {
            _cachedConverters = new Dictionary <Type, fsConverter>();
            _cachedProcessors = new Dictionary <Type, List <fsObjectProcessor> >();

            _references          = new fsCyclicReferenceManager();
            _lazyReferenceWriter = new fsLazyCycleDefinitionWriter();

            // note: The order here is important. Items at the beginning of this
            //       list will be used before converters at the end. Converters
            //       added via AddConverter() are added to the front of the list.
            _converters = new List <fsConverter> {
                new fsNullableConverter {
                    Serializer = this
                },
                new fsGuidConverter {
                    Serializer = this
                },
                new fsTypeConverter {
                    Serializer = this
                },
                new fsDateConverter {
                    Serializer = this
                },
                new fsEnumConverter {
                    Serializer = this
                },
                new fsPrimitiveConverter {
                    Serializer = this
                },
                new fsArrayConverter {
                    Serializer = this
                },
                new fsDictionaryConverter {
                    Serializer = this
                },
                new fsIEnumerableConverter {
                    Serializer = this
                },
                new fsKeyValuePairConverter {
                    Serializer = this
                },
                new fsWeakReferenceConverter {
                    Serializer = this
                },
                new fsReflectedConverter {
                    Serializer = this
                }
            };

            _processors = new List <fsObjectProcessor>();

            Context = new fsContext();
        }
예제 #2
0
        public fsSerializer()
        {
            _cachedConverters    = new Dictionary <Type, fsConverter>();
            _references          = new fsCyclicReferenceManager();
            _lazyReferenceWriter = new fsLazyCycleDefinitionWriter();

            _converters = new List <fsConverter> {
                new fsNullableConverter {
                    Serializer = this
                },
                new fsGuidConverter {
                    Serializer = this
                },
                new fsTypeConverter {
                    Serializer = this
                },
                new fsDateConverter {
                    Serializer = this
                },
                new fsEnumConverter {
                    Serializer = this
                },
                new fsPrimitiveConverter {
                    Serializer = this
                },
                new fsArrayConverter {
                    Serializer = this
                },
                new fsIEnumerableConverter {
                    Serializer = this
                },
                new fsKeyValuePairConverter {
                    Serializer = this
                },
                new fsWeakReferenceConverter {
                    Serializer = this
                },
                new fsReflectedConverter {
                    Serializer = this
                }
            };

            Context = new fsContext();
        }
예제 #3
0
        public fsSerializer() {
            _cachedConverterTypeInstances = new Dictionary<Type, fsBaseConverter>();
            _cachedConverters = new Dictionary<Type, fsBaseConverter>();
            _cachedProcessors = new Dictionary<Type, List<fsObjectProcessor>>();

            _references = new fsCyclicReferenceManager();
            _lazyReferenceWriter = new fsLazyCycleDefinitionWriter();

            // note: The order here is important. Items at the beginning of this
            //       list will be used before converters at the end. Converters
            //       added via AddConverter() are added to the front of the list.
            _availableConverters = new List<fsConverter> {
                new fsNullableConverter { Serializer = this },
                new fsGuidConverter { Serializer = this },
                new fsTypeConverter { Serializer = this },
                new fsDateConverter { Serializer = this },
                new fsEnumConverter { Serializer = this },
                new fsPrimitiveConverter { Serializer = this },
                new fsArrayConverter { Serializer = this },
                new fsDictionaryConverter { Serializer = this },
                new fsIEnumerableConverter { Serializer = this },
                new fsKeyValuePairConverter { Serializer = this },
                new fsWeakReferenceConverter { Serializer = this },
                new fsReflectedConverter { Serializer = this }
            };
            _availableDirectConverters = new Dictionary<Type, fsDirectConverter>();

            _processors = new List<fsObjectProcessor>() {
                new fsSerializationCallbackProcessor()
            };

#if !NO_UNITY
            _processors.Add(new fsSerializationCallbackReceiverProcessor());
#endif

            Context = new fsContext();
            Config = new fsConfig();

            // Register the converters from the registrar
            foreach (var converterType in fsConverterRegistrar.Converters) {
                AddConverter((fsBaseConverter)Activator.CreateInstance(converterType));
            }
        }