Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
InvokeTypeInfo.cs
Go to the documentation of this file.
2
3internal sealed class InvokeTypeInfo : TraceLoggingTypeInfo
4{
5 internal readonly PropertyAnalysis[] properties;
6
7 public InvokeTypeInfo(Type type, TypeAnalysis typeAnalysis)
8 : base(type, typeAnalysis.name, typeAnalysis.level, typeAnalysis.opcode, typeAnalysis.keywords, typeAnalysis.tags)
9 {
10 if (typeAnalysis.properties.Length != 0)
11 {
12 properties = typeAnalysis.properties;
13 }
14 }
15
17 {
18 TraceLoggingMetadataCollector traceLoggingMetadataCollector = collector.AddGroup(name);
19 if (properties == null)
20 {
21 return;
22 }
24 foreach (PropertyAnalysis propertyAnalysis in array)
25 {
26 EventFieldFormat format2 = EventFieldFormat.Default;
27 EventFieldAttribute fieldAttribute = propertyAnalysis.fieldAttribute;
28 if (fieldAttribute != null)
29 {
30 traceLoggingMetadataCollector.Tags = fieldAttribute.Tags;
31 format2 = fieldAttribute.Format;
32 }
33 propertyAnalysis.typeInfo.WriteMetadata(traceLoggingMetadataCollector, propertyAnalysis.name, format2);
34 }
35 }
36
37 public override void WriteData(PropertyValue value)
38 {
39 if (properties != null)
40 {
42 foreach (PropertyAnalysis propertyAnalysis in array)
43 {
44 propertyAnalysis.typeInfo.WriteData(propertyAnalysis.getter(value));
45 }
46 }
47 }
48
49 public override object GetData(object value)
50 {
51 if (properties != null)
52 {
53 string[] array = new string[properties.Length];
54 object[] array2 = new object[properties.Length];
55 for (int i = 0; i < properties.Length; i++)
56 {
57 object value2 = properties[i].propertyInfo.GetValue(value);
58 array[i] = properties[i].name;
59 array2[i] = properties[i].typeInfo.GetData(value2);
60 }
61 return new EventPayload(array, array2);
62 }
63 return null;
64 }
65}
InvokeTypeInfo(Type type, TypeAnalysis typeAnalysis)
override void WriteMetadata(TraceLoggingMetadataCollector collector, string name, EventFieldFormat format)
override void WriteData(PropertyValue value)
readonly PropertyAnalysis[] properties
override object GetData(object value)
readonly Func< PropertyValue, PropertyValue > getter
readonly EventFieldAttribute fieldAttribute
void WriteMetadata(TraceLoggingMetadataCollector collector, string name, EventFieldFormat format)
readonly PropertyAnalysis[] properties