better downloader handling

This commit is contained in:
SuspiciousActivity committed 2022-05-20 20:42:37 +02:00
1 parent 175c6c9c65
commit 77e3fb614e
1 file changed
+12 -3
+12 -3
View File
@@ -33,7 +33,9 @@ try {
Write-Host 'Fetching VALORANT config from Riot Games...' -ForegroundColor Green Write-Host 'Fetching VALORANT config from Riot Games...' -ForegroundColor Green
$patchConfigs = (ConvertFrom-Json (Invoke-WebRequest -Uri 'https://clientconfig.rpg.riotgames.com/api/v1/config/public?namespace=keystone.products.valorant.patchlines').Content).'keystone.products.valorant.patchlines.live'.platforms.win.configurations $patchConfigs = (ConvertFrom-Json (Invoke-WebRequest -Uri 'https://clientconfig.rpg.riotgames.com/api/v1/config/public?namespace=keystone.products.valorant.patchlines').Content).'keystone.products.valorant.patchlines.live'.platforms.win.configurations
} catch { } catch {
Write-Host 'Error contacting Riot Games servers' -ForegroundColor Red
Write-Host $_ Write-Host $_
Read-Host
Exit Exit
} }
@@ -201,14 +203,21 @@ try {
if ($patchUrl -ne $lastPatchUrl) { if ($patchUrl -ne $lastPatchUrl) {
Write-Host 'Downloading new language files...' -ForegroundColor Green Write-Host 'Downloading new language files...' -ForegroundColor Green
$patchUrl | Out-File -FilePath (-join($savePath, 'url.txt')) $downloaderProcess = Start-Process -PassThru -Wait -NoNewWindow -FilePath (-join($savePath, $manifestDownloaderFile)) -ArgumentList ($patchUrl,'-b','https://valorant.secure.dyn.riotcdn.net/channels/public/bundles','-l',$config.textLang,$config.voiceLang,'-o',$savePath,'-f','.+Text-WindowsClient.+')
Start-Process -Wait -NoNewWindow -FilePath (-join($savePath, $manifestDownloaderFile)) -ArgumentList ($patchUrl,'-b','https://valorant.secure.dyn.riotcdn.net/channels/public/bundles','-l',$config.textLang,$config.voiceLang,'-o',$savePath,'-f','.+Text-WindowsClient.+') if ($downloaderProcess.ExitCode -eq 0) {
Write-Host 'Downloaded new language files!' -ForegroundColor Green $patchUrl | Out-File -FilePath (-join($savePath, 'url.txt'))
Write-Host 'Downloaded new language files!' -ForegroundColor Green
} else {
Write-Host 'Error trying to download new language files!' -ForegroundColor Red
Read-Host
Exit
}
} else { } else {
Write-Host 'Up to date!' -ForegroundColor Green Write-Host 'Up to date!' -ForegroundColor Green
} }
} catch { } catch {
Write-Error 'Can not check for new language files' -ForegroundColor Red Write-Error 'Can not check for new language files' -ForegroundColor Red
Read-Host
Exit Exit
} }