Skip to content

Commit

Permalink
Refactor V2rayUpgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
2dust committed Sep 6, 2024
1 parent d03a862 commit d5f1cc9
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 15 deletions.
16 changes: 1 addition & 15 deletions v2rayN/ServiceLib/ViewModels/CheckUpdateViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -234,21 +234,7 @@ private void UpgradeN()
{
return;
}

Process process = new()
{
StartInfo = new ProcessStartInfo
{
FileName = "v2rayUpgrade",
Arguments = fileName.AppendQuotes(),
WorkingDirectory = Utils.StartupPath()
}
};
process.Start();
if (process.Id > 0)
{
Locator.Current.GetService<MainWindowViewModel>()?.MyAppExitAsync(false);
}
Locator.Current.GetService<MainWindowViewModel>()?.V2rayUpgrade(fileName);
}
catch (Exception ex)
{
Expand Down
18 changes: 18 additions & 0 deletions v2rayN/ServiceLib/ViewModels/MainWindowViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,24 @@ public async Task MyAppExitAsync(bool blWindowsShutDown)
}
}

public async Task V2rayUpgrade(string fileName)
{
Process process = new()
{
StartInfo = new ProcessStartInfo
{
FileName = "v2rayUpgrade",
Arguments = fileName.AppendQuotes(),
WorkingDirectory = Utils.StartupPath()
}
};
process.Start();
if (process.Id > 0)
{
await MyAppExitAsync(false);
}
}

#endregion Actions

#region Servers && Groups
Expand Down

0 comments on commit d5f1cc9

Please sign in to comment.