public static RegProxy GetCurrentProxy() { RegistryKey registry = Registry.CurrentUser.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings", true); bool en = (int)registry.GetValue("ProxyEnable") == 1 ? true : false; string proxy = (string)registry.GetValue("ProxyServer"); return(RegProxy.ParseProxyString(proxy ?? "", en)); }
private void toolStripMenuItem1_Click(object sender, EventArgs e) { var proxy = RegProxy.ParseProxyString(ui_SpecProxy.Text, true); if (!string.IsNullOrEmpty(proxy.IP)) { var infos = Functions.GetProxyInfos(proxy); if (infos != null) { Functions.SetProxy(proxy); } else { MessageBox.Show("Proxy down", "Proxy Me", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show("Malformed Proxy host & ip", "Proxy Me", MessageBoxButtons.OK, MessageBoxIcon.Error); } }