Skip to content

Commit 20bb263

Browse files
committed
Bug fix for check update
1 parent 3ecbd3b commit 20bb263

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

v2rayN/ServiceLib/Handler/UpdateHandler.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,8 @@ public async Task CheckUpdateCore(ECoreType type, Config config, Action<bool, st
109109
_updateFunc(false, args.Msg);
110110

111111
url = args.Url;
112-
fileName = Utils.GetTempPath(Utils.GetGUID());
112+
var ext = Path.GetExtension(url);
113+
fileName = Utils.GetTempPath(Utils.GetGUID()+ ext);
113114
await downloadHandle.DownloadFileAsync(url, fileName, true, _timeout);
114115
}
115116
else
@@ -322,9 +323,9 @@ private SemanticVersion GetCoreVersion(ECoreType type)
322323
}
323324

324325
using Process p = new();
325-
p.StartInfo.FileName = filePath.AppendQuotes();
326+
p.StartInfo.FileName = filePath;
326327
p.StartInfo.Arguments = coreInfo.versionArg;
327-
p.StartInfo.WorkingDirectory = Utils.StartupPath();
328+
p.StartInfo.WorkingDirectory = Utils.GetConfigPath();
328329
p.StartInfo.UseShellExecute = false;
329330
p.StartInfo.RedirectStandardOutput = true;
330331
p.StartInfo.CreateNoWindow = true;

v2rayN/ServiceLib/ViewModels/CheckUpdateViewModel.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -196,20 +196,20 @@ void _updateUI(bool success, string msg)
196196
});
197197
}
198198

199-
private void UpdateFinished()
199+
private async Task UpdateFinished()
200200
{
201201
if (_lstUpdated.Count > 0 && _lstUpdated.Count(x => x.isFinished == true) == _lstUpdated.Count)
202202
{
203203
_updateView?.Invoke(EViewAction.DispatcherCheckUpdateFinished, false);
204-
Task.Delay(1000);
204+
await Task.Delay(2000);
205205
UpgradeCore();
206206

207207
if (_lstUpdated.Any(x => x.coreType == _v2rayN && x.isFinished == true))
208208
{
209-
Task.Delay(1000);
209+
await Task.Delay(1000);
210210
UpgradeN();
211211
}
212-
Task.Delay(1000);
212+
await Task.Delay(1000);
213213
_updateView?.Invoke(EViewAction.DispatcherCheckUpdateFinished, true);
214214
}
215215
}

0 commit comments

Comments
 (0)