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); }
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); } }