static AppContextSwitches() { bool isEnabled; if (!AppContext.TryGetSwitch("TestSwitch.LocalAppContext.DisableCaching", out isEnabled)) { return; } AppContextSwitches.DisableCaching = isEnabled; }
internal static bool GetBooleanConfig(string switchName, string envVariable, bool defaultValue = false) { if (!AppContext.TryGetSwitch(switchName, out bool ret)) { string?switchValue = Environment.GetEnvironmentVariable(envVariable); ret = switchValue != null ? (bool.IsTrueStringIgnoreCase(switchValue) || switchValue.Equals("1")) : defaultValue; } return(ret); }
static bool GetNet6CompatReadKeySetting() { if (AppContext.TryGetSwitch("System.Console.UseNet6CompatReadKey", out bool fileConfig)) { return(fileConfig); } string?envVar = Environment.GetEnvironmentVariable("DOTNET_SYSTEM_CONSOLE_USENET6COMPATREADKEY"); return(envVar is not null && (envVar == "1" || envVar.Equals("true", StringComparison.OrdinalIgnoreCase))); }
// Token: 0x06000228 RID: 552 RVA: 0x00005BA8 File Offset: 0x00003DA8 private static bool GetCachedSwitchValueInternal(string switchName, ref int switchValue) { bool flag; AppContext.TryGetSwitch(switchName, out flag); if (AppContextSwitches.DisableCaching) { return(flag); } switchValue = (flag ? 1 : -1); return(flag); }
private static bool GetCachedSwitchValueInternal(string switchName, ref int switchValue) { bool isEnabled; AppContext.TryGetSwitch(switchName, out isEnabled); if (AppContextSwitches.DisableCaching) { return(isEnabled); } switchValue = isEnabled ? 1 : -1; return(isEnabled); }
private static bool GetCachedSwitchValueInternal(string switchName, ref int switchValue) { AppContext.TryGetSwitch(switchName, out bool isSwitchEnabled); if (DisableCaching) { return(isSwitchEnabled); } switchValue = isSwitchEnabled ? 1 /*true*/ : -1 /*false*/; return(isSwitchEnabled); }
public bool?IsCompatibilitySwitchSet(string value) { bool result; if (AppContext.TryGetSwitch(value, out result)) { return(result); } else { return(default(bool?)); } }
private static bool GetCachedSwitchValueInternal(string switchName, ref int cachedSwitchValue) { bool isSwitchEnabled; AppContext.TryGetSwitch(switchName, out isSwitchEnabled); AppContext.TryGetSwitch(@"TestSwitch.LocalAppContext.DisableCaching", out bool disableCaching); if (!disableCaching) { cachedSwitchValue = isSwitchEnabled ? 1 /*true*/ : -1 /*false*/; } return(isSwitchEnabled); }
public bool?IsCompatibilitySwitchSet(string value) { return(AppContext.TryGetSwitch(value, out bool result) ? result : default(bool?)); }
internal static bool GetBooleanConfig(string configName, bool defaultValue) => AppContext.TryGetSwitch(configName, out bool value) ? value : defaultValue;
internal static bool GetSwitchValue(string switchName, ref bool switchValue) => AppContext.TryGetSwitch(switchName, out switchValue);