Example #1
0
        internal override bool TryMatchInternal(PartialExecutionData data, ref SequenceReader <byte> reader, out OperationStatus status)
        {
            if (reader.Remaining < Match.Length)
            {
                return(DoneWith(status = OperationStatus.NeedMoreData));
            }

            if (!reader.IsNext(Match.Span))
            {
                return(DoneWith(status = OperationStatus.InvalidData));
            }

            data.AddData(this, ref reader, Match.Length);
            return(DoneWith(status = OperationStatus.Done));
        }
Example #2
0
        internal override bool TryMatchInternal(PartialExecutionData data, ref SequenceReader <byte> reader, out OperationStatus status)
        {
            if (reader.Remaining < Low.Length)
            {
                return(DoneWith(status = OperationStatus.NeedMoreData));
            }

            var value = data.ReadData(ref reader, Low.Length);

            var lo = Low.Span.SequenceCompareTo(value);
            var hi = High.Span.SequenceCompareTo(value);

            if (lo > 0 || hi < 0)
            {
                return(DoneWith(status = OperationStatus.InvalidData));
            }

            data.AddData(this, value);

            return(DoneWith(status = OperationStatus.Done));
        }