32 lines
1.3 KiB
PowerShell
32 lines
1.3 KiB
PowerShell
#!/bin/pwsh
|
|
. "$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) {
|
|
$features = @("DirectPlay", "NetFx3");
|
|
Write-Host "Restoring TrackMania Nations Forever";
|
|
|
|
foreach ($feature in $features) {
|
|
if ((Get-WindowsOptionalFeature -Online -FeatureName $feature).State -ne "Enabled") {
|
|
Write-Information "Enabling the ``$feature`` feature";
|
|
$null = Enable-WindowsOptionalFeature -Online -All -FeatureName $feature;
|
|
}
|
|
}
|
|
|
|
Write-Information "Installing TrackMania Nations Forever";
|
|
winget install --accept-source-agreements --accept-package-agreements -e --id Nadeo.TrackManiaNationsForever;
|
|
Write-Information "Removing Desktop Icon";
|
|
$context.RemoveDesktopIcon("*TmNationsForever*");
|
|
Write-Information "Restoring Files";
|
|
$context.Restore($context.SoftwareArchive($softwareName), $path);
|
|
}
|
|
}
|