예제 #1
0
 static public void WriteBlockHeader(TrackingPipeWriter writer, NettraceType type)
 {
     /*
      * [open tag]
      *  [nullreference tag]
      *  [type version]
      *  [minReader Version]
      *  [length of block name]
      *  [block name]
      * [close tag]
      */
     writer.WriteByte((byte)Tags.BeginPrivateObject);
     writer.WriteByte((byte)Tags.NullReference);
     writer.WriteInt(type.Version);
     writer.WriteInt(type.MinimumReaderVersion);
     if (type.Name == KnownTypeNames.EventBlock)
     {
         writer.WriteInt(KnownTypeNames.EventBlockCompressed.Length);
         Encoding.UTF8.GetBytes(KnownTypeNames.EventBlockCompressed, writer);
     }
     else if (type.Name == KnownTypeNames.StackBlock)
     {
         writer.WriteInt(KnownTypeNames.StackBlockCompressed.Length);
         Encoding.UTF8.GetBytes(KnownTypeNames.StackBlockCompressed, writer);
     }
     else
     {
         writer.WriteInt(type.Name.Length);
         Encoding.UTF8.GetBytes(type.Name, writer);
     }
     writer.WriteByte((byte)Tags.EndObject);
 }
예제 #2
0
 private static void WriteBlockHeader(TrackingPipeWriter writer, NettraceType type)
 {
     if (compress)
     {
         CompressBlockHelper.WriteBlockHeader(writer, type);
     }
     else if (decompress)
     {
         DecompressBlockHelper.WriteBlockHeader(writer, type);
     }
     else
     {
         /*
          * [open tag]
          *  [nullreference tag]
          *  [type version]
          *  [minReader Version]
          *  [length of block name]
          *  [block name]
          * [close tag]
          */
         writer.WriteByte((byte)Tags.BeginPrivateObject);
         writer.WriteByte((byte)Tags.NullReference);
         writer.WriteInt(type.Version);
         writer.WriteInt(type.MinimumReaderVersion);
         writer.WriteInt(type.Name.Length);
         Encoding.UTF8.GetBytes(type.Name, writer);
         writer.WriteByte((byte)Tags.EndObject);
     }
 }
예제 #3
0
 public static void WriteInitialFileContext(TrackingPipeWriter writer)
 {
     // Write Preamble
     Encoding.UTF8.GetBytes("Nettrace", writer);
     // Write StreamHeader
     writer.WriteInt(20);
     Encoding.UTF8.GetBytes("!FastSerialization.1", writer);
 }
예제 #4
0
        private static void WriteBlockBodyPreamble(TrackingPipeWriter writer, NettraceBlock block)
        {
            if (block.Type.Name == KnownTypeNames.Trace)
            {
                return;
            }

            // padding should run before writing block size
            var padding = GetPadding(writer, block);

            // Write block size
            writer.WriteInt(block.Size);
            // Write padding
            Span <byte> span = stackalloc byte[padding];

            writer.Write(span);
        }