2023-07-12 20:37:31 +00:00
|
|
|
#!/bin/pwsh
|
2024-08-07 19:05:32 +00:00
|
|
|
. "$PSScriptRoot/../../../Common/Scripts/Context.ps1";
|
2023-06-06 22:57:16 +00:00
|
|
|
|
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) {
|
2023-06-30 12:23:20 +00:00
|
|
|
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`""));
|
|
|
|
}
|
2023-07-02 11:50:19 +00:00
|
|
|
|
|
|
|
function Restore-TmNations([Context] $context) {
|
2023-07-02 16:05:06 +00:00
|
|
|
$features = @("DirectPlay", "NetFx3");
|
2023-07-02 11:50:19 +00:00
|
|
|
Write-Host "Restoring TrackMania Nations Forever";
|
|
|
|
|
2023-07-02 16:05:06 +00:00
|
|
|
foreach ($feature in $features) {
|
2023-07-02 17:00:25 +00:00
|
|
|
if ((Get-WindowsOptionalFeature -Online -FeatureName $feature).State -ne "Enabled") {
|
2023-07-02 16:05:06 +00:00
|
|
|
Write-Information "Enabling the ``$feature`` feature";
|
2023-07-19 21:19:05 +00:00
|
|
|
$null = Enable-WindowsOptionalFeature -Online -All -FeatureName $feature;
|
2023-07-02 16:05:06 +00:00
|
|
|
}
|
2023-07-02 11:50:19 +00:00
|
|
|
}
|
|
|
|
|
2023-07-02 11:53:19 +00:00
|
|
|
Write-Information "Installing TrackMania Nations Forever";
|
2023-07-02 15:55:42 +00:00
|
|
|
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";
|
2023-07-16 12:52:53 +00:00
|
|
|
$context.RemoveDesktopIcon("*TmNationsForever*");
|
2023-07-02 11:53:19 +00:00
|
|
|
Write-Information "Restoring Files";
|
2023-07-02 11:50:19 +00:00
|
|
|
$context.Restore($context.SoftwareArchive($softwareName), $path);
|
|
|
|
}
|
2023-06-06 22:57:16 +00:00
|
|
|
}
|