Example #1
0
        public ParsingTree(byte[] data, ParsingNode root)
        {
            if (data == null)
            {
                throw new ArgumentNullException(nameof(data));
            }
            if (root == null)
            {
                throw new ArgumentNullException(nameof(root));
            }

            Data = data;
            Root = root;
        }
Example #2
0
        public ParsingStream(ParsingTree tree, ParsingNode node)
        {
            if (tree == null)
            {
                throw new ArgumentNullException(nameof(tree));
            }
            if (node == null)
            {
                throw new ArgumentNullException(nameof(node));
            }

            UnderlayingStream = new ByteArrayReadStream(
                array: tree.Data,
                position: node.DataBegin);

            BeginPosition = node.DataBegin;
            EndPosition   = node.DataEnd;

            // The buffer must be at least as big as the largest non-string
            // object we can parse. Currently it's a uint32.
            _parsingBuffer = new byte[sizeof(UInt32)];
        }