using CsharpHttpHelper; using Server.Configs; using Server.MyClass.Caches; using Server.MyClass.Class; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Server { internal class Config { public int Port { get; set; } public string Appsecret { get; set; } public string MysqlName { get; set; } public string MysqlUser { get; set; } public string MysqlPass { get; set; } public string MysqlHost { get; set; } public int MysqlPort { get; set; } public RuntimeCache RuntimeCache { get; set; } public IniHelper Ini { get; private set; } = new IniHelper(HttpExtend.MapFile("配置.ini","Config")); public Config() { Port = string.IsNullOrEmpty(Ini.GetValue("终端", "端口")) ? 80 : int.Parse(Ini.GetValue("终端", "端口")); Appsecret = Ini.GetValue("终端", "密钥"); if (string.IsNullOrEmpty(Appsecret)) { Appsecret = HttpExtend.GetMD5String(Guid.NewGuid().ToString()); Ini.SetValue("终端", "密钥", Appsecret); Ini.SetValue("终端", "端口", Port.ToString()); } MysqlName = Ini.GetValue("Mysql", "名称"); MysqlUser = Ini.GetValue("Mysql", "账号"); MysqlPass = Ini.GetValue("Mysql", "密码"); MysqlHost = Ini.GetValue("Mysql", "IP"); MysqlPort = string.IsNullOrEmpty(Ini.GetValue("Mysql", "端口")) ? 3306 : int.Parse(Ini.GetValue("Mysql", "端口")); } } }