Skip to content

Commit

Permalink
oprava stahovani loga obce
Browse files Browse the repository at this point in the history
  • Loading branch information
martinrotter committed Jun 17, 2024
1 parent 6e7f215 commit aee0656
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions ZZZO/ZZZO/ZzzoCore.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.IO;
using System.Net.Http;
using System.Net.Http.Headers;
using HtmlAgilityPack;
using Microsoft.Win32;
using ZZZO.Common;
Expand Down Expand Up @@ -141,6 +142,10 @@ public Task<IEnumerable<CityLogo>> DownloadCityLogos(string cityName)
string baseUrl = $"{Constants.Uris.RekosBase}/vyhledani-symbolu?obec={cityName}&sort=municipality.name&page=";
int pageNumber = 1;

cl.DefaultRequestHeaders.UserAgent.Add(new ProductInfoHeaderValue(
Constants.Names.AppShortName,
Constants.Names.AppBuildRevision));

string mainHtml = cl
.GetStringAsync(baseUrl + pageNumber++)
.Result;
Expand Down Expand Up @@ -197,6 +202,11 @@ public Task<CityLogo> DownloadFullCityLogo(CityLogo cityLogo)
return Task.Run(() =>
{
using HttpClient cl = new HttpClient();

cl.DefaultRequestHeaders.UserAgent.Add(new ProductInfoHeaderValue(
Constants.Names.AppShortName,
Constants.Names.AppBuildRevision));

cityLogo.LogoObceData = cl.GetByteArrayAsync(cityLogo.LogoObceUrl).Result;
return cityLogo;
});
Expand Down

0 comments on commit aee0656

Please sign in to comment.