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

◆ EtwEnableCallBack()

unsafe void System.Diagnostics.Tracing.EventProvider.EtwEnableCallBack ( in Guid sourceId,
int controlCode,
byte setLevel,
long anyKeyword,
long allKeyword,
Interop::Advapi32::EVENT_FILTER_DESCRIPTOR * filterData,
void * callbackContext )
inlineprivateinherited

Definition at line 196 of file EventProvider.cs.

197 {
198 try
199 {
202 bool flag = false;
203 switch (controlCode)
204 {
205 case 1:
206 {
207 m_enabled = true;
212 if (sessions.Count == 0)
213 {
214 sessions.Add(new KeyValuePair<SessionInfo, bool>(new SessionInfo(0, 0), value: true));
215 }
217 {
218 int sessionIdBit = item.Key.sessionIdBit;
219 int etwSessionId = item.Key.etwSessionId;
220 bool value = item.Value;
221 flag = true;
222 dictionary = null;
223 if (sessions.Count > 1)
224 {
225 filterData = null;
226 }
227 if (value && GetDataFromController(etwSessionId, filterData, out command, out var data, out var dataStart))
228 {
230 if (data != null)
231 {
232 while (dataStart < data.Length)
233 {
234 int num = FindNull(data, dataStart);
235 int num2 = num + 1;
236 int num3 = FindNull(data, num2);
237 if (num3 < data.Length)
238 {
239 string @string = Encoding.UTF8.GetString(data, dataStart, num - dataStart);
240 string string2 = Encoding.UTF8.GetString(data, num2, num3 - num2);
242 }
243 dataStart = num3 + 1;
244 }
245 }
246 }
247 OnControllerCommand(command, dictionary, value ? sessionIdBit : (-sessionIdBit), etwSessionId);
248 }
249 break;
250 }
251 case 0:
252 m_enabled = false;
253 m_level = 0;
256 m_liveSessions = null;
257 break;
258 case 2:
259 command = ControllerCommand.SendManifest;
260 break;
261 default:
262 return;
263 }
264 if (!flag)
265 {
267 }
268 }
269 catch
270 {
271 }
272 }
void Add(TKey key, TValue value)
unsafe bool GetDataFromController(int etwSessionId, Interop.Advapi32.EVENT_FILTER_DESCRIPTOR *filterData, out ControllerCommand command, out byte[] data, out int dataStart)
virtual void OnControllerCommand(ControllerCommand command, IDictionary< string, string > arguments, int sessionId, int etwSessionId)
static int FindNull(byte[] buffer, int idx)
List< KeyValuePair< SessionInfo, bool > > GetSessions()
static Encoding UTF8
Definition Encoding.cs:526

References System.Collections.Generic.Dictionary< TKey, TValue >.Add(), System.Collections.Generic.Dictionary< TKey, TValue >.Count, System.dictionary, System.Diagnostics.Tracing.EventProvider.FindNull(), System.Diagnostics.Tracing.EventProvider.GetDataFromController(), System.Diagnostics.Tracing.EventProvider.GetSessions(), System.item, System.L, System.Diagnostics.Tracing.EventProvider.m_allKeywordMask, System.Diagnostics.Tracing.EventProvider.m_anyKeywordMask, System.Diagnostics.Tracing.EventProvider.m_enabled, System.Diagnostics.Tracing.EventProvider.m_level, System.Diagnostics.Tracing.EventProvider.m_liveSessions, System.Diagnostics.Tracing.EventProvider.OnControllerCommand(), System.Text.Encoding.UTF8, and System.value.

Referenced by System.Diagnostics.Tracing.EventProvider.Register().