Bug fix for check update

pull/5829/head
2dust 2024-10-04 17:10:30 +08:00
parent 3ecbd3bc10
commit 20bb263b06
2 changed files with 8 additions and 7 deletions

View File

@ -109,7 +109,8 @@ namespace ServiceLib.Handler
_updateFunc(false, args.Msg); _updateFunc(false, args.Msg);
url = args.Url; url = args.Url;
fileName = Utils.GetTempPath(Utils.GetGUID()); var ext = Path.GetExtension(url);
fileName = Utils.GetTempPath(Utils.GetGUID()+ ext);
await downloadHandle.DownloadFileAsync(url, fileName, true, _timeout); await downloadHandle.DownloadFileAsync(url, fileName, true, _timeout);
} }
else else
@ -322,9 +323,9 @@ namespace ServiceLib.Handler
} }
using Process p = new(); using Process p = new();
p.StartInfo.FileName = filePath.AppendQuotes(); p.StartInfo.FileName = filePath;
p.StartInfo.Arguments = coreInfo.versionArg; p.StartInfo.Arguments = coreInfo.versionArg;
p.StartInfo.WorkingDirectory = Utils.StartupPath(); p.StartInfo.WorkingDirectory = Utils.GetConfigPath();
p.StartInfo.UseShellExecute = false; p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardOutput = true; p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.CreateNoWindow = true; p.StartInfo.CreateNoWindow = true;

View File

@ -196,20 +196,20 @@ namespace ServiceLib.ViewModels
}); });
} }
private void UpdateFinished() private async Task UpdateFinished()
{ {
if (_lstUpdated.Count > 0 && _lstUpdated.Count(x => x.isFinished == true) == _lstUpdated.Count) if (_lstUpdated.Count > 0 && _lstUpdated.Count(x => x.isFinished == true) == _lstUpdated.Count)
{ {
_updateView?.Invoke(EViewAction.DispatcherCheckUpdateFinished, false); _updateView?.Invoke(EViewAction.DispatcherCheckUpdateFinished, false);
Task.Delay(1000); await Task.Delay(2000);
UpgradeCore(); UpgradeCore();
if (_lstUpdated.Any(x => x.coreType == _v2rayN && x.isFinished == true)) if (_lstUpdated.Any(x => x.coreType == _v2rayN && x.isFinished == true))
{ {
Task.Delay(1000); await Task.Delay(1000);
UpgradeN(); UpgradeN();
} }
Task.Delay(1000); await Task.Delay(1000);
_updateView?.Invoke(EViewAction.DispatcherCheckUpdateFinished, true); _updateView?.Invoke(EViewAction.DispatcherCheckUpdateFinished, true);
} }
} }