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); }
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); }
public void push() { var path1 = new TPath("s1/s2/s3/t1"); TPath path2 = path1.Push("top"); path2.Locator.ShouldEqual("top/s1/s2/s3/t1"); }
internal TomlObject GetFromPath(TPath path) { path.CheckNotNull(nameof(path)); var cfg = this.persistable.Load(); return(path.Apply(cfg)); }
internal bool Clear(TPath path, IConfigSource source) { var sourceTable = this.persistable.Load(source); var wasRemoved = path.ClearFrom(sourceTable); this.persistable.Save(sourceTable, source); return(wasRemoved); }
internal IConfigSource TryGetSource(TPath path) { path.CheckNotNull(nameof(path)); var cfgTable = this.persistable.LoadSourcesTable(); var source = path.TryApply(cfgTable) as TomlSource; return(source?.Value); }
public IFixtureNode Find(TPath path) { if (path.IsRoot) { return(this); } FixtureGraph fixture = FixtureFor(path.Next); return(path.IsEnd ? fixture : (IFixtureNode)fixture.GrammarFor(path.Pop().Next)); }
internal bool Clear(TPath path) { var ste = path.TryApply(this.persistable.LoadSourcesTable()) as TomlSource; if (ste == null) { return(false); } return(this.Clear(path, ste.Value)); }
public TPath GetPath() { var path = new TPath(Name); if (Parent != null) { path = path.Push(Parent.Name); } return(path); }
private bool ClearTable(TPath tablePath, TomlTable table, bool fromAllSources) { bool cleared = false; foreach (var rowPath in tablePath.BuildForTableItems(table)) { cleared |= this.Clear(rowPath, fromAllSources); } this.persistable.RemoveEmptyTables(); return(cleared); }
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))); } }
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))); } }
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); }
public TPathDot(TPath result, TPath pathExpression) { this.result = result; this.pathExpression = pathExpression; }
public void locator() { var path1 = new TPath("s1/s2/s3/t1"); path1.Locator.ShouldEqual("s1/s2/s3/t1"); }
public void an_empty_string_path_is_the_hierarchy() { var path = new TPath(string.Empty); path.Locator.ShouldEqual(string.Empty); }
public TPathIndex(TPath result, Int32 index) { this.result = result; this.index = index; }
public void append() { var path = new TPath("s1/s2/s3"); path.Append("t1").Locator.ShouldEqual("s1/s2/s3/t1"); }
public static TPath BuildTPath(this LambdaExpression expr) { expr.CheckNotNull(nameof(expr)); return(TPath.Build(expr)); }
private static TPath Build <TR>(Expression <Func <Tpo, TR> > expression) => TPath.Build(expression);
public IProcessErrorItem <TPath, TError, TAction> GetErrorItem(TPath item, IProcessError <TError, TAction> error) => new ProcessErrorItem(item, error);