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

◆ TryConvertIdToContext()

static bool System.Diagnostics.Activity.TryConvertIdToContext ( string traceParent,
string traceState,
out ActivityContext context )
inlinestaticpackage

Definition at line 915 of file Activity.cs.

916 {
917 context = default(ActivityContext);
918 if (!IsW3CId(traceParent))
919 {
920 return false;
921 }
922 ReadOnlySpan<char> idData = traceParent.AsSpan(3, 32);
923 ReadOnlySpan<char> idData2 = traceParent.AsSpan(36, 16);
924 if (!ActivityTraceId.IsLowerCaseHexAndNotAllZeros(idData) || !ActivityTraceId.IsLowerCaseHexAndNotAllZeros(idData2) || !System.HexConverter.IsHexLowerChar(traceParent[53]) || !System.HexConverter.IsHexLowerChar(traceParent[54]))
925 {
926 return false;
927 }
928 context = new ActivityContext(new ActivityTraceId(idData.ToString()), new ActivitySpanId(idData2.ToString()), (ActivityTraceFlags)ActivityTraceId.HexByteFromChars(traceParent[53], traceParent[54]), traceState);
929 return true;
930 }
static bool IsW3CId(string id)
Definition Activity.cs:902
ActivityTraceFlags ActivityTraceFlags
Definition Activity.cs:561
static bool IsHexLowerChar(int c)

References System.Diagnostics.ActivityTraceId.HexByteFromChars(), System.HexConverter.IsHexLowerChar(), System.Diagnostics.ActivityTraceId.IsLowerCaseHexAndNotAllZeros(), and System.Diagnostics.Activity.IsW3CId().

Referenced by System.Diagnostics.PassThroughPropagator.GetRootId(), System.Diagnostics.ActivityContext.Parse(), and System.Diagnostics.ActivityContext.TryParse().