/// <summary> /// Returns a config value as a string /// </summary> /// <param name="Section">The ini section of this setting</param> /// <param name="Key">The setting name</param> /// <returns></returns> public static string GetValue(string Section, string Key) { StringBuilder Value = new StringBuilder(1024); Config.GetPrivateProfileString(Section, Key, "", Value, 1024, IniLocation); return(Value.ToString()); }
/// <summary> /// Returns a config value as the Type indicated /// </summary> /// <typeparam name="T">The value type (IE: String, Int, Bool)</typeparam> /// <param name="Section">The ini section of this setting</param> /// <param name="Key">The setting name</param> /// <returns></returns> public static T GetType <T>(string Section, string Key) where T : IConvertible { StringBuilder Value = new StringBuilder(1024); Config.GetPrivateProfileString(Section, Key, "", Value, 1024, IniLocation); return((T)Convert.ChangeType(Value.ToString(), typeof(T), CultureInfo.InvariantCulture)); }