using Ems.CollectService.Common; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Ems.CollectService.Entity.config { public sealed class AppConfig { private static readonly Lazy lazy = new Lazy(() => new AppConfig()); private static StringChange stringChange = StringChange.Instance; public static AppConfig Instance { get { return lazy.Value; } } private AppConfig() { } private static INIFile iNIFile = new INIFile(System.Environment.CurrentDirectory + "/config/App.InI"); /// /// 监听端口 /// public int listenerPort { get { return stringChange.ParseToInt(iNIFile.IniReadValue("SystemConfig", "listenerPort")); } set { iNIFile.IniWriteValue("SystemConfig", "listenerPort", value.ToString()); } } /// /// Mysql地址 /// public string mysqlStr { get { return iNIFile.IniReadValue("SystemConfig", "mysqlConnStr"); } set { iNIFile.IniWriteValue("SystemConfig", "mysqlConnStr", value.ToString()); } } public decimal virtualValue { get { return Convert.ToDecimal(iNIFile.IniReadValue("SystemConfig", "virtualValue")); } set { iNIFile.IniWriteValue("SystemConfig", "virtualValue", value.ToString()); } } public bool virtualFlag { get { return iNIFile.IniReadValue("SystemConfig", "virtualFlag") == "是" ? true : false; } set { iNIFile.IniWriteValue("SystemConfig", "virtualFlag", value == true ? "是" : "否"); } } } }