diff --git a/pilot_install.ps1 b/pilot_install.ps1 index 3326a08..7058403 100644 --- a/pilot_install.ps1 +++ b/pilot_install.ps1 @@ -31,8 +31,6 @@ Add-Type -AssemblyName System.Windows.Forms [System.Windows.Forms.Application]::EnableVisualStyles() # ===== Configurações de versão Maio2026 ===== -$VersionPortrait = "2026.05.14.1" -$VersionPortraitR = "2026.05.14.1" $VersionDual = "2026.05.21.2" $VersionDualR = "2026.05.21.2" $VersionBotoneira = "2026.01.13.1" @@ -136,22 +134,42 @@ function Download-ReleaseZip { [string]$Version ) - $zipFileName = "NDGDRelease-$Version.zip" - $zipUrl = "$ReleaseBaseUrl/$zipFileName" - $zipDest = "C:\pilotgames\downloads\$zipFileName" + $downloadsPath = "C:\pilotgames\downloads" + + if (-not (Test-Path $downloadsPath)) { + New-Item -ItemType Directory -Path $downloadsPath -Force | Out-Null + } + + # Verifica primeiro se a release já existe localmente + $localFiles = @( + (Join-Path $downloadsPath "NDGDRelease-$Version.zip"), + (Join-Path $downloadsPath "BRGDRelease-$Version.zip") + ) + + foreach ($file in $localFiles) { + if (Test-Path $file) { + Write-Log "Release encontrada localmente:" + Write-Log $file + Write-Log "Download ignorado." + return $file + } + } + + # Não encontrou localmente, determina qual arquivo baixar + if ($ReleaseBaseUrl -match "br") { + $zipFileName = "BRGDRelease-$Version.zip" + } + else { + $zipFileName = "NDGDRelease-$Version.zip" + } + + $zipUrl = "$ReleaseBaseUrl/$zipFileName" + $zipDest = Join-Path $downloadsPath $zipFileName Write-Log "Downloading release package..." Write-Log "URL: $zipUrl" try { - if (-not (Test-Path "C:\pilotgames\downloads")) { - New-Item -ItemType Directory -Path "C:\pilotgames\downloads" -Force | Out-Null - } - - if (Test-Path $zipDest) { - Remove-Item -Path $zipDest -Force -ErrorAction SilentlyContinue - } - Invoke-WebRequest -Uri $zipUrl -OutFile $zipDest -UseBasicParsing Write-Log "Download completed: $zipDest" return $zipDest