更新订阅时,支持当前的代理连接。

This commit is contained in:
zungmou 2019-12-06 17:16:00 +08:00
parent fe15fde594
commit 23f8533547
2 changed files with 16 additions and 2 deletions

View file

@ -9,6 +9,7 @@ using v2rayN.Handler;
using v2rayN.HttpProxyHandler;
using v2rayN.Mode;
using v2rayN.Base;
using System.Net;
namespace v2rayN.Forms
{
@ -1366,7 +1367,14 @@ namespace v2rayN.Forms
AppendText(true, args.GetException().Message);
};
downloadHandle3.WebDownloadString(url);
IWebProxy proxy = null;
if (config.index >= 0 && config.vmess.Count > 0)
{
proxy = new WebProxy(Global.Loopback, config.GetLocalPort(Global.InboundHttp));
}
downloadHandle3.WebDownloadString(url, proxy);
AppendText(false, $"{hashCode}{UIRes.I18N("MsgStartGettingSubscriptions")}");
}

View file

@ -188,7 +188,7 @@ namespace v2rayN.Handler
/// DownloadString
/// </summary>
/// <param name="url"></param>
public void WebDownloadString(string url)
public void WebDownloadString(string url, IWebProxy proxy = null)
{
string source = string.Empty;
try
@ -196,6 +196,12 @@ namespace v2rayN.Handler
SetSecurityProtocol();
WebClientEx ws = new WebClientEx();
if (proxy != null)
{
ws.Proxy = proxy;
}
ws.DownloadStringCompleted += Ws_DownloadStringCompleted;
ws.DownloadStringAsync(new Uri(url));
}