void ITomlObjectVisitor.Visit(TomlTableArray tableArray)
        {
            var arr = new Dictionary <string, object> [tableArray.Count];

            for (int i = 0; i < tableArray.Count; i++)
            {
                var conv = new ConvertTomlTableToDictionaryConversionVisitor();
                arr[i] = conv.Convert(tableArray[i]);
            }

            this.table[this.currentKey] = arr;
        }
        void ITomlObjectVisitor.Visit(TomlTableArray tableArray)
        {
            var arr = new Dictionary<string, object>[tableArray.Count];

            for (int i = 0; i < tableArray.Count; i++)
            {
                var conv = new ConvertTomlTableToDictionaryConversionVisitor();
                arr[i] = conv.Convert(tableArray[i]);
            }

            this.table[this.currentKey] = arr;
        }
        void ITomlObjectVisitor.Visit(TomlTable table)
        {
            Type tableToTypeMappingTargetType;

            if ((tableToTypeMappingTargetType = table.Root.Settings.TryGetMappedType(this.currentKey, null)) != null)
            {
                this.table[this.currentKey] = table.Get(tableToTypeMappingTargetType);
            }
            else
            {
                var conv = new ConvertTomlTableToDictionaryConversionVisitor();
                this.table[this.currentKey] = conv.Convert(table);
            }
        }
Beispiel #4
0
        public Dictionary <string, object> ToDictionary()
        {
            var converter = new ConvertTomlTableToDictionaryConversionVisitor();

            return(converter.Convert(this));
        }
        public object Convert(ITomlRoot root, object value, Type targetType)
        {
            var converter = new ConvertTomlTableToDictionaryConversionVisitor();

            return(converter.Convert((TomlTable)value));
        }
        void ITomlObjectVisitor.Visit(TomlTable table)
        {
            Type tableToTypeMappingTargetType;

            if ((tableToTypeMappingTargetType = table.Root.Config.TryGetMappedType(this.currentKey, null)) != null)
            {
                this.table[this.currentKey] = table.Get(tableToTypeMappingTargetType);
            }
            else
            {
                var conv = new ConvertTomlTableToDictionaryConversionVisitor();
                this.table[this.currentKey] = conv.Convert(table);
            }
        }
 public object Convert(ITomlRoot root, object value, Type targetType)
 {
     var converter = new ConvertTomlTableToDictionaryConversionVisitor();
     return converter.Convert((TomlTable)value);
 }