public ReaderContext(Stream stream) { this.Reader = new ProtoReader(stream, TypeModel.Create(), null); this.ReadingAction = ReadingActionType.ReadHeader; this.Root = new VisitingNode(NoParent); this.ParentVisitingNode = this.Root; }
public void AddObject(int index) { VisitingNode obj; if (!this.ParentVisitingNode.Children.TryGetValue(index, out obj)) { obj = new VisitingNode(this.ParentVisitingNode); this.ParentVisitingNode.Children.Add(index, obj); } else { ++obj.VisitCount; } }
public VisitingNode(VisitingNode parent) { this.VisitCount = 1; this.Children = new Dictionary<int, VisitingNode>(); this.Parent = parent; }
public void LeaveObject() { this.ParentVisitingNode.Children.Clear(); this.ParentVisitingNode = this.ParentVisitingNode.Parent; }