Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
EventWrittenEventArgs.cs
Go to the documentation of this file.
3
5
7{
8 private sealed class MoreEventInfo
9 {
10 public string Message;
11
12 public string EventName;
13
15
17
18 public long? OsThreadId;
19
21
23
25
27 }
28
29 internal static readonly ReadOnlyCollection<object> EmptyPayload = new ReadOnlyCollection<object>(Array.Empty<object>());
30
32
34
36
37 public string? EventName
38 {
39 get
40 {
41 object obj = _moreInfo?.EventName;
42 if (obj == null)
43 {
44 if (EventId > 0)
45 {
46 return Metadata.Name;
47 }
48 obj = null;
49 }
50 return (string?)obj;
51 }
52 internal set
53 {
54 MoreInfo.EventName = value;
55 }
56 }
57
58 public int EventId { get; }
59
61 {
62 get
63 {
64 if (_activityId == Guid.Empty)
65 {
67 }
68 return _activityId;
69 }
70 }
71
73
74 public ReadOnlyCollection<object?>? Payload { get; internal set; }
75
77 {
78 get
79 {
80 object obj = _moreInfo?.PayloadNames;
81 if (obj == null)
82 {
83 if (EventId > 0)
84 {
85 return Metadata.ParameterNames;
86 }
87 obj = null;
88 }
90 }
91 internal set
92 {
93 MoreInfo.PayloadNames = value;
94 }
95 }
96
97 public EventSource EventSource { get; }
98
100 {
101 get
102 {
103 if (EventId > 0)
104 {
105 return (EventKeywords)Metadata.Descriptor.Keywords;
106 }
107 return _moreInfo?.Keywords ?? EventKeywords.None;
108 }
109 internal set
110 {
111 MoreInfo.Keywords = value;
112 }
113 }
114
116 {
117 get
118 {
119 if (EventId > 0)
120 {
121 return (EventOpcode)Metadata.Descriptor.Opcode;
122 }
123 return _moreInfo?.Opcode ?? EventOpcode.Info;
124 }
125 internal set
126 {
127 MoreInfo.Opcode = value;
128 }
129 }
130
132 {
133 get
134 {
135 if (EventId > 0)
136 {
137 return (EventTask)Metadata.Descriptor.Task;
138 }
139 return EventTask.None;
140 }
141 }
142
144 {
145 get
146 {
147 if (EventId > 0)
148 {
149 return Metadata.Tags;
150 }
151 return _moreInfo?.Tags ?? EventTags.None;
152 }
153 internal set
154 {
155 MoreInfo.Tags = value;
156 }
157 }
158
159 public string? Message
160 {
161 get
162 {
163 object obj = _moreInfo?.Message;
164 if (obj == null)
165 {
166 if (EventId > 0)
167 {
168 return Metadata.Message;
169 }
170 obj = null;
171 }
172 return (string?)obj;
173 }
174 internal set
175 {
176 MoreInfo.Message = value;
177 }
178 }
179
181 {
182 get
183 {
184 if (EventId > 0)
185 {
186 return (EventChannel)Metadata.Descriptor.Channel;
187 }
188 return EventChannel.None;
189 }
190 }
191
192 public byte Version
193 {
194 get
195 {
196 if (EventId > 0)
197 {
198 return Metadata.Descriptor.Version;
199 }
200 return 0;
201 }
202 }
203
205 {
206 get
207 {
208 if (EventId > 0)
209 {
210 return (EventLevel)Metadata.Descriptor.Level;
211 }
212 return _moreInfo?.Level ?? EventLevel.LogAlways;
213 }
214 internal set
215 {
216 MoreInfo.Level = value;
217 }
218 }
219
220 public long OSThreadId
221 {
222 get
223 {
224 ref long? osThreadId = ref MoreInfo.OsThreadId;
225 if (!osThreadId.HasValue)
226 {
227 osThreadId = (long)Thread.CurrentOSThreadId;
228 }
229 return osThreadId.Value;
230 }
231 internal set
232 {
233 MoreInfo.OsThreadId = value;
234 }
235 }
236
237 public DateTime TimeStamp { get; internal set; }
238
240
241 internal EventWrittenEventArgs(EventSource eventSource, int eventId)
242 {
243 EventSource = eventSource;
244 EventId = eventId;
246 }
247
248 internal unsafe EventWrittenEventArgs(EventSource eventSource, int eventId, Guid* pActivityID, Guid* pChildActivityID)
249 : this(eventSource, eventId)
250 {
251 if (pActivityID != null)
252 {
253 _activityId = *pActivityID;
254 }
255 if (pChildActivityID != null)
256 {
257 MoreInfo.RelatedActivityId = *pChildActivityID;
258 }
259 }
260}
volatile EventMetadata[] m_eventData
static readonly ReadOnlyCollection< object > EmptyPayload
EventWrittenEventArgs(EventSource eventSource, int eventId)
unsafe EventWrittenEventArgs(EventSource eventSource, int eventId, Guid *pActivityID, Guid *pChildActivityID)
static ulong CurrentOSThreadId
Definition Thread.cs:320
Version(int major, int minor, int build, int revision)
Definition Version.cs:47
static unsafe DateTime UtcNow
Definition DateTime.cs:142
static readonly Guid Empty
Definition Guid.cs:86