From dcb3eddb8e9e0cb644b0c5f57067ae45bca498c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20Sard=C3=A1?= Date: Tue, 21 Jul 2026 16:34:51 -0300 Subject: [PATCH] =?UTF-8?q?Atualizacao=20Pilot=5FInstaller=20nao=20baixar?= =?UTF-8?q?=20se=20j=C3=A1=20tiver=20o=20arquivo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pilot_install.ps1 | 44 +++++++++++++++++++++++++++++++------------- 1 file changed, 31 insertions(+), 13 deletions(-) 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