示例#1
0
                public ProxySubTable(TomlTable tbl, ConversionMappingTableProxy root)
                    : base(tbl.Root)
                {
                    this.root = root;

                    foreach (var r in tbl)
                    {
                        var toAdd = r.Value is TomlTable t ? new ProxySubTable(t, this.root) : r.Value;
                        this.AddRow(new TomlKey(r.Key), toAdd);
                    }
                }
示例#2
0
            private TomlObject TryWrapInConvertProxy(TomlObject obj, Func <TomlObject> resolveParent)
            {
                var conv = obj.Root.Settings.TryGetToTomlConverter(this.clrType);

                if (conv != null)
                {
                    var convBack = obj.Root.Settings.TryGetConverter(obj.GetType(), this.clrType);
                    if (convBack != null)
                    {
                        var instance    = convBack.Convert(obj.Root, obj, this.clrType);
                        var parentTable = (TomlTable)resolveParent();
                        var proxy       = new ConversionMappingTableProxy(
                            this.key, parentTable, instance.GetType(), obj.GetType(), Toml.Create(instance), conv);
                        return(proxy);
                    }
                }

                return(obj);
            }