using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.IO; using System.Configuration; namespace HXX.Scanner.Biz { /// /// 配置文件Settings.Default操作类 /// public class config_manager { /// /// 本地配置文件 /// private static ApplicationSettingsBase config { get; set; } /// /// 初始化配置文件 /// /// public static void Init(ApplicationSettingsBase _config) { config = _config; } /// /// 获取配置信息 /// /// /// public static string Get(string key) { string value = null; var item = config.Properties[key]; if (item != null) { var obj = config[key]; if (obj != null) { value = obj.ToString(); } } return value; } /// /// 设置配置信息 /// /// /// /// public static bool Set(string key, string value) { bool result = false; var item = config.Properties[key]; if (item != null) { config[key] = value; config.Save(); result = true; } return result; } } }