public static void Write(EtwSessionInfo sessionInfo, int lid, TraceType traceType, Guid component, int traceTag, long id, string message) { int num = (message.Length + 1) * 2; int num2 = 16; int num3 = 8064; int val = (num3 - num2) / 2 - 1; if (num2 + num < num3) { uint num4 = DiagnosticsNativeMethods.TraceMessage(sessionInfo.Session.DangerousGetHandle(), 43U, ref component, (ushort)traceType | 32, ref traceTag, 4, message, num, ref id, 8, ref lid, 4, IntPtr.Zero, 0); if (num4 != 0U) { return; } } else { int num5 = 0; int i = message.Length; while (i > 0) { int num6 = Math.Min(i, val); uint num7 = DiagnosticsNativeMethods.TraceMessage(sessionInfo.Session.DangerousGetHandle(), 43U, ref component, (ushort)traceType | 32, ref traceTag, 4, message.Substring(num5, num6), (num6 + 1) * 2, ref id, 8, ref lid, 4, IntPtr.Zero, 0); i -= num6; num5 += num6; } } }
internal static void WriteCas(CasTraceEventType eventType, CasTraceStartStop traceType, Guid serviceProviderRequestID, int bytesIn, int bytesOut, string serverAddress, string userContext, string spOperation, string spOperationData, string clientOperation) { int num = (serverAddress.Length + 1) * 2; int num2 = (userContext.Length + 1) * 2; int num3 = (spOperation.Length + 1) * 2; int num4 = (spOperationData.Length + 1) * 2; int num5 = (clientOperation.Length + 1) * 2; int num6 = 12 + 2 * ETWTrace.GuidByteLength + num + num2 + num3 + num4 + num5; int num7 = 8064; if (num6 < num7) { int num8 = (int)traceType; Guid activityId = ETWTrace.GetActivityId(); Guid events = ETWTrace.casPerfGuids.Events; uint num9 = DiagnosticsNativeMethods.TraceMessage(ETWTrace.CasPerfSession.Session.DangerousGetHandle(), 43U, ref events, (ushort)eventType, ref num8, 4, activityId.ToByteArray(), ETWTrace.GuidByteLength, serviceProviderRequestID.ToByteArray(), ETWTrace.GuidByteLength, ref bytesIn, 4, ref bytesOut, 4, serverAddress, num, userContext, num2, spOperation, num3, spOperationData, num4, clientOperation, num5, IntPtr.Zero, 0); } }