Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ AddValueToMetaData()

static int System.Diagnostics.Tracing.EventSource.AddValueToMetaData ( List< byte > metaData,
string value )
inlinestaticprivateinherited

Definition at line 3123 of file EventSource.cs.

3124 {
3125 if (value.Length == 0)
3126 {
3127 return 0;
3128 }
3129 int count = metaData.Count;
3130 char c = value[0];
3131 switch (c)
3132 {
3133 case '@':
3134 metaData.AddRange(Encoding.UTF8.GetBytes(value.Substring(1)));
3135 break;
3136 case '{':
3137 metaData.AddRange(new Guid(value).ToByteArray());
3138 break;
3139 case '#':
3140 {
3141 for (int i = 1; i < value.Length; i++)
3142 {
3143 if (value[i] != ' ')
3144 {
3145 if (i + 1 >= value.Length)
3146 {
3147 throw new ArgumentException(SR.EventSource_EvenHexDigits, "traits");
3148 }
3149 metaData.Add((byte)(HexDigit(value[i]) * 16 + HexDigit(value[i + 1])));
3150 i++;
3151 }
3152 }
3153 break;
3154 }
3155 default:
3156 if ('A' <= c || ' ' == c)
3157 {
3158 metaData.AddRange(Encoding.UTF8.GetBytes(value));
3159 break;
3160 }
3161 throw new ArgumentException(SR.Format(SR.EventSource_IllegalValue, value), "traits");
3162 }
3163 return metaData.Count - count;
3164 }
void AddRange(IEnumerable< KeyValuePair< TKey, TValue > > collection)
void Add(TKey key, TValue value)
static Encoding UTF8
Definition Encoding.cs:526

References System.Collections.Generic.Dictionary< TKey, TValue >.Add(), System.Collections.Generic.Dictionary< TKey, TValue >.AddRange(), System.count, System.Collections.Generic.Dictionary< TKey, TValue >.Count, System.SR.EventSource_EvenHexDigits, System.SR.EventSource_IllegalValue, System.SR.Format(), System.Diagnostics.Tracing.EventSource.Guid, System.Diagnostics.Tracing.EventSource.HexDigit(), System.Text.Encoding.UTF8, and System.value.

Referenced by System.Diagnostics.Tracing.EventSource.InitializeProviderMetadata().