diff --git a/Person/Person.cs b/Person/Person.cs index 774a627..0ed58ad 100644 --- a/Person/Person.cs +++ b/Person/Person.cs @@ -104,7 +104,7 @@ public class Person log.Information(". . ."); if (string.IsNullOrEmpty(line) || line.Length < 2) continue; - firstName = line; + firstName = line.Trim(); break; } if (firstName is null) @@ -117,7 +117,7 @@ public class Person log.Information(". . ."); if (string.IsNullOrEmpty(line) || line.Length < 2) continue; - lastName = line; + lastName = line.Trim(); break; } if (lastName is null) @@ -143,6 +143,8 @@ public class Person log.Information(". . ."); if (consoleKey is not ConsoleKey.Y and not ConsoleKey.N) continue; + else if (consoleKey is ConsoleKey.N) + break; deceased = consoleKey == ConsoleKey.Y; dateTime = null; approximateYears = null; @@ -162,11 +164,11 @@ public class Person log.Information(". . ."); if (string.IsNullOrEmpty(line) || !int.TryParse(line, out _)) continue; - approximateYears = line; + approximateYears = line.Trim(); } else { - month = line; + month = line.Trim(); log.Information("Enter persons birthday day (press enter if not known)"); line = System.Console.ReadLine(); log.Information(". . ."); @@ -177,16 +179,16 @@ public class Person log.Information(". . ."); if (string.IsNullOrEmpty(line) || !int.TryParse(line, out _)) continue; - approximateYears = line; + approximateYears = line.Trim(); } else { - day = line; + day = line.Trim(); log.Information("Enter persons birthday year (press enter if not known)"); line = System.Console.ReadLine(); log.Information(". . ."); if (!string.IsNullOrEmpty(line)) - year = line; + year = line.Trim(); else { log.Information("Enter persons approximate age"); @@ -194,7 +196,7 @@ public class Person log.Information(". . ."); if (string.IsNullOrEmpty(line) || !int.TryParse(line, out _)) continue; - approximateYears = line; + approximateYears = line.Trim(); } } } @@ -223,7 +225,7 @@ public class Person log.Information(". . ."); if (!string.IsNullOrEmpty(line)) { - uri = new(line); + uri = new(line.Trim()); if (uri.HostNameType != UriHostNameType.Dns) continue; task = httpClient.GetByteArrayAsync(uri);