. "$PSScriptRoot/../../Scripts/Restoration.ps1"; . "$PSScriptRoot/../../../Common/Scripts/Software.ps1"; <# .SYNOPSIS Generates the components for installing a TrackMania Forever game. .PARAMETER Installer The script to execute for installing the game. .PARAMETER UserDirectory The directory containing the user data. #> function Get-TMForeverInstallerComponents { param( [string] $IconName, [string] $UserDirectory, [scriptblock] $Installer ) @{ arguments = @{ iconName = $IconName; userDirectory = $UserDirectory; installer = $Installer; }; installer = { param([hashtable] $Arguments) $iconName = $Arguments.IconName; 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; } } & $Arguments.Installer; Remove-DesktopIcon "*$iconName*"; }; userBackup = { param( [string] $Name, [hashtable] $Arguments ) Add-BackupArtifacts -User $Arguments.Name -Source $Arguments.UserDirectory -Path "$Name" ` -Include @( "ChallengeMusics", "MediaTracker", "MenuMusics", "Painter", "Scores", "Skins", "Tracks" ); }; userConfigurator = { param( [string] $Name, [hashtable] $Arguments ) $user = $Arguments.Name; Expand-BackupArtifacts -User $user -Path "$Name" -Target $path; }; }; }