コード例 #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
ファイル: MtCoder.cs プロジェクト: jolhe006/managed-lzma
 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;
 }