diff --git a/scripts/Windows/Software/TrackMania Nations Forever/Manage.ps1 b/scripts/Windows/Software/TrackMania Nations Forever/Manage.ps1 index e9b1fd2c..956ea038 100644 --- a/scripts/Windows/Software/TrackMania Nations Forever/Manage.ps1 +++ b/scripts/Windows/Software/TrackMania Nations Forever/Manage.ps1 @@ -3,19 +3,43 @@ param( [hashtable] $Arguments ) -. "$PSScriptRoot/../../../Common/Scripts/Software.ps1"; -Start-SoftwareInstaller @PSBoundParameters ` - -Installer { - foreach ($feature in @("DirectPlay", "NetFx3")) { - if ((Get-WindowsOptionalFeature -Online -FeatureName $feature).State -ne "Enabled") { - Write-Information "Enabling the ``$feature`` feature…"; - choco install --source windowsFeatures -y $feature; +& { + param($Parameters) + . "$PSScriptRoot/../../Scripts/Restoration.ps1"; + . "$PSScriptRoot/../../../Common/Scripts/Software.ps1"; + $path = "$HOME/Documents/TmForever"; + + Start-SoftwareInstaller @Parameters ` + -Installer { + foreach ($feature in @("DirectPlay", "NetFx3")) { + if ((Get-WindowsOptionalFeature -Online -FeatureName $feature).State -ne "Enabled") { + Write-Information "Enabling the ``$feature`` feature…"; + choco install --source windowsFeatures -y $feature; + } } - } - Install-WingetPackage Nadeo.TrackManiaNationsForever; - Remove-DesktopIcon "*TmNationsForever*"; - }; + Install-WingetPackage Nadeo.TrackManiaNationsForever; + Remove-DesktopIcon "*TmNationsForever*"; + } ` + -UserBackup { + param([hashtable] $Arguments) + $name = $Arguments.Name; -# ToDo: Add restoration + Add-BackupArtifacts -User $name -Source $path -Path "TmNationsForever" ` + -Include @( + "ChallengeMusics", + "MediaTracker", + "MenuMusics", + "Painter", + "Scores", + "Skins", + "Tracks" + ); + } ` + -UserConfigurator { + param([hashtable] $Arguments) + $name = $Arguments.Name; + Expand-BackupArtifacts -User $name -Path "TmNationsForever" -Target $path; + }; +} $PSBoundParameters; diff --git a/scripts/Windows/Software/TrackMania United Forever/Manage.ps1 b/scripts/Windows/Software/TrackMania United Forever/Manage.ps1 index b15ea704..edd78c69 100644 --- a/scripts/Windows/Software/TrackMania United Forever/Manage.ps1 +++ b/scripts/Windows/Software/TrackMania United Forever/Manage.ps1 @@ -3,31 +3,51 @@ param( [hashtable] $Arguments ) -. "$PSScriptRoot/../../../Common/Scripts/Software.ps1"; -. "$PSScriptRoot/../../../Common/Scripts/System.ps1"; -Start-SoftwareInstaller @PSBoundParameters ` - -Installer { - $file = "TmUnitedForever.exe"; - $dir = New-TemporaryDirectory; +& { + param($Parameters) + . "$PSScriptRoot/../../Scripts/Restoration.ps1"; + . "$PSScriptRoot/../../../Common/Scripts/Software.ps1"; + . "$PSScriptRoot/../../../Common/Scripts/System.ps1"; + $path = "$HOME/Documents/TrackMania"; - foreach ($feature in @("DirectPlay", "NetFx3")) { - if ((Get-WindowsOptionalFeature -Online -FeatureName $feature).State -ne "Enabled") { - Write-Information "Enabling the ``$feature`` feature…"; - choco install --source windowsFeatures -y $feature; + Start-SoftwareInstaller @Parameters ` + -Installer { + $file = "TmUnitedForever.exe"; + $dir = New-TemporaryDirectory; + + foreach ($feature in @("DirectPlay", "NetFx3")) { + if ((Get-WindowsOptionalFeature -Online -FeatureName $feature).State -ne "Enabled") { + Write-Information "Enabling the ``$feature`` feature…"; + choco install --source windowsFeatures -y $feature; + } } - } - $null = Push-Location $dir; - Write-Host "Downloading TrackMania United Forever…"; - Invoke-WebRequest "http://files.trackmaniaforever.com/tmunitedforever_setup.exe" -OutFile "$file"; + $null = Push-Location $dir; + Write-Host "Downloading TrackMania United Forever…"; + Invoke-WebRequest "http://files.trackmaniaforever.com/tmunitedforever_setup.exe" -OutFile "$file"; - Write-Host "Starting installation…"; - Start-Process -Wait -FilePath $file -ArgumentList "/Silent"; - Remove-DesktopIcon "*TmUnitedForever*"; - $null = Pop-Location; + Write-Host "Starting installation…"; + Start-Process -Wait -FilePath $file -ArgumentList "/Silent"; + Remove-DesktopIcon "*TmUnitedForever*"; + $null = Pop-Location; - Remove-Item -Recurse $dir; - }; - -# ToDo: Add restoration + Remove-Item -Recurse $dir; + } ` + -UserBackup { + param([hashtable] $Arguments) + Add-BackupArtifacts -User $Arguments.Name -Source $path -Path "TmUnitedForever" ` + -Include @( + "ChallengeMusics", + "MediaTracker", + "MenuMusics", + "Scores", + "Skins", + "Tracks" + ); + } ` + -UserConfigurator { + param([hashtable] $Arguments) + Expand-BackupArtifacts -User $Arguments.Name -Path "TmUnitedForever" -Target $path; + }; +} $PSBoundParameters;