Refactor V2rayUpgrade

pull/5701/head
2dust 2024-09-06 18:37:46 +08:00
parent d03a86292e
commit d5f1cc99ac
2 changed files with 19 additions and 15 deletions

View File

@ -234,21 +234,7 @@ namespace ServiceLib.ViewModels
{ {
return; return;
} }
Locator.Current.GetService<MainWindowViewModel>()?.V2rayUpgrade(fileName);
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);
}
} }
catch (Exception ex) catch (Exception ex)
{ {

View File

@ -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 #endregion Actions
#region Servers && Groups #region Servers && Groups