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
)
. "$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 {
foreach ($feature in @("DirectPlay", "NetFx3")) {
if ((Get-WindowsOptionalFeature -Online -FeatureName $feature).State -ne "Enabled") {
@ -16,6 +21,25 @@ Start-SoftwareInstaller @PSBoundParameters `
Install-WingetPackage Nadeo.TrackManiaNationsForever;
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
)
& {
param($Parameters)
. "$PSScriptRoot/../../Scripts/Restoration.ps1";
. "$PSScriptRoot/../../../Common/Scripts/Software.ps1";
. "$PSScriptRoot/../../../Common/Scripts/System.ps1";
$path = "$HOME/Documents/TrackMania";
Start-SoftwareInstaller @PSBoundParameters `
Start-SoftwareInstaller @Parameters `
-Installer {
$file = "TmUnitedForever.exe";
$dir = New-TemporaryDirectory;
@ -28,6 +33,21 @@ Start-SoftwareInstaller @PSBoundParameters `
$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;
};
# ToDo: Add restoration
} $PSBoundParameters;