Files
uwu2x/install.ps1

58 lines
2.1 KiB
PowerShell

Set-StrictMode -Version Latest
$ErrorActionPreference = "Stop"
$ProgressPreference = "SilentlyContinue"
$EXT_NAME = "uwu2x-pro"
$EXT_VERSION = "8.7"
$ZIP_URL = "https://cloud.alixz.ovh/f/uwu2x-$EXT_VERSION-win.zip"
$TMP_DIR = New-Item -ItemType Directory -Path ([System.IO.Path]::GetTempPath()) -Name ([guid]::NewGuid())
$ZIP_PATH = Join-Path $TMP_DIR "uwu2x-$EXT_VERSION-win.zip"
$USER_EXT_DIR = "$env:APPDATA\Adobe\CEP\extensions"
$SYSTEM_EXT_DIR = "C:\Program Files (x86)\Common Files\Adobe\CEP\extensions"
if (Get-Process -Name "AfterFX" -ErrorAction SilentlyContinue) {
Write-Host "After Effects is currently running."
Write-Host "Please close it and run the installer again."
Exit 1
}
Write-Host "Enabling Adobe CEP debug mode..."
foreach ($v in 14,13,12,11,10,9,8) {
$p = "HKCU:\Software\Adobe\CSXS.$v"
if (-not (Test-Path $p)) { New-Item -Path $p -Force | Out-Null }
New-ItemProperty -Path $p -Name PlayerDebugMode -Value 1 -PropertyType DWord -Force | Out-Null
}
Write-Host "Downloading extension..."
Invoke-WebRequest -Uri $ZIP_URL -OutFile $ZIP_PATH -UseBasicParsing
Write-Host "Extracting files..."
Expand-Archive -Path $ZIP_PATH -DestinationPath $TMP_DIR -Force
$SRC = Join-Path (Join-Path $TMP_DIR "uwu2x-$EXT_VERSION-win") $EXT_NAME
if (Test-Path $USER_EXT_DIR) {
$TARGET_DIR = $USER_EXT_DIR
} else {
if (-not (Test-Path $SYSTEM_EXT_DIR)) { New-Item -ItemType Directory -Path $SYSTEM_EXT_DIR -Force | Out-Null }
$TARGET_DIR = $SYSTEM_EXT_DIR
}
if (Test-Path "$USER_EXT_DIR\$EXT_NAME") {
Write-Host "Removing existing user installation."
Remove-Item -Recurse -Force "$USER_EXT_DIR\$EXT_NAME"
}
if (Test-Path "$SYSTEM_EXT_DIR\$EXT_NAME") {
Write-Host "Removing existing system installation"
Remove-Item -Recurse -Force "$SYSTEM_EXT_DIR\$EXT_NAME"
}
Write-Host "Installing extension..."
New-Item -ItemType Directory -Path $TARGET_DIR -Force | Out-Null
Copy-Item -Recurse -Force $SRC $TARGET_DIR
Remove-Item -Recurse -Force $TMP_DIR
Write-Host "Installation completed successfully."
Write-Host "You can now launch After Effects."