Beispiel #1
0
        internal void Set(TPath path, object value, IConfigSource source)
        {
            path.CheckNotNull(nameof(path));
            value.CheckNotNull(nameof(value));

            this.Set(tbl => path.SetValue(tbl, TomlObject.CreateFrom(tbl.Root, value, null)), source);
        }
Beispiel #2
0
        internal void Set(TPath path, object value, IConfigSource source)
        {
            path.CheckNotNull(nameof(path));
            value.CheckNotNull(nameof(value));

            this.Set(tbl => path.Set(tbl, cur => CreateNewValueObject(cur, tbl.Root, value)), source);
        }
Beispiel #3
0
        internal TomlObject GetFromPath(TPath path)
        {
            path.CheckNotNull(nameof(path));

            var cfg = this.persistable.Load();

            return(path.Apply(cfg));
        }
Beispiel #4
0
        internal IConfigSource TryGetSource(TPath path)
        {
            path.CheckNotNull(nameof(path));

            var cfgTable = this.persistable.LoadSourcesTable();
            var source   = path.TryApply(cfgTable) as TomlSource;

            return(source?.Value);
        }
Beispiel #5
0
        internal void Set(TPath path, object value)
        {
            path.CheckNotNull(nameof(path));
            value.CheckNotNull(nameof(value));

            bool notStoredInConfigYet = this.TryGetSource(path) == null;

            if (notStoredInConfigYet)
            {
                this.Set(path, value, this.persistable.RootSource);
            }
            else
            {
                this.Set(tbl => path.Set(tbl, cur => CreateNewValueObject(cur, tbl.Root, value)));
            }
        }
Beispiel #6
0
        internal void Set(TPath path, object value)
        {
            path.CheckNotNull(nameof(path));
            value.CheckNotNull(nameof(value));

            var src = this.TryGetSource(path);

            bool notStoredInConfigYet = this.TryGetSource(path) == null;

            if (notStoredInConfigYet)
            {
                this.Set(path, value, this.persistable.RootSource);
            }
            else
            {
                this.Set(tbl => path.SetValue(tbl, TomlObject.CreateFrom(tbl.Root, value, null)));
            }
        }