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

◆ CreateManifestString()

string System.Diagnostics.Tracing.ManifestBuilder.CreateManifestString ( )
inlineprivate

Definition at line 368 of file ManifestBuilder.cs.

369 {
371 if (channelTab != null)
372 {
373 sb.AppendLine(" <channels>");
376 {
377 list.Add(item);
378 }
379 list.Sort((KeyValuePair<int, ChannelInfo> p1, KeyValuePair<int, ChannelInfo> p2) => -Comparer<ulong>.Default.Compare(p1.Value.Keywords, p2.Value.Keywords));
381 {
382 int key = item2.Key;
383 ChannelInfo value = item2.Value;
384 string text = null;
385 bool flag = false;
386 string text2 = null;
387 if (value.Attribs != null)
388 {
389 EventChannelAttribute attribs = value.Attribs;
390 if (Enum.IsDefined(typeof(EventChannelType), attribs.EventChannelType))
391 {
392 text = attribs.EventChannelType.ToString();
393 }
394 flag = attribs.Enabled;
395 }
396 if (text2 == null)
397 {
398 text2 = providerName + "/" + value.Name;
399 }
400 sb.Append(" <channel chid=\"").Append(value.Name).Append("\" name=\"")
401 .Append(text2)
402 .Append('"');
403 WriteMessageAttrib(sb, "channel", value.Name, null);
404 sb.Append(" value=\"").Append(key).Append('"');
405 if (text != null)
406 {
407 sb.Append(" type=\"").Append(text).Append('"');
408 }
409 sb.Append(" enabled=\"").Append(flag ? "true" : "false").Append('"');
410 sb.AppendLine("/>");
411 }
412 sb.AppendLine(" </channels>");
413 }
414 if (taskTab != null)
415 {
416 sb.AppendLine(" <tasks>");
418 list2.Sort();
419 foreach (int item3 in list2)
420 {
421 sb.Append(" <task");
423 sb.Append(" value=\"").Append(item3).AppendLine("\"/>");
424 }
425 sb.AppendLine(" </tasks>");
426 }
427 if (mapsTab != null)
428 {
429 sb.AppendLine(" <maps>");
430 foreach (Type value3 in mapsTab.Values)
431 {
432 bool flag2 = EventSource.IsCustomAttributeDefinedHelper(value3, typeof(FlagsAttribute), flags);
433 string value2 = (flag2 ? "bitMap" : "valueMap");
434 sb.Append(" <").Append(value2).Append(" name=\"")
435 .Append(value3.Name)
436 .AppendLine("\">");
438 bool flag3 = false;
440 foreach (FieldInfo fieldInfo in array2)
441 {
442 object rawConstantValue = fieldInfo.GetRawConstantValue();
443 if (rawConstantValue != null)
444 {
445 ulong num = ((!(rawConstantValue is ulong)) ? ((ulong)Convert.ToInt64(rawConstantValue)) : ((ulong)rawConstantValue));
446 if (!flag2 || ((num & (num - 1)) == 0L && num != 0L))
447 {
448 num.TryFormat(destination, out var charsWritten, "x");
450 sb.Append(" <map value=\"0x").Append(span).Append('"');
451 WriteMessageAttrib(sb, "map", value3.Name + "." + fieldInfo.Name, fieldInfo.Name);
452 sb.AppendLine("/>");
453 flag3 = true;
454 }
455 }
456 }
457 if (!flag3)
458 {
459 sb.Append(" <map value=\"0x0\"");
460 WriteMessageAttrib(sb, "map", value3.Name + ".None", "None");
461 sb.AppendLine("/>");
462 }
463 sb.Append(" </").Append(value2).AppendLine(">");
464 }
465 sb.AppendLine(" </maps>");
466 }
467 sb.AppendLine(" <opcodes>");
469 list3.Sort();
470 foreach (int item4 in list3)
471 {
472 sb.Append(" <opcode");
474 sb.Append(" value=\"").Append(item4).AppendLine("\"/>");
475 }
476 sb.AppendLine(" </opcodes>");
477 if (keywordTab != null)
478 {
479 sb.AppendLine(" <keywords>");
481 list4.Sort();
482 foreach (ulong item5 in list4)
483 {
484 sb.Append(" <keyword");
486 item5.TryFormat(destination, out var charsWritten2, "x");
488 sb.Append(" mask=\"0x").Append(span2).AppendLine("\"/>");
489 }
490 sb.AppendLine(" </keywords>");
491 }
492 sb.AppendLine(" <events>");
494 sb.AppendLine(" </events>");
495 sb.AppendLine(" <templates>");
496 if (templates.Length > 0)
497 {
499 }
500 else
501 {
502 sb.AppendLine(" <template tid=\"_empty\"></template>");
503 }
504 sb.AppendLine(" </templates>");
505 sb.AppendLine("</provider>");
506 sb.AppendLine("</events>");
507 sb.AppendLine("</instrumentation>");
508 sb.AppendLine("<localization>");
509 string[] array3 = new string[stringTab.Keys.Count];
510 stringTab.Keys.CopyTo(array3, 0);
511 Array.Sort(array3, 0, array3.Length);
513 sb.Append(" <resources culture=\"").Append(currentUICulture.Name).AppendLine("\">");
514 sb.AppendLine(" <stringTable>");
515 string[] array4 = array3;
516 foreach (string text3 in array4)
517 {
519 sb.Append(" <string id=\"").Append(text3).Append("\" value=\"")
521 .AppendLine("\"/>");
522 }
523 sb.AppendLine(" </stringTable>");
524 sb.AppendLine(" </resources>");
525 sb.AppendLine("</localization>");
526 sb.AppendLine("</instrumentationManifest>");
527 return sb.ToString();
528 [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2070:UnrecognizedReflectionPattern", Justification = "Trimmer does not trim enums")]
530 {
531 return localEnumType.GetFields(BindingFlags.DeclaredOnly | BindingFlags.Static | BindingFlags.Public);
532 }
533 }
void Add(TKey key, TValue value)
readonly EventManifestOptions flags
void WriteNameAndMessageAttribs(StringBuilder stringBuilder, string elementName, string name)
readonly Dictionary< int, string > opcodeTab
string GetLocalizedMessage(string key, CultureInfo ci, bool etwFormat)
readonly Dictionary< string, string > stringTab
void WriteMessageAttrib(StringBuilder stringBuilder, string elementName, string name, string value)
Dictionary< int, ChannelInfo > channelTab
static CultureInfo CurrentUICulture
override string ToString()
StringBuilder Append(char value, int repeatCount)

References System.Collections.Generic.Dictionary< TKey, TValue >.Add(), System.Text.StringBuilder.Append(), System.Text.StringBuilder.AppendLine(), System.array, System.Diagnostics.Tracing.ManifestBuilder.channelTab, System.Globalization.CultureInfo.CurrentUICulture, System.destination, System.Diagnostics.Tracing.ManifestBuilder.events, System.Diagnostics.Tracing.ManifestBuilder.flags, System.Diagnostics.Tracing.ManifestBuilder.GetLocalizedMessage(), System.Diagnostics.Tracing.EventSource.IsCustomAttributeDefinedHelper(), System.Enum.IsDefined(), System.item, System.key, System.Collections.Generic.Dictionary< TKey, TValue >.Keys, System.Diagnostics.Tracing.ManifestBuilder.keywordTab, System.L, System.Text.StringBuilder.Length, System.list, System.Diagnostics.Tracing.ManifestBuilder.mapsTab, System.Diagnostics.Tracing.ManifestBuilder.opcodeTab, System.Diagnostics.Tracing.ManifestBuilder.providerName, System.Diagnostics.Tracing.ManifestBuilder.sb, System.Array.Sort(), System.Diagnostics.Tracing.ManifestBuilder.stringTab, System.Diagnostics.Tracing.ManifestBuilder.taskTab, System.Diagnostics.Tracing.ManifestBuilder.templates, System.text, System.Convert.ToInt64(), System.Text.StringBuilder.ToString(), System.value, System.Collections.Generic.Dictionary< TKey, TValue >.Values, System.Diagnostics.Tracing.ManifestBuilder.WriteMessageAttrib(), and System.Diagnostics.Tracing.ManifestBuilder.WriteNameAndMessageAttribs().

Referenced by System.Diagnostics.Tracing.ManifestBuilder.CreateManifest().