AddonHelper.Addon.GetProxy C# (CSharp) Метод

GetProxy() публичный Метод

Get a WebProxy object from the global proxy settings in the ClipUpload application
public GetProxy ( ) : WebProxy
Результат System.Net.WebProxy
        public WebProxy GetProxy()
        {
            if (appSettings.GetBool("ProxyEnabled")) {
                string hostName = appSettings.GetString("ProxyHost");
                int hostPort = appSettings.GetInt("ProxyPort");

                WebProxy ret = new WebProxy(hostName, hostPort);

                string credentialsUsername = appSettings.GetString("ProxyUsername");
                string credentialsPassword = appSettings.GetString("ProxyPassword");

                if (credentialsUsername != "" || credentialsPassword != "") {
                    ret.Credentials = new NetworkCredential(credentialsUsername, credentialsPassword);
                } else {
                    ret.UseDefaultCredentials = true;
                }

                return ret;
            } else
                return null;
        }