Esempio n. 1
0
        int ForEachByteDesc0(int index, int length, ByteProcessor processor)
        {
            if (processor == null)
            {
                throw new NullReferenceException("processor");
            }

            if (length == 0)
            {
                return -1;
            }

            int i = index + length - 1;
            do
            {
                if (processor.Process(this._GetByte(i)))
                {
                    i--;
                }
                else
                {
                    return i;
                }
            }
            while (i >= index);

            return -1;
        }
Esempio n. 2
0
        int ForEachByteAsc0(int index, int length, ByteProcessor processor)
        {
            if (processor == null)
            {
                throw new ArgumentNullException(nameof(processor));
            }

            if (length == 0)
            {
                return -1;
            }

            int endIndex = index + length;
            int i = index;
            do
            {
                if (processor.Process(this._GetByte(i)))
                {
                    i++;
                }
                else
                {
                    return i;
                }
            }
            while (i < endIndex);

            return -1;
        }