public TreeDiagnosticsReader(ITreeReader inner) { Inner = inner; LastPropertyName = "<Database>"; Path = new Stack <TreeDiagnostics>(); Tree = Open(); }
private TreeDiagnostics Open() { TreeDiagnostics item = new TreeDiagnostics(LastPropertyName, Position); if (Path.Count > 0) { Path.Peek().AddChild(item); } Path.Push(item); return(item); }
public T[] ReadBlockArray <T>() where T : unmanaged { // Add array type to diagnostics for array TreeDiagnostics diagnostics = Path.Peek(); diagnostics.Name = $"{typeof(T).Name}[] {diagnostics.Name ?? ""}"; T[] array = Inner.ReadBlockArray <T>(); // Close array (no separate end token for BlockArray) Close(); return(array); }
public TreeDiagnostics AddChild(TreeDiagnostics child) { Children = Children ?? new List <TreeDiagnostics>(); Children.Add(child); return(child); }
private void Close() { TreeDiagnostics item = Path.Pop(); item.EndPosition = Position; }