/// <summary>
        /// Retrieve an app setting int value from config.
        /// </summary>
        /// <param name="key">Key to use when retrieving the value.</param>
        /// <returns>App setting value.</returns>
        /// <exception cref="T:ByteDev.Configuration.AppSettings.AppSettingsKeyNotExistException">Config does not contain AppSetting with <paramref name="key" />.</exception>
        /// <exception cref="T:ByteDev.Configuration.UnexpectedConfigValueTypeException">Config value is not of type int.</exception>
        public int GetInt(string key)
        {
            var value = GetString(key);

            return(ConfigValueConverter.GetInt(key, value));
        }
        /// <summary>
        /// Retrieve an app setting bool value from config.
        /// </summary>
        /// <param name="key">Key to use when retrieving the value.</param>
        /// <returns>App setting value.</returns>
        /// <exception cref="T:ByteDev.Configuration.AppSettings.AppSettingsKeyNotExistException">Config does not contain AppSetting with <paramref name="key" />.</exception>
        /// <exception cref="T:ByteDev.Configuration.UnexpectedConfigValueTypeException">Config value is not of type bool.</exception>
        public bool GetBool(string key)
        {
            var value = GetString(key);

            return(ConfigValueConverter.GetBool(key, value));
        }
        /// <summary>
        /// Retrieve an app setting byte value from config.
        /// </summary>
        /// <param name="key">Key to use when retrieving the value.</param>
        /// <returns>App setting value.</returns>
        /// <exception cref="T:ByteDev.Configuration.AppSettings.AppSettingsKeyNotExistException">Config does not contain AppSetting with <paramref name="key" />.</exception>
        /// <exception cref="T:ByteDev.Configuration.UnexpectedConfigValueTypeException">Config value is not of type byte.</exception>
        public byte GetByte(string key)
        {
            var value = GetString(key);

            return(ConfigValueConverter.GetByte(key, value));
        }
        /// <summary>
        /// Retrieve an app setting Guid value from config.
        /// </summary>
        /// <param name="key">Key to use when retrieving the value.</param>
        /// <returns>App setting value.</returns>
        /// <exception cref="T:ByteDev.Configuration.AppSettings.AppSettingsKeyNotExistException">Config does not contain AppSetting with <paramref name="key" />.</exception>
        /// <exception cref="T:ByteDev.Configuration.UnexpectedConfigValueTypeException">Config value is not of type Guid.</exception>
        public Guid GetGuid(string key)
        {
            var value = GetString(key);

            return(ConfigValueConverter.GetGuid(key, value));
        }
        /// <summary>
        /// Retrieve an app setting char value from config.
        /// </summary>
        /// <param name="key">Key to use when retrieving the value.</param>
        /// <returns>App setting value.</returns>
        /// <exception cref="T:ByteDev.Configuration.AppSettings.AppSettingsKeyNotExistException">Config does not contain AppSetting with <paramref name="key" />.</exception>
        /// <exception cref="T:ByteDev.Configuration.UnexpectedConfigValueTypeException">Config value is not of type char.</exception>
        public char GetChar(string key)
        {
            var value = GetString(key);

            return(ConfigValueConverter.GetChar(key, value));
        }
        /// <summary>
        /// Retrieve an app setting decimal value from config.
        /// </summary>
        /// <param name="key">Key to use when retrieving the value.</param>
        /// <returns>App setting value.</returns>
        /// <exception cref="T:ByteDev.Configuration.AppSettings.AppSettingsKeyNotExistException">Config does not contain AppSetting with <paramref name="key" />.</exception>
        /// <exception cref="T:ByteDev.Configuration.UnexpectedConfigValueTypeException">Config value is not of type decimal.</exception>
        public decimal GetDecimal(string key)
        {
            var value = GetString(key);

            return(ConfigValueConverter.GetDecimal(key, value));
        }
        /// <summary>
        /// Retrieve an app setting Uri value from config.
        /// </summary>
        /// <param name="key">Key to use when retrieving the value.</param>
        /// <returns>App setting value.</returns>
        /// <exception cref="T:ByteDev.Configuration.AppSettings.AppSettingsKeyNotExistException">Config does not contain AppSetting with <paramref name="key" />.</exception>
        /// <exception cref="T:ByteDev.Configuration.UnexpectedConfigValueTypeException">Config value is not of type Uri.</exception>
        public Uri GetUri(string key)
        {
            var value = GetString(key);

            return(ConfigValueConverter.GetAbsoluteUri(key, value));
        }
        /// <summary>
        /// Retrieve an app setting float value from config.
        /// </summary>
        /// <param name="key">Key to use when retrieving the value.</param>
        /// <returns>App setting value.</returns>
        /// <exception cref="T:ByteDev.Configuration.AppSettings.AppSettingsKeyNotExistException">Config does not contain AppSetting with <paramref name="key" />.</exception>
        /// <exception cref="T:ByteDev.Configuration.UnexpectedConfigValueTypeException">Config value is not of type float.</exception>
        public float GetFloat(string key)
        {
            var value = GetString(key);

            return(ConfigValueConverter.GetFloat(key, value));
        }
        /// <summary>
        /// Retrieve an app setting double value from config.
        /// </summary>
        /// <param name="key">Key to use when retrieving the value.</param>
        /// <returns>App setting value.</returns>
        /// <exception cref="T:ByteDev.Configuration.AppSettings.AppSettingsKeyNotExistException">Config does not contain AppSetting with <paramref name="key" />.</exception>
        /// <exception cref="T:ByteDev.Configuration.UnexpectedConfigValueTypeException">Config value is not of type double.</exception>
        public double GetDouble(string key)
        {
            var value = GetString(key);

            return(ConfigValueConverter.GetDouble(key, value));
        }
Beispiel #10
0
        /// <summary>
        /// Retrieves a short value.
        /// </summary>
        /// <param name="key">Key to retrieve the value.</param>
        /// <param name="sectionName">Section name to retrieve the value from.</param>
        /// <returns>Config value for the <paramref name="key" />.</returns>
        /// <exception cref="T:ByteDev.Configuration.ConfigSection.ConfigSettingsProviderException">Config section does not exist.</exception>
        /// <exception cref="T:ByteDev.Configuration.ConfigSection.ConfigSettingsProviderException">Key does not exist in the section.</exception>
        /// <exception cref="T:ByteDev.Configuration.UnexpectedConfigValueTypeException">Config value is not of type short.</exception>
        public short GetShort(string key, string sectionName)
        {
            var value = GetString(key, sectionName);

            return(ConfigValueConverter.GetShort(key, value));
        }
        /// <summary>
        /// Retrieve an app setting long value from config.
        /// </summary>
        /// <param name="key">Key to use when retrieving the value.</param>
        /// <returns>App setting value.</returns>
        /// <exception cref="T:ByteDev.Configuration.AppSettings.AppSettingsKeyNotExistException">Config does not contain AppSetting with <paramref name="key" />.</exception>
        /// <exception cref="T:ByteDev.Configuration.UnexpectedConfigValueTypeException">Config value is not of type long.</exception>
        public long GetLong(string key)
        {
            var value = GetString(key);

            return(ConfigValueConverter.GetLong(key, value));
        }
Beispiel #12
0
        /// <summary>
        /// Retrieves a byte value.
        /// </summary>
        /// <param name="key">Key to retrieve the value.</param>
        /// <param name="sectionName">Section name to retrieve the value from.</param>
        /// <returns>Config value for the <paramref name="key" />.</returns>
        /// <exception cref="T:ByteDev.Configuration.ConfigSection.ConfigSettingsProviderException">Config section does not exist.</exception>
        /// <exception cref="T:ByteDev.Configuration.ConfigSection.ConfigSettingsProviderException">Key does not exist in the section.</exception>
        /// <exception cref="T:ByteDev.Configuration.UnexpectedConfigValueTypeException">Config value is not of type byte.</exception>
        public byte GetByte(string key, string sectionName)
        {
            var value = GetString(key, sectionName);

            return(ConfigValueConverter.GetByte(key, value));
        }
Beispiel #13
0
        /// <summary>
        /// Retrieves a char value.
        /// </summary>
        /// <param name="key">Key to retrieve the value.</param>
        /// <param name="sectionName">Section name to retrieve the value from.</param>
        /// <returns>Config value for the <paramref name="key" />.</returns>
        /// <exception cref="T:ByteDev.Configuration.ConfigSection.ConfigSettingsProviderException">Config section does not exist.</exception>
        /// <exception cref="T:ByteDev.Configuration.ConfigSection.ConfigSettingsProviderException">Key does not exist in the section.</exception>
        /// <exception cref="T:ByteDev.Configuration.UnexpectedConfigValueTypeException">Config value is not of type char.</exception>
        public char GetChar(string key, string sectionName)
        {
            var value = GetString(key, sectionName);

            return(ConfigValueConverter.GetChar(key, value));
        }
Beispiel #14
0
        /// <summary>
        /// Retrieves a Guid value.
        /// </summary>
        /// <param name="key">Key to retrieve the value.</param>
        /// <param name="sectionName">Section name to retrieve the value from.</param>
        /// <returns>Config value for the <paramref name="key" />.</returns>
        /// <exception cref="T:ByteDev.Configuration.ConfigSection.ConfigSettingsProviderException">Config section does not exist.</exception>
        /// <exception cref="T:ByteDev.Configuration.ConfigSection.ConfigSettingsProviderException">Key does not exist in the section.</exception>
        /// <exception cref="T:ByteDev.Configuration.UnexpectedConfigValueTypeException">Config value is not of type Guid.</exception>
        public Guid GetGuid(string key, string sectionName)
        {
            var value = GetString(key, sectionName);

            return(ConfigValueConverter.GetGuid(key, value));
        }
Beispiel #15
0
        /// <summary>
        /// Retrieves a decimal value.
        /// </summary>
        /// <param name="key">Key to retrieve the value.</param>
        /// <param name="sectionName">Section name to retrieve the value from.</param>
        /// <returns>Config value for the <paramref name="key" />.</returns>
        /// <exception cref="T:ByteDev.Configuration.ConfigSection.ConfigSettingsProviderException">Config section does not exist.</exception>
        /// <exception cref="T:ByteDev.Configuration.ConfigSection.ConfigSettingsProviderException">Key does not exist in the section.</exception>
        /// <exception cref="T:ByteDev.Configuration.UnexpectedConfigValueTypeException">Config value is not of type decimal.</exception>
        public decimal GetDecimal(string key, string sectionName)
        {
            var value = GetString(key, sectionName);

            return(ConfigValueConverter.GetDecimal(key, value));
        }
Beispiel #16
0
        /// <summary>
        /// Retrieves a long value.
        /// </summary>
        /// <param name="key">Key to retrieve the value.</param>
        /// <param name="sectionName">Section name to retrieve the value from.</param>
        /// <returns>Config value for the <paramref name="key" />.</returns>
        /// <exception cref="T:ByteDev.Configuration.ConfigSection.ConfigSettingsProviderException">Config section does not exist.</exception>
        /// <exception cref="T:ByteDev.Configuration.ConfigSection.ConfigSettingsProviderException">Key does not exist in the section.</exception>
        /// <exception cref="T:ByteDev.Configuration.UnexpectedConfigValueTypeException">Config value is not of type long.</exception>
        public long GetLong(string key, string sectionName)
        {
            var value = GetString(key, sectionName);

            return(ConfigValueConverter.GetLong(key, value));
        }