Esempio n. 1
0
File: Toml.cs Progetto: zanedp/Nett
        public static T ReadString <T>(string toRead, TomlSettings settings)
        {
            if (settings == null)
            {
                throw new ArgumentNullException(nameof(settings));
            }

            TomlTable tt     = ReadString(toRead, settings);
            T         result = tt.Get <T>();

            return(result);
        }
        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);
            }
        }