private void initialize(SharpSerializerBinarySettings settings) { // PropertiesToIgnore this.PropertyProvider.PropertiesToIgnore = settings.AdvancedSettings.PropertiesToIgnore; this.PropertyProvider.AttributesToIgnore = settings.AdvancedSettings.AttributesToIgnore; //RootName this.RootName = settings.AdvancedSettings.RootName; // TypeNameConverter) ITypeNameConverter typeNameConverter = settings.AdvancedSettings.TypeNameConverter ?? DefaultInitializer.GetTypeNameConverter( settings.IncludeAssemblyVersionInTypeName, settings.IncludeCultureInTypeName, settings.IncludePublicKeyTokenInTypeName); // Create Serializer and Deserializer Polenter.Serialization.Advanced.Binary.IBinaryReader reader = null; Polenter.Serialization.Advanced.Binary.IBinaryWriter writer = null; if (settings.Mode == BinarySerializationMode.Burst) { // Burst mode writer = new BurstBinaryWriter(typeNameConverter, settings.Encoding); reader = new BurstBinaryReader(typeNameConverter, settings.Encoding); } else { // Size optimized mode writer = new SizeOptimizedBinaryWriter(typeNameConverter, settings.Encoding); reader = new SizeOptimizedBinaryReader(typeNameConverter, settings.Encoding); } this._deserializer = new BinaryPropertyDeserializer(reader); this._serializer = new BinaryPropertySerializer(writer); }
private void Initialize(BinarySettings settings) { //RootName RootName = settings.AdvancedSettings.RootName; // TypeNameConverter) var typeNameConverter = settings.AdvancedSettings.TypeNameConverter ?? DefaultInitializer.GetTypeNameConverter( settings.IncludeAssemblyVersionInTypeName, settings.IncludeCultureInTypeName, settings.IncludePublicKeyTokenInTypeName); // Create Serializer and Deserializer IBinaryReader reader = null; IBinaryWriter writer = null; if (settings.Mode == BinarySerializationMode.Burst) { // Burst mode writer = new BurstBinaryWriter(typeNameConverter, settings.Encoding); reader = new BurstBinaryReader(typeNameConverter, settings.Encoding); } else { // Size optimized mode writer = new SizeOptimizedBinaryWriter(typeNameConverter, settings.Encoding); reader = new SizeOptimizedBinaryReader(typeNameConverter, settings.Encoding); } _deserializer = new BinaryPropertyDeserializer(reader); _serializer = new BinaryPropertySerializer(writer); }