Exemplo n.º 1
0
        public void Test2804()
        {
            var file        = TestFramework.CreateInputFile(_fileName);
            var dataReader  = TestFramework.CreateDataReader(file);
            var scanContext = TestFramework.CreateScanContext(_project);

            //File begins with VOPs
            IDataBlock        vopBlock;
            IDataBlockBuilder vopBuilder;

            Assert.IsTrue(GetNextDataBlock(file, dataReader, scanContext, out vopBlock, out vopBuilder));
            Assert.IsNotNull(vopBlock);

            Assert.AreEqual(vopBlock.EndOffset, dataReader.Position);
            Assert.AreEqual(file.Length, dataReader.Length);

            //Next valid datablock is a VOL
            IDataBlock        volBlock;
            IDataBlockBuilder volBuilder;

            Assert.IsTrue(GetNextDataBlock(file, dataReader, scanContext, out volBlock, out volBuilder));
            Assert.IsNotNull(volBlock);
            Assert.IsNotNull(volBuilder);

            IResultNode volResult = scanContext.Results;

            Assert.IsNotNull(volResult);

            var expectedVol = volResult.GetLastDescendant();

            Assert.AreEqual("VideoObjectLayer", expectedVol.Name);
        }
 private static IResultNode GetParentFor(IResultNode rootNode, object parentName)
 {
     for (IResultNode parent = rootNode.GetLastDescendant(); parent != null; parent = parent.Parent)
     {
         if (parent.Name == parentName as string)
         {
             return(parent);
         }
     }
     return(rootNode);            // Any valid header can occur in the root
 }
        private IResultNode GetParentFor(IResultNode rootNode, IResult nextHeader)
        {
            string nextHeaderName = nextHeader.Name;

            for (IResultNode parent = rootNode.GetLastDescendant(); parent != null; parent = parent.Parent)
            {
                string parentName = parent.Name;
                if (_possibleChildHeaders.ContainsKey(parentName) && _possibleChildHeaders[parentName].Contains(nextHeaderName))
                {
                    return(parent);
                }
            }
            return(rootNode);            // Any valid header can occur in the root
        }