CK.Core.CKBinaryReader.ReadSmallInt32 C# (CSharp) Méthode

ReadSmallInt32() public méthode

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.
Résultat int
        public int ReadSmallInt32( int minNegativeValue = -1 ) => Read7BitEncodedInt() + minNegativeValue;

Usage Example

Exemple #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);
                }
            }
        }
All Usage Examples Of CK.Core.CKBinaryReader::ReadSmallInt32