/// <summary>Tries to get the value of a switch. </summary>
        /// <param name="switchName">The name of the switch. </param>
        /// <param name="isEnabled">When this method returns, contains the value of <paramref name="switchName" /> if <paramref name="switchName" /> was found, or <see langword="false" /> if <paramref name="switchName" /> was not found. This parameter is passed uninitialized. </param>
        /// <returns>
        ///     <see langword="true" /> if <paramref name="switchName" /> was set and the <paramref name="isEnabled" /> argument contains the value of the switch; otherwise, <see langword="false" />. </returns>
        /// <exception cref="T:System.ArgumentNullException">
        ///         <paramref name="switchName" /> is <see langword="null" />. </exception>
        /// <exception cref="T:System.ArgumentException">
        ///         <paramref name="switchName" /> is <see cref="F:System.String.Empty" />. </exception>
        // Token: 0x06000205 RID: 517 RVA: 0x00005304 File Offset: 0x00003504
        public static bool TryGetSwitch(string switchName, out bool isEnabled)
        {
            if (switchName == null)
            {
                throw new ArgumentNullException("switchName");
            }
            if (switchName.Length == 0)
            {
                throw new ArgumentException(Environment.GetResourceString("Argument_EmptyName"), "switchName");
            }
            if (!AppContext.s_defaultsInitialized)
            {
                AppContext.InitializeDefaultSwitchValues();
            }
            isEnabled = false;
            Dictionary <string, AppContext.SwitchValueState> obj = AppContext.s_switchMap;

            lock (obj)
            {
                AppContext.SwitchValueState switchValueState;
                if (AppContext.s_switchMap.TryGetValue(switchName, out switchValueState))
                {
                    if (switchValueState == AppContext.SwitchValueState.UnknownValue)
                    {
                        isEnabled = false;
                        return(false);
                    }
                    isEnabled = ((switchValueState & AppContext.SwitchValueState.HasTrueValue) == AppContext.SwitchValueState.HasTrueValue);
                    if ((switchValueState & AppContext.SwitchValueState.HasLookedForOverride) == AppContext.SwitchValueState.HasLookedForOverride)
                    {
                        return(true);
                    }
                    bool flag2;
                    if (AppContextDefaultValues.TryGetSwitchOverride(switchName, out flag2))
                    {
                        isEnabled = flag2;
                    }
                    AppContext.s_switchMap[switchName] = ((isEnabled ? AppContext.SwitchValueState.HasTrueValue : AppContext.SwitchValueState.HasFalseValue) | AppContext.SwitchValueState.HasLookedForOverride);
                    return(true);
                }
                else
                {
                    bool flag3;
                    if (AppContextDefaultValues.TryGetSwitchOverride(switchName, out flag3))
                    {
                        isEnabled = flag3;
                        AppContext.s_switchMap[switchName] = ((isEnabled ? AppContext.SwitchValueState.HasTrueValue : AppContext.SwitchValueState.HasFalseValue) | AppContext.SwitchValueState.HasLookedForOverride);
                        return(true);
                    }
                    AppContext.s_switchMap[switchName] = AppContext.SwitchValueState.UnknownValue;
                }
            }
            return(false);
        }
        /// <summary>Sets the value of a switch. </summary>
        /// <param name="switchName">The name of the switch. </param>
        /// <param name="isEnabled">The value of the switch. </param>
        /// <exception cref="T:System.ArgumentNullException">
        ///         <paramref name="switchName" /> is <see langword="null" />. </exception>
        /// <exception cref="T:System.ArgumentException">
        ///         <paramref name="switchName" /> is <see cref="F:System.String.Empty" />. </exception>
        // Token: 0x06000206 RID: 518 RVA: 0x00005408 File Offset: 0x00003608
        public static void SetSwitch(string switchName, bool isEnabled)
        {
            if (switchName == null)
            {
                throw new ArgumentNullException("switchName");
            }
            if (switchName.Length == 0)
            {
                throw new ArgumentException(Environment.GetResourceString("Argument_EmptyName"), "switchName");
            }
            if (!AppContext.s_defaultsInitialized)
            {
                AppContext.InitializeDefaultSwitchValues();
            }
            AppContext.SwitchValueState value = (isEnabled ? AppContext.SwitchValueState.HasTrueValue : AppContext.SwitchValueState.HasFalseValue) | AppContext.SwitchValueState.HasLookedForOverride;
            Dictionary <string, AppContext.SwitchValueState> obj = AppContext.s_switchMap;

            lock (obj)
            {
                AppContext.s_switchMap[switchName] = value;
            }
        }