Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
LocalAppContextSwitches.cs
Go to the documentation of this file.
2
3namespace System;
4
5internal static class LocalAppContextSwitches
6{
8
9
11 {
12 bool switchValue = false;
13 if (!GetSwitchValue("System.Diagnostics.DefaultActivityIdFormatIsHierarchial", ref switchValue))
14 {
15 string environmentVariable = Environment.GetEnvironmentVariable("DOTNET_SYSTEM_DIAGNOSTICS_DEFAULTACTIVITYIDFORMATISHIERARCHIAL");
16 if (environmentVariable != null)
17 {
18 switchValue = IsTrueStringIgnoreCase(environmentVariable) || environmentVariable.Equals("1");
19 }
20 }
21 return switchValue;
22 }
23
24 [MethodImpl(MethodImplOptions.AggressiveInlining)]
25 private static bool IsTrueStringIgnoreCase(string value)
26 {
27 if (value.Length == 4 && (value[0] == 't' || value[0] == 'T') && (value[1] == 'r' || value[1] == 'R') && (value[2] == 'u' || value[2] == 'U'))
28 {
29 if (value[3] != 'e')
30 {
31 return value[3] == 'E';
32 }
33 return true;
34 }
35 return false;
36 }
37
38 [MethodImpl(MethodImplOptions.AggressiveInlining)]
39 internal static bool GetSwitchValue(string switchName, ref bool switchValue)
40 {
41 return AppContext.TryGetSwitch(switchName, out switchValue);
42 }
43}
static bool TryGetSwitch(string switchName, out bool isEnabled)
Definition AppContext.cs:74
static ? string GetEnvironmentVariable(string variable)
static bool GetSwitchValue(string switchName, ref bool switchValue)
static bool IsTrueStringIgnoreCase(string value)