Example #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));
        }
Example #2
0
 public static string GetCurrentActiveBypassProxy()
 {
     return(WinInetInterop.GetBypassProxy());
 }
Example #3
0
 public static string GetCurrentActiveProxyServerURLs()
 {
     return(WinInetInterop.GetProxyServerURL());
 }
Example #4
0
 public static string GetCurrentActiveAutoConfigURL()
 {
     return(WinInetInterop.GetAutoConfigURL());
 }
Example #5
0
 public static bool AnyCurrentActiveProxySet()
 {
     return(WinInetInterop.IsAnyProxy());
 }
Example #6
0
 public static bool GetCurrentActiveAutoConfigProxy()
 {
     return(WinInetInterop.IsAutoConfigProxy());
 }
Example #7
0
 public static void ModifyCurrentActiveAutoConfigProxyURL(string autoConfigURL)
 {
     WinInetInterop.SetAutoConfigURL(autoConfigURL);
 }
Example #8
0
 public static void ModifyCurrentActiveAutoConfigProxy(bool newValue)
 {
     WinInetInterop.SwitchAutoConfigProxy(newValue);
 }
Example #9
0
 public static bool GetCurrentActiveUseProxy()
 {
     return(WinInetInterop.IsUseProxy());
 }
Example #10
0
 public static void ModifyCurrentActiveUseProxy(bool newValue)
 {
     WinInetInterop.SwitchUseProxy(newValue);
 }
Example #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);
 }