Use shared before local

This commit is contained in:
2023-04-01 13:56:11 -07:00
parent d3794bf9cc
commit 5c3a151cd3
4 changed files with 33 additions and 24 deletions

View File

@ -5,6 +5,11 @@ public interface IPerson
// ...
Models.PersonName TestStatic_GetPersonName(string name) =>
GetPersonName(name);
static Models.PersonName GetPersonName(string name) =>
PersonName.Create(name);
bool TestStatic_IsDefaultName(string mappingDefaultName, string value) =>
IsDefaultName(mappingDefaultName, value);
static bool IsDefaultName(string mappingDefaultName, string value) =>

View File

@ -23,6 +23,16 @@ public interface IPersonBirthday
static double? GetAge(Models.PersonBirthday birthday) =>
PersonBirthday.GetAge(birthday);
int TestStatic_GetHour(bool alive, char sex) =>
GetHour(alive, sex);
static int GetHour(bool alive, char sex) =>
alive ? sex is 'M' ? 5 : sex is 'F' ? 4 : sex is 'U' ? 2 : throw new NotImplementedException() : sex is 'M' ? 15 : sex is 'F' ? 14 : sex is 'U' ? 3 : throw new NotImplementedException();
int TestStatic_GetHour(bool alive, ConsoleKey consoleKey) =>
GetHour(alive, consoleKey);
static int GetHour(bool alive, ConsoleKey consoleKey) =>
GetHour(alive, consoleKey.ToString()[0]);
Models.PersonBirthday TestStatic_GetPersonBirthday(long ticks) =>
new(new(ticks));
static Models.PersonBirthday GetPersonBirthday(long ticks) =>

View File

@ -166,11 +166,8 @@ internal abstract class Person
sexLine = "1 SEX U";
else
{
string code;
if (deathLine is null or not "1 DEAT Y")
code = sexLine[6] is 'M' ? "05" : sexLine[6] is 'F' ? "04" : sexLine[6] is 'U' ? "02" : throw new NotImplementedException();
else
code = sexLine[6] is 'M' ? "15" : sexLine[6] is 'F' ? "14" : sexLine[6] is 'U' ? "03" : throw new NotImplementedException();
int hours = IPersonBirthday.GetHour(deathLine is null or not "1 DEAT Y", sexLine[6]);
string code = hours.ToString("00");
if (directory.EndsWith("00"))
directory = string.Concat(directory[..^2], code);
else if (directory.EndsWith("01"))