Fix TPA map hash calculation. (#288)
[platform/upstream/coreclr.git] / dotnet-download.ps1
1 param(
2     [parameter(Mandatory=$true)]$DotnetRemotePath,
3     [parameter(Mandatory=$true)]$DotnetLocalPath,
4     [parameter(Mandatory=$true)]$DotnetPath
5 )
6
7 $retryCount = 0
8 $success = $false
9
10 do {
11     try {
12         Write-Output "Downloading from $DotnetRemotePath"
13         (New-Object Net.WebClient).DownloadFile($DotnetRemotePath, $DotnetLocalPath)
14         $success = $true
15     } catch { 
16         if ($retryCount -ge 6) {
17             Write-Output "Maximum of 5 retries exceeded. Aborting"
18             throw
19         } 
20         else { 
21             $retryCount++
22             $retryTime = 5 * $retryCount
23             Write-Output "Download failed. Retrying in $retryTime seconds"
24             Start-Sleep -Seconds (5 * $retryCount)
25         }
26     }
27 } while ($success -eq $false)
28
29 Write-Output "Download finished"
30 Add-Type -Assembly 'System.IO.Compression.FileSystem' -ErrorVariable AddTypeErrors
31
32 if ($AddTypeErrors.Count -eq 0) { 
33     [System.IO.Compression.ZipFile]::ExtractToDirectory($DotnetLocalPath, $DotnetPath) 
34 }
35 else { 
36     (New-Object -com shell.application).namespace($DotnetPath).CopyHere((new-object -com shell.application).namespace($DotnetLocalPath).Items(), 16)
37 }