mirror of https://github.com/2dust/v2rayN
Add restart to Linux restore backup function
parent
9583dff176
commit
bc2adbfa77
|
@ -517,10 +517,10 @@ namespace ServiceLib.Common
|
||||||
|
|
||||||
#region 杂项
|
#region 杂项
|
||||||
|
|
||||||
public static bool UpgradeAppExists(out string fileName)
|
public static bool UpgradeAppExists(out string upgradeFileName)
|
||||||
{
|
{
|
||||||
fileName = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, GetExeName("AmazTool"));
|
upgradeFileName = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, GetExeName("AmazTool"));
|
||||||
return File.Exists(fileName);
|
return File.Exists(upgradeFileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -32,9 +32,9 @@ namespace ServiceLib.Handler
|
||||||
{
|
{
|
||||||
if (it.CoreType == ECoreType.v2rayN)
|
if (it.CoreType == ECoreType.v2rayN)
|
||||||
{
|
{
|
||||||
if (Utils.UpgradeAppExists(out var fileName))
|
if (Utils.UpgradeAppExists(out var upgradeFileName))
|
||||||
{
|
{
|
||||||
await Utils.SetLinuxChmod(fileName);
|
await Utils.SetLinuxChmod(upgradeFileName);
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -147,6 +147,13 @@ namespace ServiceLib.ViewModels
|
||||||
{
|
{
|
||||||
ProcUtils.RebootAsAdmin(false);
|
ProcUtils.RebootAsAdmin(false);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (Utils.UpgradeAppExists(out var upgradeFileName))
|
||||||
|
{
|
||||||
|
ProcUtils.ProcessStart(upgradeFileName, Global.RebootAs, Utils.StartupPath());
|
||||||
|
}
|
||||||
|
}
|
||||||
service?.Shutdown();
|
service?.Shutdown();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -310,14 +310,14 @@ namespace ServiceLib.ViewModels
|
||||||
|
|
||||||
public async Task UpgradeApp(string arg)
|
public async Task UpgradeApp(string arg)
|
||||||
{
|
{
|
||||||
if (!Utils.UpgradeAppExists(out var fileName))
|
if (!Utils.UpgradeAppExists(out var upgradeFileName))
|
||||||
{
|
{
|
||||||
NoticeHandler.Instance.SendMessageAndEnqueue(ResUI.UpgradeAppNotExistTip);
|
NoticeHandler.Instance.SendMessageAndEnqueue(ResUI.UpgradeAppNotExistTip);
|
||||||
Logging.SaveLog("UpgradeApp does not exist");
|
Logging.SaveLog("UpgradeApp does not exist");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var id = ProcUtils.ProcessStart(fileName, arg, Utils.StartupPath());
|
var id = ProcUtils.ProcessStart(upgradeFileName, arg, Utils.StartupPath());
|
||||||
if (id > 0)
|
if (id > 0)
|
||||||
{
|
{
|
||||||
await MyAppExitAsync(false);
|
await MyAppExitAsync(false);
|
||||||
|
|
Loading…
Reference in New Issue