PortValhalla/scripts/Windows/Software/TrackMania United Forever/Manage.ps1

69 lines
1.9 KiB
PowerShell
Raw Normal View History

2024-09-24 16:15:06 +00:00
. "$PSScriptRoot/../../Scripts/Restoration.ps1";
. "$PSScriptRoot/../../../Common/Scripts/Software.ps1";
2024-08-08 02:36:35 +00:00
2024-09-24 16:15:06 +00:00
<#
.SYNOPSIS
Generates the components for installing a TrackMania Forever game.
2024-08-08 02:36:35 +00:00
2024-09-24 16:15:06 +00:00
.PARAMETER Installer
The script to execute for installing the game.
2024-08-08 02:36:35 +00:00
2024-09-24 16:15:06 +00:00
.PARAMETER UserDirectory
The directory containing the user data.
#>
function Get-TMForeverInstallerComponents {
param(
[string] $IconName,
[string] $UserDirectory,
[scriptblock] $Installer
)
@{
arguments = @{
iconName = $IconName;
userDirectory = $UserDirectory;
installer = $Installer;
};
installer = {
param([hashtable] $Arguments)
$iconName = $Arguments.IconName;
2024-08-08 02:36:35 +00:00
2024-09-03 10:02:09 +00:00
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;
}
}
2024-08-08 02:36:35 +00:00
2024-09-24 16:15:06 +00:00
& $Arguments.Installer;
Remove-DesktopIcon "*$iconName*";
};
userBackup = {
param(
[string] $Name,
[hashtable] $Arguments
)
2024-09-24 16:15:06 +00:00
Add-BackupArtifacts -User $Arguments.Name -Source $Arguments.UserDirectory -Path "$Name" `
2024-09-03 10:02:09 +00:00
-Include @(
"ChallengeMusics",
"MediaTracker",
"MenuMusics",
2024-09-24 16:15:06 +00:00
"Painter",
2024-09-03 10:02:09 +00:00
"Scores",
"Skins",
"Tracks"
);
2024-09-24 16:15:06 +00:00
};
userConfigurator = {
param(
[string] $Name,
[hashtable] $Arguments
)
2024-09-24 16:15:06 +00:00
$user = $Arguments.Name;
Expand-BackupArtifacts -User $user -Path "$Name" -Target $path;
2024-09-03 10:02:09 +00:00
};
2024-09-24 16:15:06 +00:00
};
}