Exemplo n.º 1
0
        public void ParseMatroskaTestSuite_ParseFile(string filePath)
        {
            Stream src;
            try {
                src = File.OpenRead(filePath);
                //src = File.OpenRead(@"C:\Users\Arokh\Projects\Visual Studio 2012\Projects\CSEBML\CSEBMLTest\bin\Release\TestFiles\MatroskaTestSuite\test7.mkv");
            } catch(Exception) {
                Assert.Inconclusive("Couldn't open Matroska Test File ({0})", filePath);
                return;
            }

            var ebmlSrc = new EBMLStreamDataSource(src);
            var matroskaDoc = new MatroskaDocType(CSEBML.DocTypes.Matroska.MatroskaVersion.V3);
            var ebmlReader = new EBMLReader(ebmlSrc, matroskaDoc);

            Action<bool> recurse = readValues => {
                try {
                    ebmlReader.Reset();
                    Recurse(ebmlReader, readValues);
                } catch(Exception ex) {
                    ex.Data.Add("ReadValues", readValues);
                    throw;
                }
            };

            recurse(true);
            recurse(false);
        }
Exemplo n.º 2
0
        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");
        }