Allow backing up TrackMania Forever

This commit is contained in:
Manuel Thalmann 2024-09-03 12:02:09 +02:00
parent a8bc078525
commit 2397a1919d
2 changed files with 61 additions and 18 deletions

View file

@ -3,19 +3,42 @@ 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 {
# ToDo: Add restoration param([hashtable] $Arguments)
$name = $Arguments.Name;
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,10 +3,15 @@ param(
[hashtable] $Arguments [hashtable] $Arguments
) )
. "$PSScriptRoot/../../../Common/Scripts/Software.ps1";
. "$PSScriptRoot/../../../Common/Scripts/System.ps1";
Start-SoftwareInstaller @PSBoundParameters ` & {
param($Parameters)
. "$PSScriptRoot/../../Scripts/Restoration.ps1";
. "$PSScriptRoot/../../../Common/Scripts/Software.ps1";
. "$PSScriptRoot/../../../Common/Scripts/System.ps1";
$path = "$HOME/Documents/TrackMania";
Start-SoftwareInstaller @Parameters `
-Installer { -Installer {
$file = "TmUnitedForever.exe"; $file = "TmUnitedForever.exe";
$dir = New-TemporaryDirectory; $dir = New-TemporaryDirectory;
@ -28,6 +33,21 @@ Start-SoftwareInstaller @PSBoundParameters `
$null = Pop-Location; $null = Pop-Location;
Remove-Item -Recurse $dir; 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;
# ToDo: Add restoration