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,9 +3,14 @@ param(
[hashtable] $Arguments [hashtable] $Arguments
) )
. "$PSScriptRoot/../../../Common/Scripts/Software.ps1";
Start-SoftwareInstaller @PSBoundParameters ` & {
param($Parameters)
. "$PSScriptRoot/../../Scripts/Restoration.ps1";
. "$PSScriptRoot/../../../Common/Scripts/Software.ps1";
$path = "$HOME/Documents/TmForever";
Start-SoftwareInstaller @Parameters `
-Installer { -Installer {
foreach ($feature in @("DirectPlay", "NetFx3")) { foreach ($feature in @("DirectPlay", "NetFx3")) {
if ((Get-WindowsOptionalFeature -Online -FeatureName $feature).State -ne "Enabled") { if ((Get-WindowsOptionalFeature -Online -FeatureName $feature).State -ne "Enabled") {
@ -16,6 +21,25 @@ Start-SoftwareInstaller @PSBoundParameters `
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,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