|
|
@ -1,9 +1,6 @@
|
|
|
|
using Ems.CollectService.Common;
|
|
|
|
using Ems.CollectService.Common;
|
|
|
|
using System;
|
|
|
|
using System;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using Microsoft.Extensions.Configuration;
|
|
|
|
using System.Linq;
|
|
|
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace Ems.CollectService.Entity.config
|
|
|
|
namespace Ems.CollectService.Entity.config
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -12,10 +9,6 @@ namespace Ems.CollectService.Entity.config
|
|
|
|
|
|
|
|
|
|
|
|
private static readonly Lazy<AppConfig> lazy = new Lazy<AppConfig>(() => new AppConfig());
|
|
|
|
private static readonly Lazy<AppConfig> lazy = new Lazy<AppConfig>(() => new AppConfig());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static StringChange stringChange = StringChange.Instance;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static AppConfig Instance
|
|
|
|
public static AppConfig Instance
|
|
|
|
{
|
|
|
|
{
|
|
|
|
get
|
|
|
|
get
|
|
|
@ -24,17 +17,18 @@ namespace Ems.CollectService.Entity.config
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private AppConfig() { }
|
|
|
|
private IConfiguration _configuration = new ConfigurationBuilder().SetBasePath(Environment.CurrentDirectory)
|
|
|
|
|
|
|
|
.AddJsonFile("App.json").Build();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private AppConfig() {}
|
|
|
|
|
|
|
|
|
|
|
|
private static INIFile iNIFile = new INIFile(System.Environment.CurrentDirectory + "/config/App.InI");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// 监听端口
|
|
|
|
/// 监听端口
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
public int listenerPort
|
|
|
|
public int listenerPort
|
|
|
|
{
|
|
|
|
{
|
|
|
|
get { return stringChange.ParseToInt(iNIFile.IniReadValue("SystemConfig", "listenerPort")); }
|
|
|
|
get { return _configuration.GetValue<int>("SystemConfig:listenerPort"); }
|
|
|
|
set { iNIFile.IniWriteValue("SystemConfig", "listenerPort", value.ToString()); }
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
@ -42,20 +36,42 @@ namespace Ems.CollectService.Entity.config
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
public string mysqlStr
|
|
|
|
public string mysqlStr
|
|
|
|
{
|
|
|
|
{
|
|
|
|
get { return iNIFile.IniReadValue("SystemConfig", "mysqlConnStr"); }
|
|
|
|
get
|
|
|
|
set { iNIFile.IniWriteValue("SystemConfig", "mysqlConnStr", value.ToString()); }
|
|
|
|
{
|
|
|
|
|
|
|
|
return _configuration.GetValue<string>("SystemConfig:mysqlConnStr");
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// 将FFFF虚拟赋值进行过滤
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
public decimal virtualValue
|
|
|
|
public decimal virtualValue
|
|
|
|
{
|
|
|
|
{
|
|
|
|
get { return Convert.ToDecimal(iNIFile.IniReadValue("SystemConfig", "virtualValue")); }
|
|
|
|
get { return _configuration.GetValue<decimal>("SystemConfig:virtualValue"); }
|
|
|
|
set { iNIFile.IniWriteValue("SystemConfig", "virtualValue", value.ToString()); }
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// 是否启用FFFF过滤
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
public bool virtualFlag
|
|
|
|
public bool virtualFlag
|
|
|
|
{
|
|
|
|
{
|
|
|
|
get { return iNIFile.IniReadValue("SystemConfig", "virtualFlag") == "是" ? true : false; }
|
|
|
|
get { return _configuration.GetValue<string>("SystemConfig:virtualFlag") == "是" ? true : false;}
|
|
|
|
set { iNIFile.IniWriteValue("SystemConfig", "virtualFlag", value == true ? "是" : "否"); }
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// 日志文件路径
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
public string logFilePath
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
get { return _configuration.GetValue<string>("SystemConfig:logFilePath"); }
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// 日志删除周期
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
public long deleteLogTimer
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
get { return _configuration.GetValue<long>("SystemConfig:deleteLogTimer"); }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|