diff --git a/Person/Person.cs b/Person/Person.cs index 3c2b5b8..4ac98cd 100644 --- a/Person/Person.cs +++ b/Person/Person.cs @@ -63,6 +63,10 @@ public class Person private void Loop(long ticks, ILogger log) { + Uri uri; + HttpClient httpClient = new(); + string fileName; + Task task; int age; string json; string code; @@ -210,6 +214,18 @@ public class Person personDisplayDirectory = Path.Combine(_AppSettings.SaveDirectory, ticks.ToString(), $"{personName.First.Value} {personName.Last.Value}~{approximateYears}"); if (!Directory.Exists(personDisplayDirectory)) _ = Directory.CreateDirectory(personDisplayDirectory); + log.Information("Enter url to download an image (press enter if none)"); + line = System.Console.ReadLine(); + log.Information(". . ."); + if (!string.IsNullOrEmpty(line)) + { + uri = new(line); + if (uri.HostNameType != UriHostNameType.Dns) + continue; + task = httpClient.GetByteArrayAsync(uri); + fileName = Path.Combine(personDisplayDirectory, Path.GetFileName(uri.LocalPath)); + File.WriteAllBytes(fileName, task.Result); + } if (dateTime is null) personKeyFormatted = "2"; else diff --git a/Person/Person.csproj b/Person/Person.csproj index 95d2084..c686fbc 100644 --- a/Person/Person.csproj +++ b/Person/Person.csproj @@ -5,7 +5,7 @@ enable Exe win-x64;linux-x64 - net7.0 + net6.0 7ca5318a-9332-4217-b9d8-cae696629934 diff --git a/Property/Property.csproj b/Property/Property.csproj index 2fccb80..2083bfd 100644 --- a/Property/Property.csproj +++ b/Property/Property.csproj @@ -5,7 +5,7 @@ enable library win-x64;linux-x64 - net7.0 + net6.0 Phares.View.by.Distance.Property diff --git a/Shared/View-by-Distance.Shared.csproj b/Shared/View-by-Distance.Shared.csproj index 3301aeb..ec0d6dd 100644 --- a/Shared/View-by-Distance.Shared.csproj +++ b/Shared/View-by-Distance.Shared.csproj @@ -4,7 +4,7 @@ 10.0 enable win-x64;linux-x64 - net7.0 + net6.0 Phares.View.by.Distance.Shared