PortValhalla/scripts/Windows/Software/TrackMania Nations Forever/Manage.ps1
2023-07-02 13:53:19 +02:00

29 lines
1.1 KiB
PowerShell

. "$PSScriptRoot/../../Scripts/Context.ps1";
$null = New-Module {
$path = "$HOME/Documents/TmForever";
$softwareName = "TmNationsForever";
function Backup-TmNations([Context] $context) {
Write-Host "Backing up TrackMania Nations Forever";
$context.Backup($path, $context.SoftwareArchive($softwareName), @("-i@`"$PSScriptRoot/include.txt`""));
}
function Restore-TmNations([Context] $context) {
$feature = "DirectPlay";
Write-Host "Restoring TrackMania Nations Forever";
if (-not (Get-WindowsOptionalFeature -Online -FeatureName $feature).State) {
Write-Information "Enabling the ``$feature`` feature";
Enable-WindowsOptionalFeature -Online -FeatureName $feature;
}
Write-Information "Installing TrackMania Nations Forever";
winget install -e --id Nadeo.TrackManiaNationsForever;
Write-Information "Removing Desktop Icon";
Remove-Item "$env:PUBLIC\Desktop\*TmNationsForever*";
Write-Information "Restoring Files";
$context.Restore($context.SoftwareArchive($softwareName), $path);
}
}