CK.Core.CKExceptionData.Write C# (CSharp) Method

Write() public method

Writes this exception data into a BinaryWriter.
public Write ( CKBinaryWriter w, bool writeVersion = true ) : void
w CKBinaryWriter The writer to use. Can not be null.
writeVersion bool False to not write the .
return void
        public void Write( CKBinaryWriter w, bool writeVersion = true )
        {
            if( writeVersion ) w.Write( CurrentStreamVersion );
            WriteWithoutVersion( w );
        }

Usage Example

Example #1
0
        static void DoWriteLog( CKBinaryWriter w, StreamLogType t, LogLevel level, DateTimeStamp logTime, string text, CKTrait tags, CKExceptionData ex, string fileName, int lineNumber )
        {
            if( tags != null && !tags.IsEmpty ) t |= StreamLogType.HasTags;
            if( ex != null )
            {
                t |= StreamLogType.HasException;
                if( text == ex.Message ) t |= StreamLogType.IsTextTheExceptionMessage;
            }
            if( fileName != null ) t |= StreamLogType.HasFileName;
            if( logTime.Uniquifier != 0 ) t |= StreamLogType.HasUniquifier;

            WriteLogTypeAndLevel( w, t, level );
            w.Write( logTime.TimeUtc.ToBinary() );
            if( logTime.Uniquifier != 0 ) w.Write( logTime.Uniquifier );
            if( (t & StreamLogType.HasTags) != 0 ) w.Write( tags.ToString() );
            if( (t & StreamLogType.HasFileName) != 0 )
            {
                w.Write( fileName );
                w.WriteNonNegativeSmallInt32( lineNumber );
            }
            if( (t & StreamLogType.HasException) != 0 ) ex.Write( w );
            if( (t & StreamLogType.IsTextTheExceptionMessage) == 0 ) w.Write( text );
        }