示例#1
0
        private void AddField(FieldMetadata fieldMetadata)
        {
            this.Tags = EventFieldTags.None;
            this.bufferedArrayFieldCount++;
            this.impl.fields.Add(fieldMetadata);

            this.currentGroup?.IncrementStructFieldCount();
        }
示例#2
0
        private FieldMetadata(
            string name,
            TraceLoggingDataType dataType,
            EventFieldTags tags,
            byte countFlags,
            ushort fixedCount = 0,
            byte[] custom     = null)
        {
            if (name == null)
            {
                throw new ArgumentNullException(
                          nameof(name),
                          "This usually means that the object passed to Write is of a type that"
                          + " does not support being used as the top-level object in an event,"
                          + " e.g. a primitive or built-in type.");
            }

            Statics.CheckName(name);
            var coreType = (int)dataType & Statics.InTypeMask;

            this.name       = name;
            nameSize        = Encoding.UTF8.GetByteCount(this.name) + 1;
            inType          = (byte)(coreType | countFlags);
            outType         = (byte)(((int)dataType >> 8) & Statics.OutTypeMask);
            this.tags       = tags;
            this.fixedCount = fixedCount;
            this.custom     = custom;

            if (countFlags != 0)
            {
                if (coreType == (int)TraceLoggingDataType.Nil)
                {
                    throw new NotSupportedException(Resources.GetResourceString("EventSource_NotSupportedArrayOfNil"));
                }
                if (coreType == (int)TraceLoggingDataType.Binary)
                {
                    throw new NotSupportedException(Resources.GetResourceString("EventSource_NotSupportedArrayOfBinary"));
                }
#if !BROKEN_UNTIL_M3
                if (coreType == (int)TraceLoggingDataType.Utf16String ||
                    coreType == (int)TraceLoggingDataType.MbcsString)
                {
                    throw new NotSupportedException(Resources.GetResourceString("EventSource_NotSupportedArrayOfNullTerminatedString"));
                }
#endif
            }

            if (((int)this.tags & 0xfffffff) != 0)
            {
                outType |= Statics.OutTypeChainFlag;
            }

            if (outType != 0)
            {
                inType |= Statics.InTypeChainFlag;
            }
        }
示例#3
0
 /// <summary>
 /// Custom serializer
 /// </summary>
 public FieldMetadata(
     string name,
     TraceLoggingDataType type,
     EventFieldTags tags,
     byte[]?custom)
     : this(
         name,
         type,
         tags,
         Statics.InTypeCustomCountFlag,
         checked ((ushort)(custom == null ? 0 : custom.Length)),
         custom)
 {
 }
示例#4
0
 /// <summary>
 /// Fixed-length array.
 /// </summary>
 public FieldMetadata(
     string name,
     TraceLoggingDataType type,
     EventFieldTags tags,
     ushort fixedCount)
     : this(
         name,
         type,
         tags,
         Statics.InTypeFixedCountFlag,
         fixedCount,
         null)
 {
 }
示例#5
0
 /// <summary>
 /// Scalar or variable-length array.
 /// </summary>
 public FieldMetadata(
     string name,
     TraceLoggingDataType type,
     EventFieldTags tags,
     bool variableCount)
     : this(
         name,
         type,
         tags,
         variableCount ? Statics.InTypeVariableCountFlag : (byte)0,
         0,
         null)
 {
 }
示例#6
0
 /// <summary>
 /// Fixed-length array.
 /// </summary>
 public FieldMetadata(
     string name,
     TraceLoggingDataType type,
     EventFieldTags tags,
     ushort fixedCount)
     : this(
         name,
         type,
         tags,
         Statics.InTypeFixedCountFlag,
         fixedCount,
         null)
 {
     return;
 }
示例#7
0
 /// <summary>
 /// Scalar or variable-length array.
 /// </summary>
 public FieldMetadata(
     string name,
     TraceLoggingDataType type,
     EventFieldTags tags,
     bool variableCount)
     : this(
         name,
         type,
         tags,
         variableCount ? Statics.InTypeVariableCountFlag : (byte)0,
         0,
         null)
 {
     return;
 }
示例#8
0
 /// <summary>
 /// Custom serializer
 /// </summary>
 public FieldMetadata(
     string name,
     TraceLoggingDataType type,
     EventFieldTags tags,
     byte[] custom)
     : this(
         name,
         type,
         tags,
         Statics.InTypeCustomCountFlag,
         checked((ushort)(custom == null ? 0 : custom.Length)),
         custom)
 {
     return;
 }
示例#9
0
        private FieldMetadata(string name, TraceLoggingDataType dataType, EventFieldTags tags, byte countFlags, ushort fixedCount = 0, byte[] custom = null)
        {
            if (name == null)
            {
                throw new ArgumentNullException("name", "This usually means that the object passed to Write is of a type that does not support being used as the top-level object in an event, e.g. a primitive or built-in type.");
            }
            Statics.CheckName(name);
            int num = (int)(dataType & (TraceLoggingDataType)31);

            this.name       = name;
            this.nameSize   = Encoding.UTF8.GetByteCount(this.name) + 1;
            this.inType     = (byte)((uint)num | (uint)countFlags);
            this.outType    = (byte)((int)dataType >> 8 & (int)sbyte.MaxValue);
            this.tags       = tags;
            this.fixedCount = fixedCount;
            this.custom     = custom;
            if ((int)countFlags != 0)
            {
                if (num == 0)
                {
                    throw new NotSupportedException(Environment.GetResourceString("EventSource_NotSupportedArrayOfNil"));
                }
                if (num == 14)
                {
                    throw new NotSupportedException(Environment.GetResourceString("EventSource_NotSupportedArrayOfBinary"));
                }
                if (num == 1 || num == 2)
                {
                    throw new NotSupportedException(Environment.GetResourceString("EventSource_NotSupportedArrayOfNullTerminatedString"));
                }
            }
            if ((this.tags & (EventFieldTags)268435455) != EventFieldTags.None)
            {
                this.outType = (byte)((uint)this.outType | 128U);
            }
            if ((int)this.outType == 0)
            {
                return;
            }
            this.inType = (byte)((uint)this.inType | 128U);
        }
示例#10
0
        private FieldMetadata(
            string name,
            TraceLoggingDataType dataType,
            EventFieldTags tags,
            byte countFlags,
            ushort fixedCount = 0,
            byte[] custom = null)
        {
            if (name == null)
            {
                throw new ArgumentNullException(
nameof(name),
                    "This usually means that the object passed to Write is of a type that"
                    + " does not support being used as the top-level object in an event,"
                    + " e.g. a primitive or built-in type.");
            }

            Statics.CheckName(name);
            var coreType = (int)dataType & Statics.InTypeMask;
            this.name = name;
            this.nameSize = Encoding.UTF8.GetByteCount(this.name) + 1;
            this.inType = (byte)(coreType | countFlags);
            this.outType = (byte)(((int)dataType >> 8) & Statics.OutTypeMask);
            this.tags = tags;
            this.fixedCount = fixedCount;
            this.custom = custom;

            if (countFlags != 0)
            {
                if (coreType == (int)TraceLoggingDataType.Nil)
                {
                    throw new NotSupportedException(Resources.GetResourceString("EventSource_NotSupportedArrayOfNil"));
                }
                if (coreType == (int)TraceLoggingDataType.Binary)
                {
                    throw new NotSupportedException(Resources.GetResourceString("EventSource_NotSupportedArrayOfBinary"));
                }
#if !BROKEN_UNTIL_M3
                if (coreType == (int)TraceLoggingDataType.Utf16String ||
                    coreType == (int)TraceLoggingDataType.MbcsString)
                {
                    throw new NotSupportedException(Resources.GetResourceString("EventSource_NotSupportedArrayOfNullTerminatedString"));
                }
#endif
            }

            if (((int)this.tags & 0xfffffff) != 0)
            {
                this.outType |= Statics.OutTypeChainFlag;
            }

            if (this.outType != 0)
            {
                this.inType |= Statics.InTypeChainFlag;
            }
        }
示例#11
0
 public FieldMetadata(string name, TraceLoggingDataType type, EventFieldTags tags, byte[] custom)
     : this(name, type, tags, (byte)96, custom == null ? (ushort)0 : checked ((ushort)custom.Length), custom)
 {
 }
示例#12
0
 public FieldMetadata(string name, TraceLoggingDataType type, EventFieldTags tags, ushort fixedCount)
     : this(name, type, tags, (byte)32, fixedCount, (byte[])null)
 {
 }
示例#13
0
 public FieldMetadata(string name, TraceLoggingDataType type, EventFieldTags tags, bool variableCount)
     : this(name, type, tags, variableCount ? (byte)64 : (byte)0, (ushort)0, (byte[])null)
 {
 }
 // Token: 0x0600351F RID: 13599 RVA: 0x000CE006 File Offset: 0x000CC206
 public FieldMetadata(string name, TraceLoggingDataType type, EventFieldTags tags, bool variableCount) : this(name, type, tags, variableCount ? 64 : 0, 0, null)
 {
 }