示例#1
0
        protected IEnumerable <HexSpan> GetValidSpansReverse(HexBuffer buffer, HexPosition start, HexPosition lowerBounds)
        {
            var  pos      = start;
            bool fullSpan = true;

            for (;;)
            {
                var span = buffer.GetPreviousValidSpan(pos, lowerBounds, fullSpan);
                if (span == null)
                {
                    break;
                }

                var newStart = HexPosition.Max(lowerBounds, span.Value.Start);
                var newEnd   = HexPosition.Min(pos + 1, span.Value.End);
                if (newStart < newEnd)
                {
                    yield return(HexSpan.FromBounds(newStart, newEnd));
                }

                if (span.Value.Start == 0)
                {
                    break;
                }
                pos      = span.Value.Start - 1;
                fullSpan = false;
            }
        }