예제 #1
0
 /// <summary>
 /// Returns a boolean value from the INI section.
 /// </summary>
 /// <param name="key">The name of the INI key.</param>
 /// <param name="defaultValue">The value to return if the section or key wasn't found,
 /// or converting the key's value to a boolean failed.</param>
 /// <returns>The given key's value if the section and key was found and
 /// the value is a valid boolean. Otherwise the given defaultValue.</returns>
 public bool GetBooleanValue(string key, bool defaultValue)
 {
     return Conversions.BooleanFromString(GetStringValue(key, String.Empty), defaultValue);
 }
예제 #2
0
 /// <summary>
 /// Returns a single-precision floating point value from the INI section.
 /// </summary>
 /// <param name="key">The name of the INI key.</param>
 /// <param name="defaultValue">The value to return if the section or key wasn't found,
 /// or converting the key's value to a float failed.</param>
 /// <returns>The given key's value if the section and key was found and
 /// the value is a valid float. Otherwise the given defaultValue.</returns>
 public float GetSingleValue(string key, float defaultValue)
 {
     return Conversions.FloatFromString(GetStringValue(key, String.Empty), defaultValue);
 }
예제 #3
0
 /// <summary>
 /// Returns an integer value from the INI section.
 /// </summary>
 /// <param name="key">The name of the INI key.</param>
 /// <param name="defaultValue">The value to return if the section or key wasn't found,
 /// or converting the key's value to an integer failed.</param>
 /// <returns>The given key's value if the section and key was found and
 /// the value is a valid integer. Otherwise the given defaultValue.</returns>
 public int GetIntValue(string key, int defaultValue)
 {
     return Conversions.IntFromString(GetStringValue(key, string.Empty), defaultValue);
 }
예제 #4
0
 /// <summary>
 /// Returns a double-precision floating point value from the INI section.
 /// </summary>
 /// <param name="key">The name of the INI key.</param>
 /// <param name="defaultValue">The value to return if the section or key wasn't found,
 /// or converting the key's value to a double failed.</param>
 /// <returns>The given key's value if the section and key was found and
 /// the value is a valid double. Otherwise the given defaultValue.</returns>
 public double GetDoubleValue(string key, double defaultValue)
 {
     return Conversions.DoubleFromString(GetStringValue(key, string.Empty), defaultValue);
 }
예제 #5
0
 /// <summary>
 /// Returns an integer value from the INI file.
 /// </summary>
 /// <param name="section">The name of the key's section.</param>
 /// <param name="key">The name of the INI key.</param>
 /// <param name="defaultValue">The value to return if the section or key wasn't found,
 /// or converting the key's value to an integer failed.</param>
 /// <returns>The given key's value if the section and key was found and
 /// the value is a valid integer. Otherwise the given defaultValue.</returns>
 public int GetIntValue(string section, string key, int defaultValue)
 {
     return Conversions.IntFromString(GetStringValue(section, key, null), defaultValue);
 }