Allow backing up TrackMania Forever

This commit is contained in:
Manuel Thalmann 2024-09-03 12:02:09 +02:00
parent d2c6737798
commit 875ac600df
2 changed files with 78 additions and 34 deletions

View file

@ -3,19 +3,43 @@ param(
[hashtable] $Arguments [hashtable] $Arguments
) )
. "$PSScriptRoot/../../../Common/Scripts/Software.ps1";
Start-SoftwareInstaller @PSBoundParameters ` & {
-Installer { param($Parameters)
foreach ($feature in @("DirectPlay", "NetFx3")) { . "$PSScriptRoot/../../Scripts/Restoration.ps1";
if ((Get-WindowsOptionalFeature -Online -FeatureName $feature).State -ne "Enabled") { . "$PSScriptRoot/../../../Common/Scripts/Software.ps1";
Write-Information "Enabling the ``$feature`` feature…"; $path = "$HOME/Documents/TmForever";
choco install --source windowsFeatures -y $feature;
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; Install-WingetPackage Nadeo.TrackManiaNationsForever;
Remove-DesktopIcon "*TmNationsForever*"; 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;

View file

@ -3,31 +3,51 @@ param(
[hashtable] $Arguments [hashtable] $Arguments
) )
. "$PSScriptRoot/../../../Common/Scripts/Software.ps1";
. "$PSScriptRoot/../../../Common/Scripts/System.ps1";
Start-SoftwareInstaller @PSBoundParameters ` & {
-Installer { param($Parameters)
$file = "TmUnitedForever.exe"; . "$PSScriptRoot/../../Scripts/Restoration.ps1";
$dir = New-TemporaryDirectory; . "$PSScriptRoot/../../../Common/Scripts/Software.ps1";
. "$PSScriptRoot/../../../Common/Scripts/System.ps1";
$path = "$HOME/Documents/TrackMania";
foreach ($feature in @("DirectPlay", "NetFx3")) { Start-SoftwareInstaller @Parameters `
if ((Get-WindowsOptionalFeature -Online -FeatureName $feature).State -ne "Enabled") { -Installer {
Write-Information "Enabling the ``$feature`` feature…"; $file = "TmUnitedForever.exe";
choco install --source windowsFeatures -y $feature; $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; $null = Push-Location $dir;
Write-Host "Downloading TrackMania United Forever…"; Write-Host "Downloading TrackMania United Forever…";
Invoke-WebRequest "http://files.trackmaniaforever.com/tmunitedforever_setup.exe" -OutFile "$file"; Invoke-WebRequest "http://files.trackmaniaforever.com/tmunitedforever_setup.exe" -OutFile "$file";
Write-Host "Starting installation…"; Write-Host "Starting installation…";
Start-Process -Wait -FilePath $file -ArgumentList "/Silent"; Start-Process -Wait -FilePath $file -ArgumentList "/Silent";
Remove-DesktopIcon "*TmUnitedForever*"; Remove-DesktopIcon "*TmUnitedForever*";
$null = Pop-Location; $null = Pop-Location;
Remove-Item -Recurse $dir; Remove-Item -Recurse $dir;
}; } `
-UserBackup {
# ToDo: Add restoration 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;