21 private static readonly
string[]
s_escapes =
new string[8] {
"&",
"<",
">",
"'",
""",
"%r",
"%n",
"%t" };
75 sb.
AppendLine(
"<instrumentationManifest xmlns=\"http://schemas.microsoft.com/win/2004/08/events\">");
76 sb.
AppendLine(
" <instrumentation xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:win=\"http://manifests.microsoft.com/win/2004/08/windows/events\">");
77 sb.
AppendLine(
" <events xmlns=\"http://schemas.microsoft.com/win/2004/08/events\">");
92 handler2.AppendLiteral(
" resourceFileName=\"");
94 handler2.AppendLiteral(
"\" messageFileName=\"");
103 handler3.AppendLiteral(
" symbol=\"");
204 eventChannelAttribute.Enabled =
true;
213 return Array.Empty<ulong>();
223 ulong[]
array =
new ulong[num + 1];
387 if (
value.Attribs !=
null)
409 sb.
Append(
" enabled=\"").
Append(flag ?
"true" :
"false").Append(
'"');
446 if (!
flag2 || ((num & (num - 1)) == 0
L && num != 0
L))
528 [
UnconditionalSuppressMessage(
"ReflectionAnalysis",
"IL2070:UnrecognizedReflectionPattern", Justification =
"Trimmer does not trim enums")]
546 text = elementName +
"_" + name;
557 text = elementName +
"_" + name;
582 string evtName =
key.Substring(
"event_".Length);
616 value =
"Informational";
623 int num = (int)level;
624 value = num.ToString();
635 if ((
int)channel < 16)
643 string text = channel.ToString();
644 if (19 < (
int)channel)
693 return "win:DC_Start";
695 return "win:DC_Stop";
697 return "win:Extension";
703 return "win:Suspend";
707 return "win:Receive";
722 keywords &= 0xFFFFFFFFFFFFFFF
uL;
724 for (ulong num = 1
uL; num != 0
L; num <<= 1)
726 if ((keywords & num) != 0
L)
731 value =
string.Empty;
736 value =
string.Empty;
738 if (
value.Length != 0)
756 return typeName.Replace(
"win:Int",
"win:UInt");
761 return "win:Boolean";
780 return "win:UnicodeString";
786 return "win:FILETIME";
794 return "win:Pointer";
842 for (; i < eventMessage.Length &&
char.IsDigit(
eventMessage[i]); i++)
static void Sort(Array array)
bool TryGetValue(TKey key, [MaybeNullWhen(false)] out TValue value)
bool ContainsKey(TKey key)
void Add(TKey key, TValue value)
static long ToInt64(object? value)
static bool IsCustomAttributeDefinedHelper(MemberInfo member, Type attributeType, EventManifestOptions flags=EventManifestOptions.None)
EventChannelAttribute Attribs
string GetChannelName(EventChannel channel, string eventName, string eventMessage)
readonly EventManifestOptions flags
string GetTypeName(Type type)
static EventChannelAttribute GetDefaultChannelAttribute(EventChannel channel)
ulong nextChannelKeywordBit
readonly ResourceManager resources
readonly IList< string > errors
ManifestBuilder(string providerName, Guid providerGuid, string dllName, ResourceManager resources, EventManifestOptions flags)
ulong GetChannelKeyword(EventChannel channel, ulong channelKeyword=0uL)
void WriteNameAndMessageAttribs(StringBuilder stringBuilder, string elementName, string name)
readonly string providerName
void AddKeyword(string name, ulong value)
Dictionary< int, string > taskTab
Dictionary< string, Type > mapsTab
string CreateManifestString()
int TranslateIndexToManifestConvention(int idx, string evtName)
void StartEvent(string eventName, EventAttribute eventAttribute)
static void UpdateStringBuilder([NotNull] ref StringBuilder stringBuilder, string eventMessage, int startIndex, int count)
void ManifestError(string msg, bool runtimeCritical=false)
List< int > byteArrArgIndices
void AddOpcode(string name, int value)
static void AppendLevelName(StringBuilder sb, EventLevel level)
readonly Dictionary< string, List< int > > perEventByteArrayArgIndices
readonly Dictionary< int, string > opcodeTab
static readonly string[] s_escapes
readonly StringBuilder sb
void AddEventParameter(Type type, string name)
string GetLocalizedMessage(string key, CultureInfo ci, bool etwFormat)
Dictionary< ulong, string > keywordTab
readonly Dictionary< string, string > stringTab
void AppendKeywords(StringBuilder sb, ulong keywords, string eventName)
static EventChannelType EventChannelToChannelType(EventChannel channel)
void WriteMessageAttrib(StringBuilder stringBuilder, string elementName, string name, string value)
readonly StringBuilder templates
string GetOpcodeName(EventOpcode opcode, string eventName)
void AddTask(string name, int value)
string TranslateToManifestConvention(string eventMessage, string evtName)
void AddChannel(string name, int value, EventChannelAttribute channelAttribute)
string GetTaskName(EventTask task, string eventName)
readonly StringBuilder events
Dictionary< int, ChannelInfo > channelTab
static Type GetUnderlyingType(Type enumType)
static bool IsDefined(Type enumType, object value)
static CultureInfo CurrentUICulture
static CultureInfo CurrentCulture
static CultureInfo InvariantCulture
virtual ? string GetString(string name)
static string EventSource_TaskCollision
static string EventSource_DuplicateStringKey
static string EventSource_IllegalKeywordsValue
static string EventSource_EventChannelOutOfRange
static string EventSource_UnsupportedMessageProperty
static string Format(string resourceFormat, object p1)
static string EventSource_EventWithAdminChannelMustHaveMessage
static string EventSource_OpcodeCollision
static string EventSource_UndefinedKeyword
static string EventSource_MaxChannelExceeded
static string EventSource_KeywordNeedPowerOfTwo
static string EventSource_IllegalOpcodeValue
static string EventSource_UndefinedOpcode
static string EventSource_UnsupportedEventTypeInManifest
static string EventSource_IllegalTaskValue
static string EventSource_UndefinedChannel
static string EventSource_ChannelTypeDoesNotMatchEventChannelValue
static string EventSource_KeywordCollision
StringBuilder AppendLine()
override string ToString()
StringBuilder Append(char value, int repeatCount)
static TypeCode GetTypeCode(Type? type)
void AppendLiteral(string value)
void AppendFormatted(ReadOnlySpan< char > value)