Improved backup and restore

Overwrite the configuration file directly in the main program
This commit is contained in:
2dust
2025-01-02 13:36:26 +08:00
parent e122ea8146
commit 7884853098
3 changed files with 36 additions and 3 deletions
@@ -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
{