/* ============================================================================== * 功能描述:ConfigUtils * 创 建 者:Garrett * 创建日期:2019/9/16 15:26:04 * ==============================================================================*/ using System; using System.Collections.Generic; using System.Configuration; using System.IO; using System.Linq; using System.Reflection; using System.Text; namespace Update.Config { /// /// ConfigUtils /// class ConfigUtils { /// /// 获取配置文件 /// /// /// public static string GetAppSettingsConfig(string key) { string codeBase = Assembly.GetExecutingAssembly().CodeBase; UriBuilder uri = new UriBuilder(codeBase); string path = Uri.UnescapeDataString(uri.Path); string addString = ConfigurationManager.OpenExeConfiguration(path).AppSettings.Settings[key].Value.ToString(); return addString; } } }