/// <summary> /// This is the main routine for FieldMetaData. Basically it will serialize the data in /// this structure as TraceLogging style meta-data into the array 'metaArray' starting at /// 'pos' (pos is updated to reflect the bytes written). /// /// Note that 'metaData' can be null, in which case it only updates 'pos'. This is useful /// for a 'two pass' approach where you figure out how big to make the array, and then you /// fill it in. /// </summary> public void Encode(ref int pos, byte[]?metadata) { // Write out the null terminated UTF8 encoded name if (metadata != null) { Encoding.UTF8.GetBytes(this.name, 0, this.name.Length, metadata, pos); } pos += this.nameSize; // Write 1 byte for inType if (metadata != null) { metadata[pos] = this.inType; } pos++; // If InTypeChainFlag set, then write out the outType if (0 != (this.inType & Statics.InTypeChainFlag)) { if (metadata != null) { metadata[pos] = this.outType; } pos++; // If OutTypeChainFlag set, then write out tags if (0 != (this.outType & Statics.OutTypeChainFlag)) { Statics.EncodeTags((int)this.tags, ref pos, metadata); } } // If InTypeFixedCountFlag set, write out the fixedCount (2 bytes little endian) if (0 != (this.inType & Statics.InTypeFixedCountFlag)) { if (metadata != null) { metadata[pos + 0] = unchecked ((byte)this.fixedCount); metadata[pos + 1] = (byte)(this.fixedCount >> 8); } pos += 2; // If InTypeCustomCountFlag set, write out the blob of custom meta-data. if (Statics.InTypeCustomCountFlag == (this.inType & Statics.InTypeCountMask) && this.fixedCount != 0) { if (metadata != null) { Debug.Assert(custom != null); Buffer.BlockCopy(custom, 0, metadata, pos, this.fixedCount); } pos += this.fixedCount; } } }
// Token: 0x0600352B RID: 13611 RVA: 0x000CE490 File Offset: 0x000CC690 public NameInfo(string name, EventTags tags, int typeMetadataSize) { this.name = name; this.tags = (tags & (EventTags)268435455); this.identity = Interlocked.Increment(ref NameInfo.lastIdentity); int prefixSize = 0; Statics.EncodeTags((int)this.tags, ref prefixSize, null); this.nameMetadata = Statics.MetadataForString(name, prefixSize, 0, typeMetadataSize); prefixSize = 2; Statics.EncodeTags((int)this.tags, ref prefixSize, this.nameMetadata); }
public NameInfo(string name, EventTags tags, int typeMetadataSize) { this.name = name; this.tags = tags & (EventTags)268435455; this.identity = Interlocked.Increment(ref NameInfo.lastIdentity); int pos1 = 0; Statics.EncodeTags((int)this.tags, ref pos1, (byte[])null); this.nameMetadata = Statics.MetadataForString(name, pos1, 0, typeMetadataSize); int pos2 = 2; Statics.EncodeTags((int)this.tags, ref pos2, this.nameMetadata); }
public NameInfo(string name, EventTags tags, int typeMetadataSize) { this.name = name; this.tags = tags & Statics.EventTagsMask; this.identity = Interlocked.Increment(ref lastIdentity); int tagsPos = 0; Statics.EncodeTags((int)this.tags, ref tagsPos, null); this.nameMetadata = Statics.MetadataForString(name, tagsPos, 0, typeMetadataSize); tagsPos = 2; Statics.EncodeTags((int)this.tags, ref tagsPos, this.nameMetadata); }
public void Encode(ref int pos, byte[] metadata) { if (metadata != null) { Encoding.UTF8.GetBytes(this.name, 0, this.name.Length, metadata, pos); } pos += this.nameSize; if (metadata != null) { metadata[pos] = this.inType; } ++pos; if (((int)this.inType & 128) != 0) { if (metadata != null) { metadata[pos] = this.outType; } ++pos; if (((int)this.outType & 128) != 0) { Statics.EncodeTags((int)this.tags, ref pos, metadata); } } if (((int)this.inType & 32) == 0) { return; } if (metadata != null) { metadata[pos + 0] = (byte)this.fixedCount; metadata[pos + 1] = (byte)((uint)this.fixedCount >> 8); } pos += 2; if (96 != ((int)this.inType & 96) || (int)this.fixedCount == 0) { return; } if (metadata != null) { Buffer.BlockCopy((Array)this.custom, 0, (Array)metadata, pos, (int)this.fixedCount); } pos += (int)this.fixedCount; }
// Token: 0x06003524 RID: 13604 RVA: 0x000CE188 File Offset: 0x000CC388 public void Encode(ref int pos, byte[] metadata) { if (metadata != null) { Encoding.UTF8.GetBytes(this.name, 0, this.name.Length, metadata, pos); } pos += this.nameSize; if (metadata != null) { metadata[pos] = this.inType; } pos++; if ((this.inType & 128) != 0) { if (metadata != null) { metadata[pos] = this.outType; } pos++; if ((this.outType & 128) != 0) { Statics.EncodeTags((int)this.tags, ref pos, metadata); } } if ((this.inType & 32) != 0) { if (metadata != null) { metadata[pos] = (byte)this.fixedCount; metadata[pos + 1] = (byte)(this.fixedCount >> 8); } pos += 2; if (96 == (this.inType & 96) && this.fixedCount != 0) { if (metadata != null) { Buffer.BlockCopy(this.custom, 0, metadata, pos, (int)this.fixedCount); } pos += (int)this.fixedCount; } } }