private WebProxy GetProxy()
{
var proxyUri = Settings.Instance.Global_Update_ProxyUri;
if (!string.IsNullOrWhiteSpace(proxyUri))
{
string proxyScheme = null;
string proxyHost = null;
int proxyPort = -1;
{
var regex = new Regex(@"(.*?):(.*):(\d*)");
var match = regex.Match(proxyUri);
if (match.Success)
{
proxyScheme = match.Groups[1].Value;
proxyHost = match.Groups[2].Value;
proxyPort = int.Parse(match.Groups[3].Value);
}
else
{
var regex2 = new Regex(@"(.*?):(.*)");
var match2 = regex2.Match(proxyUri);
if (match2.Success)
{
proxyScheme = match2.Groups[1].Value;
proxyHost = match2.Groups[2].Value;
proxyPort = 80;
}
}
}
return new WebProxy(proxyHost, proxyPort);
}
return null;
}