mirror of
https://github.com/2dust/v2rayN.git
synced 2026-10-13 16:55:00 +03:00
Improved backup and restore
Overwrite the configuration file directly in the main program
This commit is contained in:
@@ -141,7 +141,21 @@ namespace ServiceLib.ViewModels
|
||||
var result = await CreateZipFileFromDirectory(fileBackup);
|
||||
if (result)
|
||||
{
|
||||
Locator.Current.GetService<MainWindowViewModel>()?.UpgradeApp(fileName);
|
||||
var service = Locator.Current.GetService<MainWindowViewModel>();
|
||||
await service?.MyAppExitAsync(true);
|
||||
await SQLiteHelper.Instance.DisposeDbConnectionAsync();
|
||||
|
||||
var toPath = Utils.GetConfigPath();
|
||||
FileManager.ZipExtractToFile(fileName, toPath, "");
|
||||
|
||||
if (Utils.IsWindows())
|
||||
{
|
||||
service?.RebootAsAdmin(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
service?.Shutdown();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user