示例#1
0
文件: LzFind.cs 项目: 0-v-0/tiny7z
            private void MatchFinder_ReadBlock()
            {
                if (mStreamEndWasReached || mResult != SZ_OK)
                {
                    return;
                }

                if (mDirectInput)
                {
                    uint curSize = 0xFFFFFFFF - mStreamPos;
                    if (curSize > mDirectInputRem)
                    {
                        curSize = (uint)mDirectInputRem;
                    }

                    mDirectInputRem -= curSize;
                    mStreamPos      += curSize;
                    if (mDirectInputRem == 0)
                    {
                        mStreamEndWasReached = true;
                    }

                    return;
                }

                for (;;)
                {
                    P <byte> dest = mBuffer + (mStreamPos - mPos);
                    long     size = mBufferBase + mBlockSize - dest;
                    if (size == 0)
                    {
                        return;
                    }

                    mResult = mStream.Read(dest, ref size);
                    if (mResult != SZ_OK)
                    {
                        return;
                    }

                    if (size == 0)
                    {
                        mStreamEndWasReached = true;
                        return;
                    }

                    mStreamPos += (uint)size;
                    if (mStreamPos - mPos > mKeepSizeAfter)
                    {
                        return;
                    }
                }
            }
示例#2
0
            internal static SRes FullRead(ISeqInStream stream, P <byte> data, ref long processedSize)
            {
                long size = processedSize;

                processedSize = 0;
                while (size != 0)
                {
                    long curSize = size;
                    SRes res     = stream.Read(data, ref curSize);
                    processedSize += curSize;
                    data          += curSize;
                    size          -= curSize;
                    if (res != SZ_OK)
                    {
                        return(res);
                    }
                    if (curSize == 0)
                    {
                        return(SZ_OK);
                    }
                }
                return(SZ_OK);
            }
示例#3
0
 internal static SRes FullRead(ISeqInStream stream, P<byte> data, ref long processedSize)
 {
     long size = processedSize;
     processedSize = 0;
     while(size != 0)
     {
         long curSize = size;
         SRes res = stream.Read(data, ref curSize);
         processedSize += curSize;
         data += curSize;
         size -= curSize;
         if(res != SZ_OK)
             return res;
         if(curSize == 0)
             return SZ_OK;
     }
     return SZ_OK;
 }