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

◆ InitializeProviderMetadata()

void System.Diagnostics.Tracing.EventSource.InitializeProviderMetadata ( )
inlineprivateinherited

Definition at line 3076 of file EventSource.cs.

3077 {
3078 if (ProviderMetadata.Length > 0)
3079 {
3080 return;
3081 }
3082 if (m_traits != null)
3083 {
3084 List<byte> list = new List<byte>(100);
3085 for (int i = 0; i < m_traits.Length - 1; i += 2)
3086 {
3087 if (!m_traits[i].StartsWith("ETW_", StringComparison.Ordinal))
3088 {
3089 continue;
3090 }
3091 string text = m_traits[i].Substring(4);
3092 if (!byte.TryParse(text, out var result))
3093 {
3094 if (!(text == "GROUP"))
3095 {
3096 throw new ArgumentException(SR.Format(SR.EventSource_UnknownEtwTrait, text), "traits");
3097 }
3098 result = 1;
3099 }
3100 string value = m_traits[i + 1];
3101 int count = list.Count;
3102 list.Add(0);
3103 list.Add(0);
3104 list.Add(result);
3105 int num = AddValueToMetaData(list, value) + 3;
3106 list[count] = (byte)num;
3107 list[count + 1] = (byte)(num >> 8);
3108 }
3109 byte[] array = Statics.MetadataForString(Name, 0, list.Count, 0);
3110 int num2 = array.Length - list.Count;
3111 foreach (byte item in list)
3112 {
3113 array[num2++] = item;
3114 }
3116 }
3117 else
3118 {
3119 m_providerMetadata = Statics.MetadataForString(Name, 0, 0, 0);
3120 }
3121 }
static int AddValueToMetaData(List< byte > metaData, string value)
virtual ReadOnlySpan< byte > ProviderMetadata

References System.Diagnostics.Tracing.EventSource.AddValueToMetaData(), System.array, System.count, System.Collections.Generic.Dictionary< TKey, TValue >.Count, System.SR.EventSource_UnknownEtwTrait, System.SR.Format(), System.item, System.list, System.Diagnostics.Tracing.EventSource.m_providerMetadata, System.Diagnostics.Tracing.EventSource.m_traits, System.Diagnostics.Tracing.Statics.MetadataForString(), System.Diagnostics.Tracing.EventSource.Name, System.Diagnostics.Tracing.EventSource.ProviderMetadata, System.text, and System.value.

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