public void Aus() { TimeSpan tsTmp = DateTime.Now - tmpTime; Ts = Ts.Add(tsTmp); Log += "\nEnde um " + DateTime.Now.ToShortTimeString(); Log += "\n=> " + GetFormat(tsTmp); }
/// <summary> /// 初始化配置Anno.config /// </summary> public static void InitConfig() { #region 配置初始化 XmlDocument xml = GetXmlDocument(); XmlNode local = xml.SelectSingleNode("//Port"); Local.Port = Convert.ToInt32(NodeText("Port")); //Local.IpAddress = local.Attributes["Ip"].Value; Weight = Convert.ToInt32(NodeText("Weight")); AppName = NodeText("AppName"); FuncName = NodeText("FuncName"); if (long.TryParse(NodeText("TimeOut"), out long timeOut)) { TimeOut = timeOut; } else { TimeOut = 10000; } XmlNodeList _Ts = xml.SelectNodes("//Ts"); #region 需要忽略的 插件 var ignoreFunc = NodeText("IgnoreFuncName"); ignoreFunc.Split(',').ToList().ForEach(item => { if (!string.IsNullOrWhiteSpace(item)) { IgnoreFuncNames.Add(item.ToUpper()); } }); #endregion foreach (XmlNode ts in _Ts) { Target target = new Target { IpAddress = ts.Attributes["Ip"].Value, Port = Convert.ToInt32(ts.Attributes["Port"].Value) }; Ts.Add(target); } //通过Anno.config 初始化AppSettings InitConstAppSettings(xml); //根据 SettingService.FuncName 加载服务集合 Assemblys.InitAssembly(); Assemblys.AddPlugsAssembly(); CustomConfiguration.InitConst(xml); #endregion #region 初始化 ID生成器 var idWorker = NodeText("IdWorker"); if (!string.IsNullOrWhiteSpace(idWorker)) { var wd = idWorker.Split(','); if (wd.Length == 2) { long.TryParse(wd[0], out long worker); long.TryParse(wd[1], out long datacenter); WorkerId = worker; DatacenterId = datacenter; } } #endregion }
/// <summary> /// Добавление кредита /// </summary> /// <param name="newT"></param> public void Add(T newT) { Ts.Add(newT); }