2024-11-01 12:12:16 +00:00
|
|
|
. "$PSScriptRoot/../../lib/Restoration.ps1";
|
|
|
|
. "$PSScriptRoot/../../../lib/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
|
|
|
|
)
|
|
|
|
|
|
|
|
@{
|
2024-10-06 19:25:34 +00:00
|
|
|
context = @{
|
|
|
|
iconName = $IconName;
|
2024-09-24 16:15:06 +00:00
|
|
|
userDirectory = $UserDirectory;
|
2024-10-06 19:25:34 +00:00
|
|
|
installer = $Installer;
|
2024-09-24 16:15:06 +00:00
|
|
|
};
|
2024-10-06 19:25:34 +00:00
|
|
|
installer = {
|
2024-09-29 15:12:44 +00:00
|
|
|
param([hashtable] $Context)
|
|
|
|
$iconName = $Context.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-29 15:12:44 +00:00
|
|
|
& $Context.Installer;
|
2024-09-24 16:15:06 +00:00
|
|
|
Remove-DesktopIcon "*$iconName*";
|
|
|
|
};
|
2024-10-06 19:25:34 +00:00
|
|
|
userBackup = {
|
2024-09-23 00:10:42 +00:00
|
|
|
param(
|
|
|
|
[string] $Name,
|
2024-09-29 15:12:44 +00:00
|
|
|
[hashtable] $Context
|
2024-09-23 00:10:42 +00:00
|
|
|
)
|
|
|
|
|
2024-09-29 15:12:44 +00:00
|
|
|
Add-BackupArtifacts -User $Context.Name -Source $Context.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 = {
|
2024-09-23 00:10:42 +00:00
|
|
|
param(
|
|
|
|
[string] $Name,
|
2024-09-29 15:12:44 +00:00
|
|
|
[hashtable] $Context
|
2024-09-23 00:10:42 +00:00
|
|
|
)
|
|
|
|
|
2024-09-29 15:12:44 +00:00
|
|
|
$user = $Context.Name;
|
2024-09-24 16:15:06 +00:00
|
|
|
Expand-BackupArtifacts -User $user -Path "$Name" -Target $path;
|
2024-09-03 10:02:09 +00:00
|
|
|
};
|
2024-09-24 16:15:06 +00:00
|
|
|
};
|
|
|
|
}
|