/// <summary> /// 向列表中添加其他主机列表 /// </summary> /// <param name="hostlist">要添加的主机列表</param> public void Add(HostList hostlist) { if (hostlist == null) return; for (int i = 0; i < hostlist.Count; i++) Add(hostlist[i]); }
/// <summary> /// 配置初始化 /// </summary> public static void Initialize() { //port = Convert.ToInt32(fxApp.fxDISTRIBUTIONPORT); useUDPToGetHosts = true; groups = new string[] { "g1" }; timeout = 2000; try { //initial } catch { staticHostList = new HostList(); } timer = new Timer(30000); timer.Elapsed += new ElapsedEventHandler(timer_Elapsed); ifChanged = false; }
/// <summary> /// 从Xml格式的字符串生成HostList对象 /// </summary> /// <param name="data">Xml格式的字符串</param> /// <returns>生成的HostList对象</returns> public static HostList FromXml(string data) { HostList res = new HostList(); XElement xe = XElement.Parse(data); foreach (XElement c in xe.Elements()) res.Add(ResHost.FromXml(c)); return res; }