示例#1
0
        //...
        public fsSerializer()
        {
            _cachedOverrideConverterInstances = new Dictionary <Type, fsBaseConverter>();
            _cachedConverters = new Dictionary <Type, fsBaseConverter>();
            _cachedProcessors = new Dictionary <Type, List <fsObjectProcessor> >();

            _references          = new fsCyclicReferenceManager();
            _lazyReferenceWriter = new fsLazyCycleDefinitionWriter();
            _collectors          = new Stack <ISerializationCollector>();

            // 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 fsUnityObjectConverter {
                    Serializer = this
                },
                new fsTypeConverter {
                    Serializer = this
                },
                new fsEnumConverter {
                    Serializer = this
                },
                new fsPrimitiveConverter {
                    Serializer = this
                },
                new fsArrayConverter {
                    Serializer = this
                },
                new fsDictionaryConverter {
                    Serializer = this
                },
                new fsListConverter {
                    Serializer = this
                },
                new fsReflectedConverter {
                    Serializer = this
                }
            };
            _availableDirectConverters = new Dictionary <Type, fsDirectConverter>();

            _processors = new List <fsObjectProcessor>();

            //DirectConverters. Add manually for performance
            AddConverter(new AnimationCurve_DirectConverter());
            AddConverter(new Bounds_DirectConverter());
            AddConverter(new GUIStyleState_DirectConverter());
            AddConverter(new GUIStyle_DirectConverter());
            AddConverter(new Gradient_DirectConverter());
            AddConverter(new Keyframe_DirectConverter());
            AddConverter(new LayerMask_DirectConverter());
            AddConverter(new RectOffset_DirectConverter());
            AddConverter(new Rect_DirectConverter());

            AddConverter(new Vector2Int_DirectConverter());
            AddConverter(new Vector3Int_DirectConverter());
        }
示例#2
0
        public fsSerializer()
        {
            _cachedOverrideConverterInstances = 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 fsUnityObjectConverter {
                    Serializer = this
                },
                new fsTypeConverter {
                    Serializer = this
                },
                new fsEnumConverter {
                    Serializer = this
                },
                new fsPrimitiveConverter {
                    Serializer = this
                },
                new fsArrayConverter {
                    Serializer = this
                },
                new fsDictionaryConverter {
                    Serializer = this
                },
                new fsListConverter {
                    Serializer = this
                },
                new fsReflectedConverter {
                    Serializer = this
                }
            };
            _availableDirectConverters = new Dictionary <Type, fsDirectConverter>();

            _processors = new List <fsObjectProcessor>();

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

            //create instances of direct converters
            for (var i = 0; i < _directConverterTypes.Length; i++)
            {
                AddConverter((fsDirectConverter)Activator.CreateInstance(_directConverterTypes[i]));
            }
        }
示例#3
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 fsIEnumerableConverter {
                    Serializer = this
                },
                new fsKeyValuePairConverter {
                    Serializer = this
                },
                new fsWeakReferenceConverter {
                    Serializer = this
                },
                new fsReflectedConverter {
                    Serializer = this
                }
            };

            _processors = new List <fsObjectProcessor>();

            Context = new fsContext();
        }
示例#4
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>();

/*          //PARADOXNOTION ADDITION
 *          //ISerializationCallbacks are called without processors above, so that we can have both processor and callbacks
 *          _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));
            }
        }
        public fsSerializer()
        {
            _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()
            };

            Context = new fsContext();

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