Exemplo n.º 1
0
        public override void Write(byte[] buffer, int offset, int count)
        {
            mLength += count;
            for (int i = 0; i < count; i++)
            {
                mBytes[buffer[offset + i]]++;
            }

            mCurrentCRC = CRC.Update(mCurrentCRC, buffer, offset, count);
        }
Exemplo n.º 2
0
        public override void Write(byte[] buffer, int offset, int count)
        {
            if (mFinished)
            {
                throw new InvalidOperationException("CRC calculation has been finished.");
            }

            mProcessed += count;
            mCRC        = CRC.Update(mCRC, buffer, offset, count);
            mTarget.Write(buffer, offset, count);
        }
Exemplo n.º 3
0
        public override int Read(byte[] buffer, int offset, int count)
        {
            if (count > 0 && !mFinished)
            {
                int read = mSource.Read(buffer, offset, count);
                if (read > 0)
                {
                    mProcessed += read;
                    mCRC        = CRC.Update(mCRC, buffer, offset, read);
                    return(read);
                }

                Finish();
            }

            return(0);
        }