Accept context for windows restoration

This commit is contained in:
Manuel Thalmann 2023-06-16 20:30:53 +02:00
parent db17c2c42c
commit 4338ba08eb
2 changed files with 4 additions and 4 deletions

View file

@ -1,4 +1,4 @@
. "$PSScriptRoot/Manage.ps1";
Invoke-WindowsRestore;
$context = [Context]::new();
Invoke-WindowsRestore $context;

View file

@ -29,7 +29,7 @@ function Invoke-WindowsBackup([Context] $context) {
$context.Backup($backupRoot, "$backupRoot.7z", @("-sdel"));
}
function Invoke-WindowsRestore() {
function Invoke-WindowsRestore([Context] $context) {
function Read-Path()
{
$backupPath = Read-Host -Prompt "Please enter the path to the archive load the backup from.";
@ -43,7 +43,7 @@ function Invoke-WindowsRestore() {
$backupPath = Read-Path;
$context = [Context]::new();
$context.BackupName = "PortValhalla";
$context.BackupName ??= "PortValhalla";
$context.RootDir = $context.GetTempDirectory();
$context.Restore($backupPath, $context.BackupRoot());
Remove-Item -Recurse $context.RootDir;