Browse Source

Refactor V2rayUpgrade

pull/5701/head
2dust 3 months ago
parent
commit
d5f1cc99ac
  1. 16
      v2rayN/ServiceLib/ViewModels/CheckUpdateViewModel.cs
  2. 18
      v2rayN/ServiceLib/ViewModels/MainWindowViewModel.cs

16
v2rayN/ServiceLib/ViewModels/CheckUpdateViewModel.cs

@ -234,21 +234,7 @@ namespace ServiceLib.ViewModels
{
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)
{

18
v2rayN/ServiceLib/ViewModels/MainWindowViewModel.cs

@ -428,6 +428,24 @@ namespace ServiceLib.ViewModels
}
}
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

Loading…
Cancel
Save