/// <summary> /// 更新云服务器信息 /// </summary> private void UpdateCloudProxyList() { TimeSpan ts = DateTime.Now - Config.LateUpdateProxyListTime; if (_isUpdated && ts.TotalSeconds > 30) { _isUpdated = false; var cloudHelper = new CloudHelper(); var list = (from p in ProxyData.ProxyList where p.status == 0 select p).ToList(); var updateList = new List <ProxyServer>(); foreach (var item in from item in list let cloudModel = CloudProxyData.Get(item.proxy, item.port) where null != cloudModel where updateList.FirstOrDefault(p => p.proxy == item.proxy && p.port == item.port) == null select item) { updateList.Add(item); //云端存在且无法连接的数据 } updateList = (from p in ProxyData.ProxyList where p.status == 1 select p).Union(updateList).Distinct().ToList(); cloudHelper.UploadProxyList(updateList); Config.MainForm.ConnectCloud(); _isUpdated = true; } }
/// <summary> /// 更新云服务器信息 /// </summary> public void RefreshCloud() { if (ProxyData.ProxyList != null && ProxyData.ProxyList.Count > 0) { var cloudHelper = new CloudHelper(); cloudHelper.UploadProxyList(ProxyData.ProxyList); ConnectCloud(); } }