public IEnumerable <Stack <EbmlStackItem> > GetNodeTraces(string elementName) { System.Diagnostics.Debug.Assert(this.Element.Type == EbmlType.Master); var stack = new Stack <EbmlStackItem>(); for (EbmlNode current = this;;) { var top = new EbmlStackItem((EbmlNodeMaster)current); stack.Push(top); for (;;) { if (top.Index >= top.Node.nodes.Count) { if (stack.Count == 1) { yield break; } else { stack.Pop(); top = stack.Peek(); continue; } } current = top.Node.nodes[top.Index]; if (current.Element.Name == elementName) { yield return(stack); } ++top.Index; if (current.Element.Type == EbmlType.Master) { break; } } } }
public EbmlNode Seek(ulong sig32) { System.Diagnostics.Debug.Assert(this.Element.Type == EbmlType.Master); var stack = new Stack <EbmlStackItem>(); for (EbmlNode current = this;;) { var top = new EbmlStackItem((EbmlNodeMaster)current); for (;;) { if (top.Index >= top.Node.nodes.Count) { if (stack.Count == 0) { return(null); } else { top = stack.Pop(); continue; } } current = top.Node.nodes[top.Index]; if (current.Element.Sig32 == sig32) { return(current); } ++top.Index; if (current.Element.Type == EbmlType.Master) { stack.Push(top); break; } } } }
public void AddNode(EbmlNode node) { nodes.Add(node); }