ReadSmallInt32() public method

Reads in a 32-bit integer in compressed format wriiten by CKBinaryWriter.WriteSmallInt32(int, int).
public ReadSmallInt32 ( int minNegativeValue = -1 ) : int
minNegativeValue int The same negative value used to write the integer.
return int
示例#1
0
        /// <summary>
        /// Initializes a new <see cref="CKExceptionData"/> from a <see cref="CKBinaryReader"/>
        /// with a known version.
        /// See <see cref="Write(CKBinaryWriter,bool)"/>.
        /// </summary>
        /// <param name="r">The reader to read from.</param>
        /// <param name="streamIsCRLF">Whether the strings have CRLF or LF for end-of-lines.</param>
        /// <param name="version">Known version.</param>
        public CKExceptionData(CKBinaryReader r, bool streamIsCRLF, int version)
        {
            if (r == null)
            {
                throw new ArgumentNullException("r");
            }
            _message             = r.ReadString(streamIsCRLF);
            _exceptionTypeName   = r.ReadString();
            _exceptionTypeAQName = r.ReadString();
            _stackTrace          = r.ReadNullableString(streamIsCRLF);
            _fileName            = r.ReadNullableString();
            _detailedInfo        = r.ReadNullableString(streamIsCRLF);

            int nbAgg = version == 0 ? r.ReadInt32() : r.ReadSmallInt32();

            if (nbAgg > 0)
            {
                _aggregatedExceptions = new CKExceptionData[nbAgg];
                for (int i = 0; i < nbAgg; ++i)
                {
                    _aggregatedExceptions[i] = new CKExceptionData(r, streamIsCRLF, version == 0 ? r.ReadInt32() : version);
                }
                _innerException = _aggregatedExceptions[0];
            }
            else
            {
                if (nbAgg == 0)
                {
                    _innerException = new CKExceptionData(r, streamIsCRLF, version == 0 ? r.ReadInt32() : version);
                }
            }

            int nbLd = version == 0 ? r.ReadInt32() : r.ReadNonNegativeSmallInt32();

            if (nbLd != 0)
            {
                _loaderExceptions = new CKExceptionData[nbLd];
                for (int i = 0; i < nbLd; ++i)
                {
                    _loaderExceptions[i] = new CKExceptionData(r, streamIsCRLF, version == 0 ? r.ReadInt32() : version);
                }
            }
        }
示例#2
0
        /// <summary>
        /// Initializes a new <see cref="CKExceptionData"/> from a <see cref="CKBinaryReader"/>
        /// with a known version. 
        /// See <see cref="Write(CKBinaryWriter,bool)"/>.
        /// </summary>
        /// <param name="r">The reader to read from.</param>
        /// <param name="streamIsCRLF">Whether the strings have CRLF or LF for end-of-lines.</param>
        /// <param name="version">Known version.</param>
        public CKExceptionData( CKBinaryReader r, bool streamIsCRLF, int version )
        {
            if( r == null ) throw new ArgumentNullException( "r" );
            _message = r.ReadString( streamIsCRLF );
            _exceptionTypeName = r.ReadString();
            _exceptionTypeAQName = r.ReadString();
            _stackTrace = r.ReadNullableString( streamIsCRLF );
            _fileName = r.ReadNullableString();
            _detailedInfo = r.ReadNullableString( streamIsCRLF );

            int nbAgg = version == 0 ? r.ReadInt32() : r.ReadSmallInt32();
            if( nbAgg > 0 )
            {
                _aggregatedExceptions = new CKExceptionData[nbAgg];
                for( int i = 0; i < nbAgg; ++i ) _aggregatedExceptions[i] = new CKExceptionData( r, streamIsCRLF, version == 0 ? r.ReadInt32() : version );
                _innerException = _aggregatedExceptions[0];
            }
            else
            {
                if( nbAgg == 0 ) _innerException = new CKExceptionData( r, streamIsCRLF, version == 0 ? r.ReadInt32() : version );
            }

            int nbLd = version == 0 ? r.ReadInt32() : r.ReadNonNegativeSmallInt32();
            if( nbLd != 0 )
            {
                _loaderExceptions = new CKExceptionData[nbLd];
                for( int i = 0; i < nbLd; ++i ) _loaderExceptions[i] = new CKExceptionData( r, streamIsCRLF, version == 0 ? r.ReadInt32() : version );
            }
        }