Skip to content

Commit

Permalink
Bug fix for check update
Browse files Browse the repository at this point in the history
  • Loading branch information
2dust committed Oct 4, 2024
1 parent 3ecbd3b commit 20bb263
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
7 changes: 4 additions & 3 deletions v2rayN/ServiceLib/Handler/UpdateHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ public async Task CheckUpdateCore(ECoreType type, Config config, Action<bool, st
_updateFunc(false, args.Msg);

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);
}
else
Expand Down Expand Up @@ -322,9 +323,9 @@ private SemanticVersion GetCoreVersion(ECoreType type)
}

using Process p = new();
p.StartInfo.FileName = filePath.AppendQuotes();
p.StartInfo.FileName = filePath;
p.StartInfo.Arguments = coreInfo.versionArg;
p.StartInfo.WorkingDirectory = Utils.StartupPath();
p.StartInfo.WorkingDirectory = Utils.GetConfigPath();
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.CreateNoWindow = true;
Expand Down
8 changes: 4 additions & 4 deletions v2rayN/ServiceLib/ViewModels/CheckUpdateViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -196,20 +196,20 @@ void _updateUI(bool success, string msg)
});
}

private void UpdateFinished()
private async Task UpdateFinished()
{
if (_lstUpdated.Count > 0 && _lstUpdated.Count(x => x.isFinished == true) == _lstUpdated.Count)
{
_updateView?.Invoke(EViewAction.DispatcherCheckUpdateFinished, false);
Task.Delay(1000);
await Task.Delay(2000);
UpgradeCore();

if (_lstUpdated.Any(x => x.coreType == _v2rayN && x.isFinished == true))
{
Task.Delay(1000);
await Task.Delay(1000);
UpgradeN();
}
Task.Delay(1000);
await Task.Delay(1000);
_updateView?.Invoke(EViewAction.DispatcherCheckUpdateFinished, true);
}
}
Expand Down

0 comments on commit 20bb263

Please sign in to comment.