private ConfigurationUserLevel GetUserLevel(string configPath)
        {
            ConfigurationUserLevel level;

            switch (ConfigPathUtility.GetName(configPath))
            {
            case MachineConfigName:
                level = ConfigurationUserLevel.None;
                break;

            case ExeConfigName:
                level = ConfigurationUserLevel.None;
                break;

            case LocalUserConfigName:
                level = ConfigurationUserLevel.PerUserRoamingAndLocal;
                break;

            case RoamingUserConfigName:
                level = ConfigurationUserLevel.PerUserRoaming;
                break;

            default:
                Debug.Fail("unrecognized configPath " + configPath);
                level = ConfigurationUserLevel.None;
                break;
            }

            return(level);
        }
        public override string GetStreamName(string configPath)
        {
            string name = base.GetStreamName(configPath);

            if (ConfigPathUtility.GetName(configPath) == ClientConfigurationHost.MachineConfigName &&
                (_fileMap?.IsMachinePathDefault ?? true))
            {
                // The machine config was asked for and wasn't explicitly
                // specified, stash the "default" machine.config path
                _machineStreamName = name;
            }

            return(name);
        }
        // stream support
        public override string GetStreamName(string configPath)
        {
            string configName = ConfigPathUtility.GetName(configPath);

            if (_fileMap != null)
            {
                switch (configName)
                {
                default:
                    // should never get here
                    goto case MachineConfigName;

                case MachineConfigName:
                    return(_fileMap.MachineConfigFilename);

                case ExeConfigName:
                    return(_fileMap.ExeConfigFilename);

                case RoamingUserConfigName:
                    return(_fileMap.RoamingUserConfigFilename);

                case LocalUserConfigName:
                    return(_fileMap.LocalUserConfigFilename);
                }
            }
            else
            {
                switch (configName)
                {
                default:
                    // should never get here
                    goto case MachineConfigName;

                case MachineConfigName:
                    return(MachineConfigFilePath);

                case ExeConfigName:
                    return(ConfigPaths.ApplicationConfigUri);

                case RoamingUserConfigName:
                    return(ConfigPaths.RoamingConfigFilename);

                case LocalUserConfigName:
                    return(ConfigPaths.LocalConfigFilename);
                }
            }
        }
        private ConfigurationUserLevel GetUserLevel(string configPath)
        {
            switch (ConfigPathUtility.GetName(configPath))
            {
            case "MACHINE":
                return(ConfigurationUserLevel.None);

            case "EXE":
                return(ConfigurationUserLevel.None);

            case "LOCAL_USER":
                return(ConfigurationUserLevel.PerUserRoamingAndLocal);

            case "ROAMING_USER":
                return(ConfigurationUserLevel.PerUserRoaming);
            }
            return(ConfigurationUserLevel.None);
        }
        public override string GetStreamName(string configPath)
        {
            string str3;
            string name = ConfigPathUtility.GetName(configPath);

            if (this._fileMap != null)
            {
                string str2;
                if (((str2 = name) != null) && !(str2 == "MACHINE"))
                {
                    if (str2 == "EXE")
                    {
                        return(this._fileMap.ExeConfigFilename);
                    }
                    if (str2 == "ROAMING_USER")
                    {
                        return(this._fileMap.RoamingUserConfigFilename);
                    }
                    if (str2 == "LOCAL_USER")
                    {
                        return(this._fileMap.LocalUserConfigFilename);
                    }
                }
                return(this._fileMap.MachineConfigFilename);
            }
            if (((str3 = name) != null) && !(str3 == "MACHINE"))
            {
                if (str3 == "EXE")
                {
                    return(this.ConfigPaths.ApplicationConfigUri);
                }
                if (str3 == "ROAMING_USER")
                {
                    return(this.ConfigPaths.RoamingConfigFilename);
                }
                if (str3 == "LOCAL_USER")
                {
                    return(this.ConfigPaths.LocalConfigFilename);
                }
            }
            return(MachineConfigFilePath);
        }
        public override bool IsConfigRecordRequired(string configPath)
        {
            switch (ConfigPathUtility.GetName(configPath))
            {
            case "MACHINE":
            case "EXE":
                return(true);

            case "ROAMING_USER":
                if (!this.HasRoamingConfig)
                {
                    return(this.HasLocalConfig);
                }
                return(true);

            case "LOCAL_USER":
                return(this.HasLocalConfig);
            }
            return(false);
        }
        // config path support
        public override bool IsConfigRecordRequired(string configPath)
        {
            string configName = ConfigPathUtility.GetName(configPath);

            switch (configName)
            {
            default:
                // should never get here
                return(false);

            case MachineConfigName:
            case ExeConfigName:
                return(true);

            case RoamingUserConfigName:
                // Makes the design easier even if we only have an empty Roaming config record.
                return(HasRoamingConfig || HasLocalConfig);

            case LocalUserConfigName:
                return(HasLocalConfig);
            }
        }
        public override string GetStreamName(string configPath)
        {
            string configName = ConfigPathUtility.GetName(configPath);

            switch (configName)
            {
            case MachineConfigName:
                return(_fileMap?.MachineConfigFilename ?? MachineConfigFilePath);

            case ExeConfigName:
                return(_fileMap?.ExeConfigFilename ?? ConfigPaths.ApplicationConfigUri);

            case RoamingUserConfigName:
                return(_fileMap?.RoamingUserConfigFilename ?? ConfigPaths.RoamingConfigFilename);

            case LocalUserConfigName:
                return(_fileMap?.LocalUserConfigFilename ?? ConfigPaths.LocalConfigFilename);

            default:
                // should never get here
                Debug.Fail("unexpected config name: " + configName);
                goto case MachineConfigName;
            }
        }