/// <summary> /// 设置内置浏览器代理 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void tsmiInnerBrowser_Click(object sender, EventArgs e) { try { AutoSwitchingHelper.StartBrowserProxy(GetProxyInfo(false)); } catch (Exception ex) { MsgBox.ShowExceptionMessage(ex); } }
private void btnOK_Click(object sender, EventArgs e) { if (chbEnable.Checked) { string proxy = txtProxy.Text.Trim(); var regex = new Regex( @"(?<Proxy>(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9])\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[0-9]))\:(?<Port>\d{1,5})"); MatchCollection matchs = regex.Matches(proxy); if (matchs.Count == 1) { AutoSwitchingHelper.StartBrowserProxy(proxy); } } else { AutoSwitchingHelper.StartBrowserProxy(""); } Close(); }