mirror of
https://github.com/2dust/v2rayN.git
synced 2026-11-04 11:35:02 +03:00
Update RetResult
This commit is contained in:
@@ -10,22 +10,10 @@ namespace ServiceLib.Services
|
||||
/// </summary>
|
||||
public class DownloadService
|
||||
{
|
||||
public event EventHandler<ResultEventArgs>? UpdateCompleted;
|
||||
public event EventHandler<RetResult>? UpdateCompleted;
|
||||
|
||||
public event ErrorEventHandler? Error;
|
||||
|
||||
public class ResultEventArgs : EventArgs
|
||||
{
|
||||
public bool Success;
|
||||
public string Msg;
|
||||
|
||||
public ResultEventArgs(bool success, string msg)
|
||||
{
|
||||
Success = success;
|
||||
Msg = msg;
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<int> DownloadDataAsync(string url, WebProxy webProxy, int downloadTimeout, Action<bool, string> updateFunc)
|
||||
{
|
||||
try
|
||||
@@ -63,12 +51,12 @@ namespace ServiceLib.Services
|
||||
try
|
||||
{
|
||||
SetSecurityProtocol(AppHandler.Instance.Config.guiItem.enableSecurityProtocolTls13);
|
||||
UpdateCompleted?.Invoke(this, new ResultEventArgs(false, $"{ResUI.Downloading} {url}"));
|
||||
UpdateCompleted?.Invoke(this, new RetResult(false, $"{ResUI.Downloading} {url}"));
|
||||
|
||||
var progress = new Progress<double>();
|
||||
progress.ProgressChanged += (sender, value) =>
|
||||
{
|
||||
UpdateCompleted?.Invoke(this, new ResultEventArgs(value > 100, $"...{value}%"));
|
||||
UpdateCompleted?.Invoke(this, new RetResult(value > 100, $"...{value}%"));
|
||||
};
|
||||
|
||||
var webProxy = GetWebProxy(blProxy);
|
||||
|
||||
Reference in New Issue
Block a user