CK.Core.CKBinaryReader.ReadString C# (CSharp) Method

ReadString() public method

Reads and normalizes a string according to Environment.NewLine. The fact that the data has actually be saved with LF or CRLF must be known.
public ReadString ( bool streamIsCRLF ) : string
streamIsCRLF bool True if the contains /// strings with CRLF end-of-line, false if the end-of-line is LF only.
return string
        public string ReadString( bool streamIsCRLF )
        {
            string text = ReadString();
            return streamIsCRLF == StringAndStringBuilderExtension.IsCRLF ? text : text.NormalizeEOL();
        }

Usage Example

Ejemplo n.º 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::ReadString