You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
928 B
31 lines
928 B
using System.Configuration; |
|
|
|
namespace SparkClient.Model.Helper; |
|
|
|
public class ConfigurationHelper |
|
{ |
|
static System.Configuration.Configuration config = System.Configuration.ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); |
|
/// <summary> |
|
/// 读取配置Key |
|
/// </summary> |
|
/// <param name="key"></param> |
|
/// <returns></returns> |
|
public static string ReadConfigValue(string key) |
|
{ |
|
|
|
string name = config.AppSettings.Settings[key].Value; |
|
|
|
return name; |
|
} |
|
/// <summary> |
|
/// 写入配置 |
|
/// </summary> |
|
/// <param name="key"></param> |
|
/// <param name="value"></param> |
|
public static void SetConfigValue(string key, string value) |
|
{ |
|
config.AppSettings.Settings[key].Value = value; |
|
config.Save(ConfigurationSaveMode.Modified); |
|
System.Configuration.ConfigurationManager.RefreshSection("appSettings"); |
|
} |
|
} |