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

29 lines
1.2 KiB
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) {
2023-07-02 11:53:19 +00:00
Write-Information "Enabling the ``$feature`` feature";
2023-07-02 15:53:28 +00:00
Enable-WindowsOptionalFeature -Online -All -FeatureName $feature;
}
2023-07-02 11:53:19 +00:00
Write-Information "Installing TrackMania Nations Forever";
winget install --accept-source-agreements --accept-package-agreements -e --id Nadeo.TrackManiaNationsForever;
2023-07-02 11:53:19 +00:00
Write-Information "Removing Desktop Icon";
Remove-Item "$env:PUBLIC\Desktop\*TmNationsForever*";
2023-07-02 11:53:19 +00:00
Write-Information "Restoring Files";
$context.Restore($context.SoftwareArchive($softwareName), $path);
}
}