PortValhalla/scripts/Windows/Software/TrackMania Nations Forever/Manage.ps1

25 lines
902 B
PowerShell
Raw Normal View History

. "$PSScriptRoot/../../Scripts/Context.ps1";
2023-06-08 00:28:33 +00:00
$null = New-Module {
$path = "$HOME/Documents/TmForever";
$softwareName = "TmNationsForever";
2023-06-30 10:19:54 +00:00
function Backup-TmNations([Context] $context) {
Write-Host "Backing up TrackMania Nations Forever";
2023-06-08 00:28:33 +00:00
$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) {
Enable-WindowsOptionalFeature -Online -FeatureName $feature;
}
winget install -e --id Nadeo.TrackManiaNationsForever;
Remove-Item "$env:PUBLIC\Desktop\*TmNationsForever*";
$context.Restore($context.SoftwareArchive($softwareName), $path);
}
}