/// <summary> /// 网络速度测试 /// </summary> public void MonitorNetSpeed() { Double.TryParse(XMLconfigReader.getValbyName(_configPath, CInternetSpeed1), out _InnerSpeed1); Double.TryParse(XMLconfigReader.getValbyName(_configPath, CInternetSpeed2), out _InnerSpeed2); _monitor = new NetworkMonitor(); //_monitor.NetworkSpeedChange += new NetworkMonitor.NetworkAdapterRefreshHandle(monitor_NetworkSpeedChange); string strAdapter = GetActivatedAdapter(); if (strAdapter != null && strAdapter != String.Empty) { strAdapter = strAdapter.Substring(strAdapter.IndexOf(')') + 1, strAdapter.Length - strAdapter.IndexOf(')') - 1); strAdapter.Trim(); } foreach (NetworkAdapter adapter in _monitor.Adapters) { string temp = adapter.Name; temp = temp.Substring(temp.IndexOf(']') + 1, temp.Length - temp.IndexOf(']') - 1); temp.Trim(); if (temp.Equals(strAdapter)) { _curAdapter = adapter;//得到当前的网络Adapter _monitor.StopMonitoring(); _monitor.StartMonitoring(adapter); } } }
/// <summary> /// 获取外网地址、目标地址 /// </summary> private void GetTrustWebSite() { string strWebsite1 = XMLconfigReader.getValbyName(_configPath, CTrustWebsite); string strWebsite2 = XMLconfigReader.getValbyName(_configPath, CTrustWebsite2); _strWeb1s = strWebsite1.Split(new char[] { ',' }); _strWeb2s = strWebsite2.Split(new char[] { ',' }); }
/// <summary> /// 修复Citrix /// </summary> /// <param name="url"> /// String.Empty或null:citrix.com默认的下载地址; /// 其他值:自己保存的http地址 /// </param> public void CitrixRep(string url) { XMLconfigReader xMLconfigReader = new XMLconfigReader(); if (url == null || url == String.Empty) { url = xMLconfigReader.CitrixUrl; } // url = "https://downloadplugins.citrix.com/Windows/CitrixReceiver.exe"; //判断Citrix是否已经安装 bool isExisted = CkCitrix.CheckCitrix(); if (!isExisted) { //保存到目录 string fullPath = Application.StartupPath + "//CitrixReciver.exe"; if (File.Exists(fullPath)) { MessageBox.Show("已下载安装包,即将开始安装"); System.Diagnostics.Process.Start(fullPath); } else { try { MessageBox.Show("即将开始下载,请耐心等待"); bool flag = Download(url, fullPath); if (flag) { MessageBox.Show("下载完成,即将开始安装"); System.Diagnostics.Process.Start(fullPath); } } catch { MessageBox.Show("网络异常,下载失败"); } } } }