Esempio n. 1
0
File: Config.cs Progetto: uheee/Nett
        internal IConfigSource TryGetSource(TPath path)
        {
            path.CheckNotNull(nameof(path));

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

            return(source?.Value);
        }
Esempio n. 2
0
File: Config.cs Progetto: uheee/Nett
        internal bool Clear(TPath path, bool fromAllSources)
        {
            if (path.TryGet(this.persistable.LoadSourcesTable()) is TomlSource ste)
            {
                if (fromAllSources)
                {
                    bool cleared = false;
                    foreach (var s in this.persistable.Sources)
                    {
                        cleared |= this.Clear(path, s);
                    }
                }
                else
                {
                    return(this.Clear(path, ste.Value));
                }
            }
            else if (path.TryGet(this.persistable.Load()) is TomlTable tbl)
            {
                return(this.ClearTable(path, tbl, fromAllSources));
            }

            return(false);
        }