Skip to content

Commit

Permalink
No comment
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidKarlas committed Jun 23, 2024
1 parent a50dedc commit 21a8f6c
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion OsmGursBuildingImport/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Net.Http.Json;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using ICSharpCode.SharpZipLib.BZip2;
Expand Down Expand Up @@ -173,10 +174,16 @@ static async Task<int> Process(string[] args, CancellationToken cancellationToke
return null;
}

class RedirectJson
{
public string? url { get; set; }
}

private static async Task DownloadFileAsync(string url, string filePath)
{
var http = new HttpClient();
using var stream = await http.GetStreamAsync(url);
var redirectJson = await http.GetFromJsonAsync<RedirectJson>(url);
using var stream = await http.GetStreamAsync(redirectJson.url);
using var fileStream = new FileStream(filePath, FileMode.Create);
await stream.CopyToAsync(fileStream);
}
Expand Down

0 comments on commit 21a8f6c

Please sign in to comment.