69 lines
2 KiB
PowerShell
69 lines
2 KiB
PowerShell
. "$PSScriptRoot/../../Scripts/Restoration.ps1";
|
|
. "$PSScriptRoot/../../../Common/Scripts/Software.ps1";
|
|
|
|
<#
|
|
.SYNOPSIS
|
|
Generates the components for installing a TrackMania Forever game.
|
|
|
|
.PARAMETER Installer
|
|
The script to execute for installing the game.
|
|
|
|
.PARAMETER UserDirectory
|
|
The directory containing the user data.
|
|
#>
|
|
function Get-TMForeverInstallerComponents {
|
|
param(
|
|
[string] $IconName,
|
|
[string] $UserDirectory,
|
|
[scriptblock] $Installer
|
|
)
|
|
|
|
@{
|
|
context = @{
|
|
iconName = $IconName;
|
|
userDirectory = $UserDirectory;
|
|
installer = $Installer;
|
|
};
|
|
installer = {
|
|
param([hashtable] $Context)
|
|
$iconName = $Context.IconName;
|
|
|
|
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;
|
|
}
|
|
}
|
|
|
|
& $Context.Installer;
|
|
Remove-DesktopIcon "*$iconName*";
|
|
};
|
|
userBackup = {
|
|
param(
|
|
[string] $Name,
|
|
[hashtable] $Context
|
|
)
|
|
|
|
Add-BackupArtifacts -User $Context.Name -Source $Context.UserDirectory -Path "$Name" `
|
|
-Include @(
|
|
"ChallengeMusics",
|
|
"MediaTracker",
|
|
"MenuMusics",
|
|
"Painter",
|
|
"Scores",
|
|
"Skins",
|
|
"Tracks"
|
|
);
|
|
};
|
|
userConfigurator = {
|
|
param(
|
|
[string] $Name,
|
|
[hashtable] $Context
|
|
)
|
|
|
|
$user = $Context.Name;
|
|
Expand-BackupArtifacts -User $user -Path "$Name" -Target $path;
|
|
};
|
|
};
|
|
}
|