コード例 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SerializerSettings" /> class.
        /// </summary>
        public SerializerSettings(IYamlSchema schema)
        {
            PreferredIndent            = 2;
            IndentLess                 = false;
            EmitAlias                  = true;
            EmitTags                   = true;
            AllowErrors                = false;
            ResetAlias                 = true;
            SortKeyForMapping          = true;
            EmitJsonComptible          = false;
            EmitCapacityForList        = false;
            SpecialCollectionMember    = "~Items";
            LimitPrimitiveFlowSequence = 0;
            DefaultStyle               = YamlStyle.Block;
            this.schema                = schema ?? new CoreSchema();
            AssemblyRegistry           = new AssemblyRegistry(Schema);
            attributeRegistry          = new AttributeRegistry();
            ObjectFactory              = new DefaultObjectFactory();
            ObjectSerializerBackend    = new DefaultObjectSerializerBackend();
            ComparerForKeySorting      = new DefaultKeyComparer();
            NamingConvention           = new DefaultNamingConvention();

            // Register default mapping for map and seq
            AssemblyRegistry.RegisterTagMapping("!!map", typeof(IDictionary <object, object>), false);
            AssemblyRegistry.RegisterTagMapping("!!seq", typeof(IList <object>), false);
        }
コード例 #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SerializerSettings" /> class.
        /// </summary>
        public SerializerSettings(IYamlSchema schema)
        {
            PreferredIndent = 2;
            IndentLess = false;
            EmitAlias = true;
            EmitTags = true;
            SortKeyForMapping = true;
            EmitJsonComptible = false;
            EmitCapacityForList = false;
            SpecialCollectionMember = "~Items";
            LimitPrimitiveFlowSequence = 0;
            DefaultStyle = YamlStyle.Block;
            this.schema = schema ?? new CoreSchema();
            AssemblyRegistry = new AssemblyRegistry(Schema);
            attributeRegistry = new AttributeRegistry();
            ObjectFactory = new DefaultObjectFactory();
            ObjectSerializerBackend = new DefaultObjectSerializerBackend();
            ComparerForKeySorting = new DefaultKeyComparer();
            NamingConvention = new DefaultNamingConvention();

            // Register default mapping for map and seq
            AssemblyRegistry.RegisterTagMapping("!!map", typeof(IDictionary<object, object>));
            AssemblyRegistry.RegisterTagMapping("!!seq", typeof(IList<object>));
        }
コード例 #3
0
ファイル: SerializerSettings.cs プロジェクト: uwx/SharpYaml
 /// <summary>
 /// Register a mapping between a tag and a type.
 /// </summary>
 /// <param name="tagName">Name of the tag.</param>
 /// <param name="tagType">Type of the tag.</param>
 /// <param name="isAlias">if set to <c>true</c> the new tag name is an alias to a type that has already a tag name associated to it.</param>
 public void RegisterTagMapping(string tagName, Type tagType, bool isAlias = false)
 {
     AssemblyRegistry.RegisterTagMapping(tagName, tagType, isAlias);
 }
コード例 #4
0
ファイル: SerializerSettings.cs プロジェクト: Turee/SharpYaml
 /// <summary>
 /// Register a mapping between a tag and a type.
 /// </summary>
 /// <param name="tagName">Name of the tag.</param>
 /// <param name="tagType">Type of the tag.</param>
 public void RegisterTagMapping(string tagName, Type tagType)
 {
     AssemblyRegistry.RegisterTagMapping(tagName, tagType);
 }