From aaa25e3ea12123c028dc54a8cf4ebba50f754bfa Mon Sep 17 00:00:00 2001 From: MOTifoYe <51001408+MOTifoYe@users.noreply.github.com> Date: Wed, 5 Oct 2022 22:42:15 +0700 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=BF=D0=BE=D0=BB=D0=BD=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D0=BF=D0=B0=D1=80=D1=81=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Появилась ещё одна провинция с запятой "Saint Helena, Ascension and Tristan da Cunha" Некоторые координаты представлены пустой строкой --- CV19/Services/DataService.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/CV19/Services/DataService.cs b/CV19/Services/DataService.cs index 05c2530..c2fb0d1 100644 --- a/CV19/Services/DataService.cs +++ b/CV19/Services/DataService.cs @@ -37,7 +37,8 @@ private static IEnumerable GetDataLines() if (string.IsNullOrWhiteSpace(line)) continue; yield return line .Replace("Korea,", "Korea -") - .Replace("Bonaire,", "Bonaire -"); + .Replace("Bonaire,", "Bonaire -") + .Replace("Saint Helena,", "Saint Helena -"); } } @@ -58,8 +59,8 @@ private static DateTime[] GetDates() => GetDataLines() { var province = row[0].Trim(); var country_name = row[1].Trim(' ', '"'); - var latitude = double.Parse(row[2], CultureInfo.InvariantCulture); - var longitude = double.Parse(row[3], CultureInfo.InvariantCulture); + var latitude = string.IsNullOrEmpty(row[2]) ? 0d : double.Parse(row[2], CultureInfo.InvariantCulture); + var longitude = string.IsNullOrEmpty(row[3]) ? 0d : double.Parse(row[3], CultureInfo.InvariantCulture); var counts = row.Skip(4).Select(int.Parse).ToArray(); yield return (province, country_name, (latitude, longitude), counts);