PortValhalla/scripts/Windows/Software/rewasd/Main.ps1

48 lines
1.7 KiB
PowerShell

& {
. "$PSScriptRoot/../../lib/Restoration.ps1";
. "$PSScriptRoot/../../../lib/BrowserAutomation.ps1";
. "$PSScriptRoot/../../../lib/Software.ps1";
. "$PSScriptRoot/../../../lib/System.ps1";
$path = "$env:Public/Documents/reWASD";
Start-SoftwareInstaller @args `
-Backup {
param([string] $Name)
Add-BackupArtifacts -Path "$Name" -Source $path `
-Exclude @(
"Logs",
"Presets",
"Profiles/Desktop",
"Profiles/Duality",
"Profiles/Handheld",
"Profiles/Fortnite",
"Profiles/PS4 Remote*",
"Profiles/Switch console",
"Profiles/Switch to Xbox 360",
"Profiles/Valorant",
"Profiles/xCloud"
);
} `
-Installer {
Write-Host "Downloading reWASD…";
$dir = New-TemporaryDirectory;
Import-BrowserAutomation;
$file = Start-BrowserDownload `
-URL "https://rewasd.com/" `
-ButtonSelector ([OpenQA.Selenium.By]::XPath('//nav[contains(@class, "navbar")]//a[contains(@class, "btn-outline-default")][normalize-space(text()) = "Download"]')) `
-OutDir $dir `
-Timeout 1;
Write-Host "Installing reWASD…";
Start-Process -Wait -FilePath $($file.FullName) -ArgumentList "/S";
Remove-Item -Recurse $dir;
Remove-DesktopIcon "*reWASD*";
} `
-Configurator {
param([string] $Name)
Expand-BackupArtifacts -Path "$Name" -Target $path;
};
} @args;