WriteNonNegativeSmallInt32() public méthode

Writes a 32-bit 0 or positive integer in compressed format. See remarks.
Using this method to write a negative integer is the same as using ot with a large positive number: the storage will actually require more than 4 bytes. It is perfectly valid, except that it is more "expansion" than "compression" :).
public WriteNonNegativeSmallInt32 ( int value ) : void
value int A 32-bit integer (should not be negative).
Résultat void
Exemple #1
0
        void WriteWithoutVersion(CKBinaryWriter w)
        {
            if (w == null)
            {
                throw new ArgumentNullException("w");
            }
            w.Write(_message);
            w.Write(_exceptionTypeName);
            w.Write(_exceptionTypeAQName);
            w.WriteNullableString(_stackTrace);
            w.WriteNullableString(_fileName);
            w.WriteNullableString(_detailedInfo);

            if (_aggregatedExceptions != null)
            {
                w.WriteSmallInt32(_aggregatedExceptions.Length);
                foreach (var agg in _aggregatedExceptions)
                {
                    agg.WriteWithoutVersion(w);
                }
            }
            else
            {
                if (_innerException != null)
                {
                    w.WriteSmallInt32(0);
                    _innerException.WriteWithoutVersion(w);
                }
                else
                {
                    w.WriteSmallInt32(-1);
                }
            }

            if (_loaderExceptions != null)
            {
                w.WriteNonNegativeSmallInt32(_loaderExceptions.Length);
                foreach (var ld in _loaderExceptions)
                {
                    ld.WriteWithoutVersion(w);
                }
            }
            else
            {
                w.WriteNonNegativeSmallInt32(0);
            }
        }
        void WriteWithoutVersion( CKBinaryWriter w )
        {
            if( w == null ) throw new ArgumentNullException( "w" );
            w.Write( _message );
            w.Write( _exceptionTypeName );
            w.Write( _exceptionTypeAQName );
            w.WriteNullableString( _stackTrace );
            w.WriteNullableString( _fileName );
            w.WriteNullableString( _detailedInfo );

            if( _aggregatedExceptions != null )
            {
                w.WriteSmallInt32( _aggregatedExceptions.Length );
                foreach( var agg in _aggregatedExceptions ) agg.WriteWithoutVersion( w );
            }
            else
            {
                if( _innerException != null )
                {
                    w.WriteSmallInt32( 0 );
                    _innerException.WriteWithoutVersion( w );
                }
                else w.WriteSmallInt32( -1 );
            }

            if( _loaderExceptions != null )
            {
                w.WriteNonNegativeSmallInt32( _loaderExceptions.Length );
                foreach( var ld in _loaderExceptions ) ld.WriteWithoutVersion( w );
            }
            else w.WriteNonNegativeSmallInt32( 0 );
        }
Exemple #3
0
 static void WriteMulticastFooter( CKBinaryWriter w, Guid monitorId, LogEntryType previousEntryType, DateTimeStamp previousStamp, int depth )
 {
     w.Write( monitorId.ToByteArray() );
     w.WriteNonNegativeSmallInt32( depth );
     if( previousStamp.IsKnown )
     {
         w.Write( previousStamp.TimeUtc.ToBinary() );
         if( previousStamp.Uniquifier != 0 ) w.Write( previousStamp.Uniquifier );
         w.Write( (byte)previousEntryType );
     }
 }
Exemple #4
0
 static void DoWriteCloseGroup( CKBinaryWriter w, StreamLogType t, LogLevel level, DateTimeStamp closeTime, IReadOnlyList<ActivityLogGroupConclusion> conclusions )
 {
     if( conclusions != null && conclusions.Count > 0 ) t |= StreamLogType.HasConclusions;
     if( closeTime.Uniquifier != 0 ) t |= StreamLogType.HasUniquifier;
     WriteLogTypeAndLevel( w, t, level );
     w.Write( closeTime.TimeUtc.ToBinary() );
     if( closeTime.Uniquifier != 0 ) w.Write( closeTime.Uniquifier );
     if( (t & StreamLogType.HasConclusions) != 0 )
     {
         w.WriteNonNegativeSmallInt32( conclusions.Count );
         foreach( ActivityLogGroupConclusion c in conclusions )
         {
             w.Write( c.Tag.ToString() );
             w.Write( c.Text );
         }
     }
 }
Exemple #5
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 );
        }