示例#1
0
文件: Config.cs 项目: 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);
        }
示例#2
0
文件: Config.cs 项目: 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);
        }