53 lines
1.8 KiB
PowerShell
53 lines
1.8 KiB
PowerShell
param(
|
|
$Action,
|
|
[hashtable] $Arguments
|
|
)
|
|
|
|
|
|
& {
|
|
param($Parameters)
|
|
. "$PSScriptRoot/../../Scripts/Restoration.ps1";
|
|
. "$PSScriptRoot/../../../Common/Scripts/Software.ps1";
|
|
. "$PSScriptRoot/../../../Common/Scripts/System.ps1";
|
|
$path = "$HOME/Documents/TrackMania";
|
|
|
|
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";
|
|
|
|
Write-Host "Starting installation…";
|
|
Start-Process -Wait -FilePath $file -ArgumentList "/Silent";
|
|
Remove-DesktopIcon "*TmUnitedForever*";
|
|
$null = Pop-Location;
|
|
|
|
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;
|