示例#1
0
 public PlantumlExporter(
     ITypeWriter typeWriter,
     ITypeNameConverter escapedTypeNameConverter)
 {
     _typeWriter = typeWriter;
     _escapedTypeNameConverter = escapedTypeNameConverter;
 }
示例#2
0
 ///<summary>
 ///</summary>
 ///<param name = "typeNameConverter"></param>
 ///<param name = "encoding"></param>
 ///<exception cref = "ArgumentNullException"></exception>
 public BurstBinaryReader(ITypeNameConverter typeNameConverter, Encoding encoding)
 {
     if (typeNameConverter == null) throw new ArgumentNullException("typeNameConverter");
     if (encoding == null) throw new ArgumentNullException("encoding");
     _typeNameConverter = typeNameConverter;
     _encoding = encoding;
 }
示例#3
0
 public SampleSettingsReader(
     ITypeNameConverter typeNameConverter,
     ISettingsSource <SampleSource> source,
     IDeserializer <SampleSource> deserializer)
     : base(typeNameConverter, source, deserializer)
 {
 }
示例#4
0
        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);
        }
示例#5
0
 /// <summary>
 ///   Default is CultureInfo.InvariantCulture used
 /// </summary>
 public SimpleValueConverter()
 {
     _cultureInfo = CultureInfo.InvariantCulture;
     _typeNameConverter = new TypeNameConverter();
     // Alternatively
     //_cultureInfo = System.Threading.Thread.CurrentThread.CurrentCulture;
 }
        private void initialize(SharpSerializerXmlSettings settings)
        {
            // PropertiesToIgnore
            PropertyProvider.PropertiesToIgnore = settings.AdvancedSettings.PropertiesToIgnore;
            PropertyProvider.AttributesToIgnore = settings.AdvancedSettings.AttributesToIgnore;
            //RootName
            RootName = settings.AdvancedSettings.RootName;
            // TypeNameConverter)
            ITypeNameConverter typeNameConverter = settings.AdvancedSettings.TypeNameConverter ??
                                                   DefaultInitializer.GetTypeNameConverter(
                settings.IncludeAssemblyVersionInTypeName,
                settings.IncludeCultureInTypeName,
                settings.IncludePublicKeyTokenInTypeName);
            // SimpleValueConverter
            ISimpleValueConverter simpleValueConverter = settings.AdvancedSettings.SimpleValueConverter ??
                                                         DefaultInitializer.GetSimpleValueConverter(settings.Culture, typeNameConverter);
            // XmlWriterSettings
            XmlWriterSettings xmlWriterSettings = DefaultInitializer.GetXmlWriterSettings(settings.Encoding);
            // XmlReaderSettings
            XmlReaderSettings xmlReaderSettings = DefaultInitializer.GetXmlReaderSettings();

            // Create Serializer and Deserializer
            var reader = new DefaultXmlReader(typeNameConverter, simpleValueConverter, xmlReaderSettings);
            var writer = new DefaultXmlWriter(typeNameConverter, simpleValueConverter, xmlWriterSettings);

            _serializer   = new XmlPropertySerializer(writer);
            _deserializer = new XmlPropertyDeserializer(reader);
        }
 ///<summary>
 ///</summary>
 ///<param name = "typeNameConverter"></param>
 ///<param name = "encoding"></param>
 ///<exception cref = "ArgumentNullException"></exception>
 public SizeOptimizedBinaryWriter(ITypeNameConverter typeNameConverter, Encoding encoding)
 {
     if (typeNameConverter == null) throw new ArgumentNullException("typeNameConverter");
     if (encoding == null) throw new ArgumentNullException("encoding");
     _encoding = encoding;
     _typeNameConverter = typeNameConverter;
 }
示例#8
0
 /// <summary>
 ///   Default is CultureInfo.InvariantCulture used
 /// </summary>
 public SimpleValueConverter()
 {
     _cultureInfo       = CultureInfo.InvariantCulture;
     _typeNameConverter = new TypeNameConverter();
     // Alternatively
     //_cultureInfo = System.Threading.Thread.CurrentThread.CurrentCulture;
 }
 protected BaseSettingsReader(
     ITypeNameConverter typeNameConverter,
     ISettingsSource <TSource> source,
     IDeserializer <TSource> deserializer)
 {
     _typeNameConverter = typeNameConverter;
     _source            = source;
     _deserializer      = deserializer;
 }
示例#10
0
 public TypeRelationsWriter(
     ITypeNameConverter escapedTypeNameConverter,
     TextWriter writer,
     HashSet <Type> typesToWrite)
 {
     _escapedTypeNameConverter = escapedTypeNameConverter;
     _writer       = writer;
     _typesToWrite = typesToWrite;
 }
示例#11
0
        ///<summary>
        ///</summary>
        ///<param name = "typeNameConverter"></param>
        ///<param name = "valueConverter"></param>
        ///<param name = "settings"></param>
        ///<exception cref = "ArgumentNullException"></exception>
        public DefaultXmlReader(ITypeNameConverter typeNameConverter, ISimpleValueConverter valueConverter,
                                XmlReaderSettings settings)
        {
            if (typeNameConverter == null) throw new ArgumentNullException("typeNameConverter");
            if (valueConverter == null) throw new ArgumentNullException("valueConverter");
            if (settings == null) throw new ArgumentNullException("settings");

            _typeNameConverter = typeNameConverter;
            _valueConverter = valueConverter;
            _settings = settings;
        }
示例#12
0
 ///<summary>
 ///</summary>
 ///<param name = "typeNameConverter"></param>
 ///<param name = "encoding"></param>
 ///<exception cref = "ArgumentNullException"></exception>
 public BurstBinaryWriter(ITypeNameConverter typeNameConverter, Encoding encoding)
 {
     if (typeNameConverter == null) {
         throw new ArgumentNullException("typeNameConverter");
     }
     if (encoding == null) {
         throw new ArgumentNullException("encoding");
     }
     _encoding = encoding;
     _typeNameConverter = typeNameConverter;
 }
示例#13
0
        /// <summary>
        ///   Constructor with custom ITypeNameProvider and ISimpleValueConverter and custom XmlWriterSettings
        /// </summary>
        public DefaultXmlWriter(ITypeNameConverter typeNameProvider, ISimpleValueConverter simpleValueConverter,
                                XmlWriterSettings settings)
        {
            if (typeNameProvider == null) throw new ArgumentNullException("typeNameProvider");
            if (simpleValueConverter == null) throw new ArgumentNullException("simpleValueConverter");
            if (settings == null) throw new ArgumentNullException("settings");

            _simpleValueConverter = simpleValueConverter;
            _settings = settings;
            _typeNameProvider = typeNameProvider;
        }
示例#14
0
 /// <summary>
 /// </summary>
 /// <param name="typeNameConverter"></param>
 /// <param name="encoding"></param>
 /// <exception cref="ArgumentNullException"></exception>
 public BurstBinaryWriter(ITypeNameConverter typeNameConverter, Encoding encoding)
 {
     if (typeNameConverter == null)
     {
         throw new ArgumentNullException(nameof(typeNameConverter));
     }
     if (encoding == null)
     {
         throw new ArgumentNullException(nameof(encoding));
     }
     _encoding          = encoding;
     _typeNameConverter = typeNameConverter;
 }
        // Translation table of property names


        ///<summary>
        ///</summary>
        ///<param name = "typeNameConverter"></param>
        ///<param name = "encoding"></param>
        ///<exception cref = "ArgumentNullException"></exception>
        public SizeOptimizedBinaryReader(ITypeNameConverter typeNameConverter, Encoding encoding)
        {
            if (typeNameConverter == null)
            {
                throw new ArgumentNullException(nameof(typeNameConverter));
            }
            if (encoding == null)
            {
                throw new ArgumentNullException(nameof(encoding));
            }
            _typeNameConverter = typeNameConverter;
            _encoding          = encoding;
        }
示例#16
0
 ///<summary>
 ///</summary>
 ///<param name = "typeNameConverter"></param>
 ///<param name = "encoding"></param>
 ///<exception cref = "ArgumentNullException"></exception>
 public SizeOptimizedBinaryWriter(ITypeNameConverter typeNameConverter, Encoding encoding)
 {
     if (typeNameConverter == null)
     {
         throw new ArgumentNullException("typeNameConverter");
     }
     if (encoding == null)
     {
         throw new ArgumentNullException("encoding");
     }
     _encoding          = encoding;
     _typeNameConverter = typeNameConverter;
 }
 ///<summary>
 ///</summary>
 ///<param name = "typeNameConverter"></param>
 ///<param name = "encoding"></param>
 ///<exception cref = "ArgumentNullException"></exception>
 public BurstBinaryReader(ITypeNameConverter typeNameConverter, Encoding encoding)
 {
     if (typeNameConverter == null)
     {
         throw new ArgumentNullException("typeNameConverter");
     }
     if (encoding == null)
     {
         throw new ArgumentNullException("encoding");
     }
     _typeNameConverter = typeNameConverter;
     _encoding          = encoding;
 }
示例#18
0
 public SimpleTypeWriter(
     ITypeQueryFactory typeQueryFactory,
     ITypeNameWriter typeNameWriter,
     ITypeNameConverter typeNameConverter,
     IEventWriter eventWriter,
     IMethodWriter methodWriter,
     IFieldWriter fieldWriter,
     IPropertyWriter propertyWriter)
 {
     _typeQueryFactory  = typeQueryFactory;
     _typeNameWriter    = typeNameWriter;
     _typeNameConverter = typeNameConverter;
     _eventWriter       = eventWriter;
     _methodWriter      = methodWriter;
     _fieldWriter       = fieldWriter;
     _propertyWriter    = propertyWriter;
 }
示例#19
0
        ///<summary>
        ///</summary>
        ///<param name = "typeNameConverter"></param>
        ///<param name = "valueConverter"></param>
        ///<param name = "settings"></param>
        ///<exception cref = "ArgumentNullException"></exception>
        public DefaultXmlReader(ITypeNameConverter typeNameConverter, ISimpleValueConverter valueConverter,
                                XmlReaderSettings settings)
        {
            if (typeNameConverter == null)
            {
                throw new ArgumentNullException("typeNameConverter");
            }
            if (valueConverter == null)
            {
                throw new ArgumentNullException("valueConverter");
            }
            if (settings == null)
            {
                throw new ArgumentNullException("settings");
            }

            _typeNameConverter = typeNameConverter;
            _valueConverter    = valueConverter;
            _settings          = settings;
        }
示例#20
0
        public DatabasePersister(IDatabaseBase database)
        {
            this.database = database;

            PolymorphDatabaseAttribute polymorphAttr = database.GetType().GetCustomAttribute <PolymorphDatabaseAttribute>();

            if (polymorphAttr != null)
            {
                isPolymorph       = true;
                typeNameConverter = polymorphAttr.Converter;
            }

            XmlTagNamesAttribute tagNameAttr = database.GetType().GetCustomAttribute <XmlTagNamesAttribute>();

            if (tagNameAttr != null)
            {
                rootTag = tagNameAttr.RootTag;
                itemTag = tagNameAttr.ItemTag;
            }
        }
示例#21
0
        /// <summary>
        ///   Constructor with custom ITypeNameProvider and ISimpleValueConverter and custom XmlWriterSettings
        /// </summary>
        public DefaultXmlWriter(ITypeNameConverter typeNameProvider, ISimpleValueConverter simpleValueConverter,
                                XmlWriterSettings settings)
        {
            if (typeNameProvider == null)
            {
                throw new ArgumentNullException("typeNameProvider");
            }
            if (simpleValueConverter == null)
            {
                throw new ArgumentNullException("simpleValueConverter");
            }
            if (settings == null)
            {
                throw new ArgumentNullException("settings");
            }

            _simpleValueConverter = simpleValueConverter;
            _settings             = settings;
            _typeNameProvider     = typeNameProvider;
        }
示例#22
0
 public MethodWriter(ITypeNameConverter typeNameConverter, ITypeNameWriter typeNameWriter)
 {
     _typeNameConverter = typeNameConverter;
     _typeNameWriter    = typeNameWriter;
 }
 /// <summary>
 /// </summary>
 /// <param name="typeNameConverter"></param>
 /// <param name="encoding"></param>
 /// <exception cref="ArgumentNullException"></exception>
 public SizeOptimizedBinaryWriter(ITypeNameConverter typeNameConverter, Encoding encoding)
 {
     _encoding          = encoding ?? throw new ArgumentNullException(nameof(encoding));
     _typeNameConverter = typeNameConverter ?? throw new ArgumentNullException(nameof(typeNameConverter));
 }
 /// <summary>
 /// </summary>
 /// <param name="typeNameConverter"></param>
 /// <param name="encoding"></param>
 /// <exception cref="ArgumentNullException"></exception>
 public BurstBinaryReader(ITypeNameConverter typeNameConverter, Encoding encoding)
 {
     _typeNameConverter = typeNameConverter ?? throw new ArgumentNullException(nameof(typeNameConverter));
     _encoding          = encoding ?? throw new ArgumentNullException(nameof(encoding));
 }
示例#25
0
 public SimpleTypeNameWriter(ITypeNameConverter typeNameConverter)
 {
     _typeNameConverter = typeNameConverter;
 }
 public static ISimpleValueConverter GetSimpleValueConverter(CultureInfo cultureInfo, ITypeNameConverter typeNameConverter)
 {
     return(new SimpleValueConverter(cultureInfo, typeNameConverter));
 }
示例#27
0
 public static ISimpleValueConverter GetSimpleValueConverter(CultureInfo cultureInfo, ITypeNameConverter typeNameConverter)
 {
     return new SimpleValueConverter(cultureInfo, typeNameConverter);
 }
示例#28
0
 /// <summary>
 ///   Here you can customize the culture. I.e. System.Threading.Thread.CurrentThread.CurrentCulture
 /// </summary>
 /// <param name = "cultureInfo"></param>
 /// <param name="typeNameConverter"></param>
 public SimpleValueConverter(CultureInfo cultureInfo, ITypeNameConverter typeNameConverter)
 {
     _cultureInfo = cultureInfo;
     _typeNameConverter = typeNameConverter;
 }
示例#29
0
 //------------------------------------------------------------------------------
 public TypeNameConverter(ITypeNameConverter customTypeNameConverter)
 {
     m_customTypeNameConverter = customTypeNameConverter;
 }
示例#30
0
 /// <summary>
 ///   Here you can customize the culture. I.e. System.Threading.Thread.CurrentThread.CurrentCulture
 /// </summary>
 /// <param name = "cultureInfo"></param>
 /// <param name="typeNameConverter"></param>
 public SimpleValueConverter(CultureInfo cultureInfo, ITypeNameConverter typeNameConverter)
 {
     _cultureInfo       = cultureInfo;
     _typeNameConverter = typeNameConverter;
 }