private IDataBlock DetectData1(IDataReader dataReader, IDataBlockBuilder dataBlockBuilder, IScanContext context)
        {
            if ((dataReader.Position + 51) > dataReader.Length)
            {
                return(null);
            }

            IResultNode root   = new MockResult(this);
            IResultNode parent = root;
            int         i      = (int)(dataReader.GetDataPacket(0, 1).StartOffset + (dataReader.Position) / 51);

            for (int j = 0; j < 3; j++)
            {
                long       offset = dataReader.Position;
                const long length = 17;
                parent = new MockResult(parent, dataReader, offset, length, "result: " + i + ", " + j);
                dataReader.Position += length;
            }
            context.Results = root;
            var firstChild = ((MockResult)context.Results.Children[0]);

            dataBlockBuilder.StartOffset = firstChild.Offset;
            var lastChild = ((MockResult)context.Results.GetLastDescendant());

            dataBlockBuilder.EndOffset = (lastChild.Offset + lastChild.Length);
            return(dataBlockBuilder.Build());
        }
 public MockResult(MockResult mockResult)
 {
     _name       = mockResult._name;
     _attributes = mockResult._attributes;
     _dataPacket = mockResult._dataPacket;
     _detector   = mockResult._detector;
     _parent     = null;
 }
        private IDataBlock DetectData3(IDataReader dataReader, IDataBlockBuilder dataBlockBuilder, IScanContext context)
        {
            IResultNode root = new MockResult(this);

            for (int i = 0; i < 17; i++)
            {
                long       offset = i * 15;
                const long length = 15;
                new MockResult(root, dataReader, offset, length, "result: " + i);
            }
            context.Results = root;
            var firstChild = ((MockResult)context.Results.Children[0]);

            dataBlockBuilder.StartOffset = firstChild.Offset;
            var lastChild = ((MockResult)context.Results.GetLastDescendant());

            dataBlockBuilder.EndOffset = (lastChild.Offset + lastChild.Length);
            return(dataBlockBuilder.Build());
        }
        override public IDataBlock DetectData(IDataReader dataReader, IDataBlockBuilder dataBlockBuilder, IScanContext context)
        {
            IResultNode          root = new MockResult(this);
            ByteStreamDataReader byteStreamDataReader = new ByteStreamDataReader(dataReader);

            dataReader = byteStreamDataReader;

            long dataReaderOffset = dataReader.GetDataPacket(0, 1).StartOffset;
            long initialPosition  = dataReader.Position + dataReaderOffset;

            if (initialPosition == 0 && dataReader.Length >= 268)
            {
                dataReader.Position = 0;
                long        offset = 0L;
                long        length;
                IResultNode parent = root;
                if (byteStreamDataReader.GetByte() == 69)
                {
                    offset = 0L;
                    length = 1L;
                    parent = new MockResult1(parent, dataReader, offset, length);
                }
                long firstDataBlockOffset = offset;

                dataReader.Position = 255;
                if (byteStreamDataReader.GetByte() == 255)
                {
                    offset = 255L;
                    length = 2L;
                    parent = new MockResult2(parent, dataReader, offset, length);
                }

                dataReader.Position = 260;
                if (byteStreamDataReader.GetByte() == 78)
                {
                    offset = 260L;
                    length = 3L;
                    new MockResult1(parent, dataReader, offset, length);
                }

                offset = 264;
                length = 4;
                dataReader.Position = 264;
                if (byteStreamDataReader.GetByte() == 5)
                {
                    new MockResult2(parent, dataReader, offset, length);
                }

                context.Results = root;

                var firstChild = ((MockResult)root.Children[0]);
                dataBlockBuilder.StartOffset = firstChild.Offset;
                var lastChild = ((MockResult)root.GetLastDescendant());
                dataBlockBuilder.EndOffset  = (lastChild.Offset + lastChild.Length);
                dataBlockBuilder.IsFullFile = false;
                return(dataBlockBuilder.Build());
            }

            if (initialPosition <= 517 && (initialPosition + dataReader.Length) >= 518)
            {
                long       offset = 517L - dataReaderOffset;
                const long length = 1L;

                dataReader.Position = offset;
                if (byteStreamDataReader.GetByte() == 2)
                {
                    new MockResult1(root, dataReader, offset, length);
                }

                context.Results = root;

                var firstChild = ((MockResult)root.Children[0]);
                dataBlockBuilder.StartOffset = firstChild.Offset;
                var lastChild = ((MockResult)root.GetLastDescendant());
                dataBlockBuilder.EndOffset  = (lastChild.Offset + lastChild.Length);
                dataBlockBuilder.IsFullFile = (root.Children.Count == 1);
                return(dataBlockBuilder.Build());
            }
            return(null);
        }