public void JumpToElementAt() { var dataSrc = new EBMLFixedByteArrayDataSource(new byte[] { 0x1A, 0x45, 0xDF, 0xA3, 0x80 }); var docType = new EBMLDocType(); var reader = new EBMLReader(dataSrc, docType); var elemInfo = reader.Next(); using(reader.EnterElement(elemInfo)) { reader.Next(); } Assert.IsTrue(reader.JumpToElementAt(0).IdPos == elemInfo.IdPos, "Basestream was not reset"); }
private static void Recurse(EBMLReader reader, bool readValues) { ElementInfo elemInfo; while((elemInfo = reader.Next()) != null) { if(elemInfo.DocElement.Type == EBMLElementType.Master) { using(reader.EnterElement(elemInfo)) { Recurse(reader, readValues); } } else if(readValues) { var obj = reader.RetrieveValue(elemInfo); } } }
public void Reset() { var dataSrc = new EBMLFixedByteArrayDataSource(new byte[] { 0x1A, 0x45, 0xDF, 0xA3, 0x80 }); var docType = new EBMLDocType(); var reader = new EBMLReader(dataSrc, docType); var elemInfo = reader.Next(); using(reader.EnterElement(elemInfo)) { elemInfo = reader.Next(); } reader.Reset(); Assert.IsTrue(reader.BaseStream.Position == 0, "Bastream was not reset"); }