示例#1
0
        public bool SetAsCurrentProxy()
        {
            StringBuilder proxyString = new StringBuilder();

            if (!string.IsNullOrEmpty(UseProxyServerAddress))
            {
                buildProxyString(proxyString, "", UseProxyServerAddress, UseProxyServerPort);
            }
            else
            {
                if (!string.IsNullOrEmpty(HTTPProxyAddress))
                {
                    buildProxyString(proxyString, "http", HTTPProxyAddress, HTTPProxyPort);
                }
                if (!UseSameProxyServerForAllProtocols)
                {
                    if (!string.IsNullOrEmpty(SecureProxyAddress))
                    {
                        buildProxyString(proxyString, "https", SecureProxyAddress, SecureProxyPort);
                    }
                    if (!string.IsNullOrEmpty(FTPProxyAddress))
                    {
                        buildProxyString(proxyString, "ftp", FTPProxyAddress, FTPProxyPort);
                    }
                    if (!string.IsNullOrEmpty(GopherProxyAddress))
                    {
                        buildProxyString(proxyString, "gopher", GopherProxyAddress, GopherProxyPort);
                    }
                    if (!string.IsNullOrEmpty(SocksProxyAddress))
                    {
                        buildProxyString(proxyString, "socks", SocksProxyAddress, SocksProxyPort);
                    }
                }
            }

            string excludeAddress = this.ExcludeAddressesFromProxy;

            if (BypassProxyForLocalAddress)
            {
                excludeAddress += ";<local>";
            }

            return(WinInetInterop.SetInternetProxy(this.UseProxyServer, proxyString.ToString(), excludeAddress,
                                                   this.AutoDetectSettings, this.UseAutoConfigureScript, this.UseAutoConfigureScriptAddress));
        }
示例#2
0
 public static string GetCurrentActiveBypassProxy()
 {
     return(WinInetInterop.GetBypassProxy());
 }
示例#3
0
 public static string GetCurrentActiveProxyServerURLs()
 {
     return(WinInetInterop.GetProxyServerURL());
 }
示例#4
0
 public static string GetCurrentActiveAutoConfigURL()
 {
     return(WinInetInterop.GetAutoConfigURL());
 }
示例#5
0
 public static bool AnyCurrentActiveProxySet()
 {
     return(WinInetInterop.IsAnyProxy());
 }
示例#6
0
 public static bool GetCurrentActiveAutoConfigProxy()
 {
     return(WinInetInterop.IsAutoConfigProxy());
 }
示例#7
0
 public static void ModifyCurrentActiveAutoConfigProxyURL(string autoConfigURL)
 {
     WinInetInterop.SetAutoConfigURL(autoConfigURL);
 }
示例#8
0
 public static void ModifyCurrentActiveAutoConfigProxy(bool newValue)
 {
     WinInetInterop.SwitchAutoConfigProxy(newValue);
 }
示例#9
0
 public static bool GetCurrentActiveUseProxy()
 {
     return(WinInetInterop.IsUseProxy());
 }
示例#10
0
 public static void ModifyCurrentActiveUseProxy(bool newValue)
 {
     WinInetInterop.SwitchUseProxy(newValue);
 }
示例#11
0
 /// <summary>
 /// Handles the Click event of the InternetSettingsToolStripMenuItem control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
 private void InternetSettingsToolStripMenuItem_Click(object sender, EventArgs e)
 {
     WinInetInterop.DisplayInternetControlPanel(this.Handle);
 }