2023-06-07 17:15:47 +00:00
|
|
|
. "$PSScriptRoot/../../Scripts/Context.ps1";
|
2023-06-06 23:21:47 +00:00
|
|
|
|
2023-06-08 00:28:33 +00:00
|
|
|
$null = New-Module {
|
|
|
|
$path = "$HOME/Documents/TrackMania";
|
|
|
|
$softwareName = "TmUnitedForever";
|
|
|
|
|
2023-06-30 10:19:54 +00:00
|
|
|
function Backup-TmUnited([Context] $context) {
|
2023-06-30 12:23:20 +00:00
|
|
|
Write-Host "Backing up TrackMania United Forever";
|
2023-06-08 00:28:33 +00:00
|
|
|
$context.Backup($path, $context.SoftwareArchive($softwareName), @("-i@`"$PSScriptRoot/include.txt`""));
|
|
|
|
}
|
2023-07-02 11:58:23 +00:00
|
|
|
|
|
|
|
function Restore-TmUnited([Context] $context) {
|
|
|
|
$feature = "DirectPlay";
|
|
|
|
Write-Host "Restoring TrackMania United Forever";
|
|
|
|
|
|
|
|
if (-not (Get-WindowsOptionalFeature -Online -FeatureName $feature).State) {
|
|
|
|
Enable-WindowsOptionalFeature -Online -FeatureName $feature;
|
|
|
|
}
|
|
|
|
|
|
|
|
Write-Information "Determining location of setup file";
|
|
|
|
$exePath;
|
|
|
|
|
|
|
|
while (-not (Test-Path $exePath)) {
|
|
|
|
$exePath = Read-Host "Please drag'n'drop the setup file here or type the absolute path to the file";
|
|
|
|
|
|
|
|
if (-not (Test-Path $exePath)) {
|
|
|
|
Write-Error "A file at the specified path could not be found.";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Write-Information "Installing TrackMania United Forever";
|
|
|
|
Start-Process -Wait -FilePath $exePath -ArgumentList @("/Silent");
|
|
|
|
Write-Information "Removing desktop icon";
|
|
|
|
Remove-Item "$env:PUBLIC\Desktop\*TmUnitedForever*";
|
|
|
|
Write-Information "Restoring files";
|
|
|
|
$context.Restore($context.SoftwareArchive($softwareName), $path);
|
|
|
|
}
|
2023-06-06 23:21:47 +00:00
|
|
|
}
|