Removed Storage
<LangVersion>10.0</LangVersion>
This commit is contained in:
@ -80,11 +80,6 @@ public interface IPersonBirthday
|
||||
static string GetFormatted(string personBirthdayFormat, long personKey) =>
|
||||
GetFormatted(personBirthdayFormat, GetPersonBirthday(personKey));
|
||||
|
||||
Models.PersonBirthday TestStatic_GetNextBirthDate(Properties.IStorage storage) =>
|
||||
GetNextBirthDate(storage);
|
||||
static Models.PersonBirthday GetNextBirthDate(Properties.IStorage storage) =>
|
||||
throw new Exception(storage.ToString()); // Person.GetNextBirthDate(storage);
|
||||
|
||||
TimeSpan? TestStatic_Get(DateTime minimumDateTime, Models.PersonBirthday personBirthday) =>
|
||||
GetTimeSpan(minimumDateTime, isWrongYear: false, personBirthday);
|
||||
static TimeSpan? GetTimeSpan(DateTime minimumDateTime, Models.PersonBirthday personBirthday) =>
|
||||
@ -95,11 +90,6 @@ public interface IPersonBirthday
|
||||
static Models.PersonBirthday? GetPersonBirthday(string personBirthdayFormat, string personKeyFormatted) =>
|
||||
PersonBirthday.GetPersonBirthday(personBirthdayFormat, personKeyFormatted);
|
||||
|
||||
bool TestStatic_DoesBirthDateExits(Properties.IStorage storage, Models.PersonBirthday personBirthday) =>
|
||||
DoesBirthDateExits(storage, personBirthday);
|
||||
static bool DoesBirthDateExits(Properties.IStorage storage, Models.PersonBirthday personBirthday) =>
|
||||
DoesBirthDateExits(storage, personBirthday);
|
||||
|
||||
TimeSpan? TestStatic_Get(long minimumDateTimeTicks, bool? isWrongYear, Models.PersonBirthday personBirthday) =>
|
||||
GetTimeSpan(minimumDateTimeTicks, isWrongYear, personBirthday);
|
||||
static TimeSpan? GetTimeSpan(long minimumDateTimeTicks, bool? isWrongYear, Models.PersonBirthday personBirthday) =>
|
||||
@ -110,16 +100,6 @@ public interface IPersonBirthday
|
||||
static TimeSpan? GetTimeSpan(DateTime minimumDateTime, bool? isWrongYear, Models.PersonBirthday personBirthday) =>
|
||||
PersonBirthday.GetTimeSpan(minimumDateTime, isWrongYear, personBirthday);
|
||||
|
||||
string TestStatic_GetFileFullName(Properties.IStorage storage, string personBirthdayFormat, Models.PersonBirthday personBirthday) =>
|
||||
GetFileFullName(storage, personBirthdayFormat, personBirthday);
|
||||
static string GetFileFullName(Properties.IStorage storage, string personBirthdayFormat, Models.PersonBirthday personBirthday) =>
|
||||
Path.Combine(storage.PeopleRootDirectory, "{}", GetFileName(personBirthdayFormat, personBirthday));
|
||||
|
||||
bool TestStatic_DoesBirthDateExits(Properties.IStorage storage, string personBirthdayFormat, Models.PersonBirthday personBirthday) =>
|
||||
DoesBirthDateExits(storage, personBirthdayFormat, personBirthday);
|
||||
static bool DoesBirthDateExits(Properties.IStorage storage, string personBirthdayFormat, Models.PersonBirthday personBirthday) =>
|
||||
File.Exists(GetFileFullName(storage, personBirthdayFormat, personBirthday));
|
||||
|
||||
DateTime? TestStatic_GetDateTime(string personBirthdayFormat, string personKeyFormatted) =>
|
||||
GetDateTime(personBirthdayFormat, personKeyFormatted);
|
||||
static DateTime? GetDateTime(string personBirthdayFormat, string personKeyFormatted) =>
|
||||
|
@ -10,10 +10,10 @@ public interface IPersonContainer
|
||||
static List<long> GetPersonKeys(IEnumerable<Models.PersonContainer> personContainers) =>
|
||||
PersonContainer.GetPersonKeys(personContainers);
|
||||
|
||||
List<Models.PersonContainer> TestStatic_GetPersonContainers(Properties.IStorage storage, string personBirthdayFormat, char[] personCharacters, string facesFileNameExtension) =>
|
||||
GetPersonContainers(storage, personBirthdayFormat, personCharacters, facesFileNameExtension);
|
||||
static List<Models.PersonContainer> GetPersonContainers(Properties.IStorage storage, string personBirthdayFormat, char[] personCharacters, string facesFileNameExtension) =>
|
||||
PersonContainer.GetPersonContainers(storage, personBirthdayFormat, personCharacters, facesFileNameExtension);
|
||||
List<Models.PersonContainer> TestStatic_GetPersonContainers(string a2PeopleSingletonDirectory, string personBirthdayFormat, char[] personCharacters, string facesFileNameExtension) =>
|
||||
GetPersonContainers(a2PeopleSingletonDirectory, personBirthdayFormat, personCharacters, facesFileNameExtension);
|
||||
static List<Models.PersonContainer> GetPersonContainers(string a2PeopleSingletonDirectory, string personBirthdayFormat, char[] personCharacters, string facesFileNameExtension) =>
|
||||
PersonContainer.GetPersonContainers(a2PeopleSingletonDirectory, personBirthdayFormat, personCharacters, facesFileNameExtension);
|
||||
|
||||
string? TestStatic_VerifyAge(char numberSign, string personDisplayDirectory, string? minusOne, string personDisplayDirectoryName, int? approximateYears, List<(string PersonKeyFormatted, Models.PersonBirthday PersonBirthday)> collection) =>
|
||||
VerifyAge(numberSign, personDisplayDirectory, minusOne, personDisplayDirectoryName, approximateYears, collection);
|
||||
|
@ -1,14 +0,0 @@
|
||||
namespace View_by_Distance.Shared.Models.Stateless.Methods;
|
||||
|
||||
public interface IStorage
|
||||
{
|
||||
|
||||
// ...
|
||||
|
||||
bool TestStatic_WriteAllText(string path, string contents, bool updateDateWhenMatches, bool compareBeforeWrite);
|
||||
static bool WriteAllText(string path, string contents, bool updateDateWhenMatches, bool compareBeforeWrite) => Storage.WriteAllText(path, contents, updateDateWhenMatches, compareBeforeWrite);
|
||||
|
||||
(string RootResultsDirectoryAbsoluteUri, string C_ResizeContentDirectory, string D_FacesContentDirectory, string E_DistanceCollectionDirectory) TestStatic_GetTuple(Properties.IStorage storage);
|
||||
static (string RootResultsDirectoryAbsoluteUri, string C_ResizeContentDirectory, string D_FacesContentDirectory, string E_DistanceCollectionDirectory) GetTuple(Properties.IStorage storage) => new(new Uri(storage.RootResultsDirectory).AbsoluteUri, Path.Combine(storage.ResizeRootDirectory, "()"), Path.Combine(storage.FaceRootDirectory, "()"), Path.Combine(storage.DistanceResultRootDirectory, "[]"));
|
||||
|
||||
}
|
@ -271,10 +271,9 @@ internal abstract class PersonContainer
|
||||
return results;
|
||||
}
|
||||
|
||||
internal static List<Models.PersonContainer> GetPersonContainers(Properties.IStorage storage, string personBirthdayFormat, char[] personCharacters, string facesFileNameExtension)
|
||||
internal static List<Models.PersonContainer> GetPersonContainers(string a2PeopleSingletonDirectory, string personBirthdayFormat, char[] personCharacters, string facesFileNameExtension)
|
||||
{
|
||||
List<Models.PersonContainer> results;
|
||||
string a2PeopleSingletonDirectory = Path.Combine(storage.PeopleRootDirectory, "{}");
|
||||
if (!Directory.Exists(a2PeopleSingletonDirectory))
|
||||
_ = Directory.CreateDirectory(a2PeopleSingletonDirectory);
|
||||
string a2PeopleSingletonDirectoryChar;
|
||||
|
@ -1,42 +0,0 @@
|
||||
namespace View_by_Distance.Shared.Models.Stateless.Methods;
|
||||
|
||||
internal abstract class Storage
|
||||
{
|
||||
|
||||
// ...
|
||||
|
||||
internal static bool WriteAllText(string path, string contents, bool updateDateWhenMatches, bool compareBeforeWrite)
|
||||
{
|
||||
bool result;
|
||||
string text;
|
||||
if (!compareBeforeWrite)
|
||||
result = true;
|
||||
else
|
||||
{
|
||||
if (!File.Exists(path))
|
||||
text = string.Empty;
|
||||
else
|
||||
text = File.ReadAllText(path);
|
||||
result = text != contents;
|
||||
if (!result && updateDateWhenMatches)
|
||||
File.SetLastWriteTime(path, DateTime.Now);
|
||||
}
|
||||
if (result)
|
||||
{
|
||||
if (path.Contains("()"))
|
||||
File.WriteAllText(path, contents);
|
||||
else if (path.Contains("{}") && !path.EndsWith(".json"))
|
||||
File.WriteAllText(path, contents);
|
||||
else if (path.Contains("[]") && !path.EndsWith(".json"))
|
||||
File.WriteAllText(path, contents);
|
||||
else if (path.Contains("{}") && path.EndsWith(".json") && contents[0] == '{')
|
||||
File.WriteAllText(path, contents);
|
||||
else if (path.Contains("[]") && path.EndsWith(".json") && contents[0] == '[')
|
||||
File.WriteAllText(path, contents);
|
||||
else
|
||||
File.WriteAllText(path, contents);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user