Пример #1
0
        public override int Read(byte[] pbBuffer, int nOffset, int nCount)
        {
            if (m_bWriting)
            {
                throw new InvalidOperationException();
            }

            int nRead        = m_sBaseStream.Read(pbBuffer, nOffset, nCount);
            int nPartialRead = nRead;

            while ((nRead < nCount) && (nPartialRead != 0))
            {
                nPartialRead = m_sBaseStream.Read(pbBuffer, nOffset + nRead,
                                                  nCount - nRead);
                nRead += nPartialRead;
            }

#if DEBUG
            byte[] pbOrg = new byte[pbBuffer.Length];
            Array.Copy(pbBuffer, pbOrg, pbBuffer.Length);
#endif

            if ((m_hash != null) && (nRead > 0))
#if !KeePassUAP
            { m_hash.TransformBlock(pbBuffer, nOffset, nRead, pbBuffer, nOffset); }
#else
            { m_hash.AppendData(pbBuffer, nOffset, nRead); }
#endif

#if DEBUG
            Debug.Assert(MemUtil.ArraysEqual(pbBuffer, pbOrg));
#endif

            return(nRead);
        }