Removed Storage

<LangVersion>10.0</LangVersion>
This commit is contained in:
Mike Phares 2023-08-08 18:02:06 -07:00
parent 8b4d5248cb
commit 7a429de157
34 changed files with 35 additions and 218 deletions

View File

@ -1,7 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<ImplicitUsings>enable</ImplicitUsings>
<LangVersion>10.0</LangVersion>
<Nullable>enable</Nullable>
<OutputType>library</OutputType>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>

View File

@ -1,7 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<ImplicitUsings>enable</ImplicitUsings>
<LangVersion>10.0</LangVersion>
<Nullable>enable</Nullable>
<OutputType>Exe</OutputType>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>

View File

@ -1,7 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<ImplicitUsings>enable</ImplicitUsings>
<LangVersion>10.0</LangVersion>
<Nullable>enable</Nullable>
<OutputType>Exe</OutputType>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>

View File

@ -1,7 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<ImplicitUsings>enable</ImplicitUsings>
<LangVersion>10.0</LangVersion>
<Nullable>enable</Nullable>
<OutputType>Exe</OutputType>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>

View File

@ -1,7 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<ImplicitUsings>enable</ImplicitUsings>
<LangVersion>10.0</LangVersion>
<Nullable>enable</Nullable>
<OutputType>Exe</OutputType>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>

View File

@ -1,7 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<ImplicitUsings>enable</ImplicitUsings>
<LangVersion>10.0</LangVersion>
<Nullable>enable</Nullable>
<OutputType>library</OutputType>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>

View File

@ -1,7 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<ImplicitUsings>enable</ImplicitUsings>
<LangVersion>10.0</LangVersion>
<Nullable>enable</Nullable>
<OutputType>Exe</OutputType>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>

View File

@ -1,7 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<ImplicitUsings>enable</ImplicitUsings>
<LangVersion>10.0</LangVersion>
<Nullable>enable</Nullable>
<OutputType>library</OutputType>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>

View File

@ -1,7 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<ImplicitUsings>enable</ImplicitUsings>
<LangVersion>10.0</LangVersion>
<Nullable>enable</Nullable>
<OutputType>library</OutputType>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>

View File

@ -1,7 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<ImplicitUsings>enable</ImplicitUsings>
<LangVersion>10.0</LangVersion>
<Nullable>enable</Nullable>
<OutputType>library</OutputType>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>

View File

@ -117,16 +117,14 @@ public partial class DlibDotNet
ProgressBarOptions options = new() { ProgressCharacter = '─', ProgressBarOnBottom = true, DisableBottomPercentage = true };
using ProgressBar progressBar = new(1, message, options);
progressBar.Tick();
string rootDirectory = propertyConfiguration.RootDirectory;
string peopleRootDirectory = Property.Models.Stateless.IResult.GetResultsDateGroupDirectory(propertyConfiguration, nameof(A2_People));
string? rootResultsDirectory = Path.GetDirectoryName(Path.GetDirectoryName(peopleRootDirectory)) ?? throw new Exception();
Storage storage = new(rootDirectory, rootResultsDirectory, peopleRootDirectory);
_ = Shared.Models.Stateless.Methods.IPath.DeleteEmptyDirectories(Path.Combine(peopleRootDirectory, propertyConfiguration.ResultSingleton));
string a2PeopleSingletonDirectory = Property.Models.Stateless.IResult.GetResultsDateGroupDirectory(configuration.PropertyConfiguration, nameof(A2_People), "{}");
string a2PeopleContentDirectory = Property.Models.Stateless.IResult.GetResultsDateGroupDirectory(configuration.PropertyConfiguration, nameof(A2_People), "([])");
personContainers = new(IPersonContainer.GetPersonContainers(storage, configuration.PersonBirthdayFormat, configuration.PersonCharacters.ToArray(), _Faces.FileNameExtension));
personContainers = new(IPersonContainer.GetPersonContainers(a2PeopleSingletonDirectory, configuration.PersonBirthdayFormat, configuration.PersonCharacters.ToArray(), _Faces.FileNameExtension));
if (configuration.JLinks.Where(l => !string.IsNullOrEmpty(l)).Any())
{
string a2PeopleSingletonDirectory = Property.Models.Stateless.IResult.GetResultsDateGroupDirectory(configuration.PropertyConfiguration, nameof(A2_People), "{}");
_JLinkResolvedDirectories.AddRange(Map.Models.Stateless.Methods.IMapLogic.GetJLinkDirectories(configuration.GenealogicalDataCommunicationFile, configuration.JLinks, configuration.PersonBirthdayFormat, configuration.PersonCharacters.ToArray(), a2PeopleSingletonDirectory, a2PeopleContentDirectory));
if (_JLinkResolvedDirectories.Count == 0)
throw new Exception(nameof(Map.Models.Stateless.Methods.IMapLogic.GetJLinkDirectories));
@ -832,8 +830,9 @@ public partial class DlibDotNet
}
}
private void MapLogic(long ticks, ReadOnlyCollection<Container> containers, string dResultsFullGroupDirectory, string d2ResultsFullGroupDirectory, string fPhotoPrismContentDirectory, MapLogic mapLogic, string outputResolution, ReadOnlyDictionary<long, List<int>> personKeyToIds, ReadOnlyCollection<Shared.Models.Face> distinctFilteredFaces, ReadOnlyCollection<Mapping> distinctFilteredMappingCollection)
private void MapLogic(long ticks, ReadOnlyCollection<Container> containers, string fPhotoPrismContentDirectory, MapLogic mapLogic, string outputResolution, ReadOnlyDictionary<long, List<int>> personKeyToIds, ReadOnlyCollection<Shared.Models.Face> distinctFilteredFaces, ReadOnlyCollection<Mapping> distinctFilteredMappingCollection)
{
(_, _, string dResultsFullGroupDirectory, string d2ResultsFullGroupDirectory) = GetResultsFullGroupDirectories(outputResolution);
string dFacesContentDirectory = Path.Combine(dResultsFullGroupDirectory, _Configuration.PropertyConfiguration.ResultContent);
string d2FacePartsContentDirectory = Path.Combine(d2ResultsFullGroupDirectory, _Configuration.PropertyConfiguration.ResultContent);
string d2FacePartsContentCollectionDirectory = Path.Combine(d2ResultsFullGroupDirectory, "[()]");
@ -962,7 +961,7 @@ public partial class DlibDotNet
return results;
}
private static void Verify(string eDistanceContentDirectory, ReadOnlyCollection<Item> distinctFilteredItems)
private static void SavePropertyShortcutsForOutputResolutions(string eDistanceContentDirectory, ReadOnlyCollection<Item> distinctFilteredItems)
{
#if VerifyItem
bool found;
@ -1106,9 +1105,6 @@ public partial class DlibDotNet
string aResultsFullGroupDirectory;
string bResultsFullGroupDirectory;
string cResultsFullGroupDirectory;
string dResultsFullGroupDirectory;
string c2ResultsFullGroupDirectory;
string d2ResultsFullGroupDirectory;
string fPhotoPrismContentDirectory;
const string fileSearchFilter = "*";
string fPhotoPrismSingletonDirectory;
@ -1208,6 +1204,8 @@ public partial class DlibDotNet
ReadOnlyCollection<Item> distinctFilteredItems = Shared.Models.Stateless.Methods.IContainer.GetItems(_Configuration.PropertyConfiguration, new(containers), distinctItems: true, filterItems: true);
if (_Configuration.LookForAbandoned)
{
string dResultsFullGroupDirectory;
string d2ResultsFullGroupDirectory;
foreach (string outputResolution in _Configuration.OutputResolutions)
{
(cResultsFullGroupDirectory, _, dResultsFullGroupDirectory, d2ResultsFullGroupDirectory) = GetResultsFullGroupDirectories(outputResolution);
@ -1215,7 +1213,6 @@ public partial class DlibDotNet
}
}
_Distance.Clear();
Verify(eDistanceContentDirectory, distinctFilteredItems);
ReadOnlyCollection<Shared.Models.Face> distinctFilteredFaces = Map.Models.Stateless.Methods.IMapLogic.GetFaces(distinctFilteredItems);
ReadOnlyCollection<Mapping> distinctFilteredMappingCollection = GetMappings(_Configuration.PropertyConfiguration, containers, mapLogic, distinctItems: true);
if (runToDoCollectionFirst)
@ -1228,23 +1225,28 @@ public partial class DlibDotNet
if (_PropertyRootExistedBefore)
break;
personKeyToIds = mapLogic.GetPersonKeyToIds();
if (_Configuration.SavePropertyShortcutsForOutputResolutions.Contains(outputResolution))
SavePropertyShortcutsForOutputResolutions(eDistanceContentDirectory, distinctFilteredItems);
if (!string.IsNullOrEmpty(a2PeopleContentDirectory) && _Configuration.SaveShortcutsForOutputResolutions.Contains(outputResolution))
mapLogic.SaveShortcutsForOutputResolutionsPreMapLogic(eDistanceContentDirectory, personKeyToIds, distinctFilteredMappingCollection);
if (!string.IsNullOrEmpty(a2PeopleContentDirectory) && _Configuration.JLinks.Where(l => !string.IsNullOrEmpty(l)).Any() && _Configuration.SaveFilteredOriginalImagesFromJLinksForOutputResolutions.Contains(outputResolution))
mapLogic.SaveFilteredOriginalImagesFromJLinks(_Configuration.JLinks, personContainers, a2PeopleContentDirectory, personKeyToIds, distinctFilteredMappingCollection);
(cResultsFullGroupDirectory, c2ResultsFullGroupDirectory, dResultsFullGroupDirectory, d2ResultsFullGroupDirectory) = GetResultsFullGroupDirectories(outputResolution);
if (_ArgZeroIsConfigurationRootDirectory
&& _Configuration.SaveResizedSubfiles
&& outputResolution == _Configuration.OutputResolutions[0]
&& _Configuration.LoadOrCreateThenSaveDistanceResultsForOutputResolutions.Contains(outputResolution)
&& _Exceptions.Count == 0)
MapLogic(ticks, new(containers), dResultsFullGroupDirectory, d2ResultsFullGroupDirectory, fPhotoPrismContentDirectory, mapLogic, outputResolution, new(personKeyToIds), distinctFilteredFaces, distinctFilteredMappingCollection);
MapLogic(ticks, new(containers), fPhotoPrismContentDirectory, mapLogic, outputResolution, new(personKeyToIds), distinctFilteredFaces, distinctFilteredMappingCollection);
if (_Configuration.SaveRandomForOutputResolutions.Contains(outputResolution) && personKeyToIds.Count > 0 && distinctFilteredMappingCollection.Count > 0)
_Random.Random(_Configuration.PropertyConfiguration, outputResolution, personKeyToIds, distinctFilteredMappingCollection);
if (_IsEnvironment.Development)
continue;
if (!_IsEnvironment.Development)
{
string dResultsFullGroupDirectory;
string c2ResultsFullGroupDirectory;
string d2ResultsFullGroupDirectory;
(cResultsFullGroupDirectory, c2ResultsFullGroupDirectory, dResultsFullGroupDirectory, d2ResultsFullGroupDirectory) = GetResultsFullGroupDirectories(outputResolution);
_ = Shared.Models.Stateless.Methods.IPath.DeleteEmptyDirectories(Path.Combine(aResultsFullGroupDirectory, _Configuration.PropertyConfiguration.ResultSingleton));
_ = Shared.Models.Stateless.Methods.IPath.DeleteEmptyDirectories(Path.Combine(bResultsFullGroupDirectory, _Configuration.PropertyConfiguration.ResultSingleton));
_ = Shared.Models.Stateless.Methods.IPath.DeleteEmptyDirectories(Path.Combine(cResultsFullGroupDirectory, _Configuration.PropertyConfiguration.ResultSingleton));

View File

@ -1,7 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<ImplicitUsings>enable</ImplicitUsings>
<LangVersion>10.0</LangVersion>
<Nullable>enable</Nullable>
<OutputType>Exe</OutputType>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>

View File

@ -79,6 +79,7 @@ public class Configuration
[Display(Name = "Save Mapped"), Required] public string[] SaveMappedForOutputResolutions { get; set; }
[Display(Name = "Save Resized Images by Person Key Formatted"), Required] public string[] SaveFilteredOriginalImagesFromJLinksForOutputResolutions { get; set; }
[Display(Name = "Save For Individually"), Required] public bool? SaveIndividually { get; set; }
[Display(Name = "Save Property Shortcuts for Output Resolutions"), Required] public string[] SavePropertyShortcutsForOutputResolutions { get; set; }
[Display(Name = "Save Random For Output Resolutions"), Required] public string[] SaveRandomForOutputResolutions { get; set; }
[Display(Name = "Save Resized Subfiles"), Required] public bool? SaveResizedSubfiles { get; set; }
[Display(Name = "Save Shortcuts"), Required] public string[] SaveShortcutsForOutputResolutions { get; set; }
@ -221,6 +222,7 @@ public class Configuration
configuration.SaveFilteredOriginalImagesFromJLinksForOutputResolutions ??= Array.Empty<string>();
if (configuration.SaveIndividually is null)
throw new NullReferenceException(nameof(configuration.SaveIndividually));
configuration.SavePropertyShortcutsForOutputResolutions ??= Array.Empty<string>();
configuration.SaveRandomForOutputResolutions ??= Array.Empty<string>();
if (configuration.SaveResizedSubfiles is null)
throw new NullReferenceException(nameof(configuration.SaveResizedSubfiles));
@ -311,6 +313,7 @@ public class Configuration
configuration.SaveIndividually.Value,
configuration.SaveFullYearOfRandomFiles.Value,
configuration.SaveMappedForOutputResolutions,
configuration.SavePropertyShortcutsForOutputResolutions,
configuration.SaveRandomForOutputResolutions,
configuration.SaveResizedSubfiles.Value,
configuration.SaveShortcutsForOutputResolutions,

View File

@ -75,6 +75,7 @@ public class Configuration
public bool SaveFullYearOfRandomFiles { init; get; }
public bool SaveIndividually { init; get; }
public string[] SaveMappedForOutputResolutions { init; get; }
public string[] SavePropertyShortcutsForOutputResolutions { init; get; }
public string[] SaveRandomForOutputResolutions { init; get; }
public bool SaveResizedSubfiles { init; get; }
public string[] SaveShortcutsForOutputResolutions { init; get; }
@ -159,6 +160,7 @@ public class Configuration
bool saveIndividually,
bool saveFullYearOfRandomFiles,
string[] saveMappedForOutputResolutions,
string[] savePropertyShortcutsForOutputResolutions,
string[] saveRandomForOutputResolutions,
bool saveResizedSubfiles,
string[] saveShortcutsForOutputResolutions,
@ -241,6 +243,7 @@ public class Configuration
SaveFullYearOfRandomFiles = saveFullYearOfRandomFiles;
SaveIndividually = saveIndividually;
SaveMappedForOutputResolutions = saveMappedForOutputResolutions;
SavePropertyShortcutsForOutputResolutions = savePropertyShortcutsForOutputResolutions;
SaveRandomForOutputResolutions = saveRandomForOutputResolutions;
SaveResizedSubfiles = saveResizedSubfiles;
SaveShortcutsForOutputResolutions = saveShortcutsForOutputResolutions;

View File

@ -1,7 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<ImplicitUsings>enable</ImplicitUsings>
<LangVersion>10.0</LangVersion>
<Nullable>enable</Nullable>
<OutputType>library</OutputType>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>

View File

@ -1,7 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<ImplicitUsings>enable</ImplicitUsings>
<LangVersion>10.0</LangVersion>
<Nullable>enable</Nullable>
<OutputType>library</OutputType>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>

View File

@ -1,7 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<ImplicitUsings>enable</ImplicitUsings>
<LangVersion>10.0</LangVersion>
<Nullable>enable</Nullable>
<OutputType>library</OutputType>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>

View File

@ -1,7 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<ImplicitUsings>enable</ImplicitUsings>
<LangVersion>10.0</LangVersion>
<Nullable>enable</Nullable>
<OutputType>Exe</OutputType>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>

View File

@ -1,7 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<ImplicitUsings>enable</ImplicitUsings>
<LangVersion>10.0</LangVersion>
<Nullable>enable</Nullable>
<OutputType>library</OutputType>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>

View File

@ -1,7 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<ImplicitUsings>enable</ImplicitUsings>
<LangVersion>10.0</LangVersion>
<Nullable>enable</Nullable>
<OutputType>library</OutputType>
<RuntimeIdentifiers>win-x64;linux-x64</RuntimeIdentifiers>

View File

@ -1,7 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<ImplicitUsings>enable</ImplicitUsings>
<LangVersion>10.0</LangVersion>
<Nullable>enable</Nullable>
<OutputType>library</OutputType>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>

View File

@ -32,6 +32,7 @@ taskTemplate: '^+^_${overdue ? ''^R'' : ''''}${name}^: ${relations ? (''\n^-^/^g
- [nef-support](tasks/nef-support.md)
- [reload-slideshow](tasks/reload-slideshow.md)
- [set-date-taken-when-missing](tasks/set-date-taken-when-missing.md)
- [triangle-over-person-in-full-image-for-some](tasks/triangle-over-person-in-full-image-for-some.md)
## In Progress

View File

@ -0,0 +1,9 @@
---
created: 2023-08-08T23:48:54.260Z
updated: 2023-08-08T23:48:54.257Z
assigned: ""
progress: 0
tags: []
---
# Triangle over person in full image for some

View File

@ -1,8 +0,0 @@
namespace View_by_Distance.Shared.Models.Methods;
public interface IStorage : Stateless.Methods.IStorage
{
// ...
}

View File

@ -1,16 +0,0 @@
namespace View_by_Distance.Shared.Models.Properties;
public interface IStorage
{
public string DistanceResultRootDirectory { get; }
public string FaceRootDirectory { get; }
public string IndexInfoRootDirectory { get; }
public string MetadataRootDirectory { get; }
public string PeopleRootDirectory { get; }
public string ResizeRootDirectory { get; }
public string RootDirectory { get; }
public string RootResultsDirectory { get; }
public string UrlRoot { get; }
}

View File

@ -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) =>

View File

@ -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);

View File

@ -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, "[]"));
}

View File

@ -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;

View File

@ -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;
}
}

View File

@ -1,79 +0,0 @@
using System.Text.Json;
using System.Text.Json.Serialization;
namespace View_by_Distance.Shared.Models;
public class Storage : Properties.IStorage
{
protected string _DistanceResultRootDirectory;
protected string _FaceRootDirectory;
protected string _IndexInfoRootDirectory;
protected string _MetadataRootDirectory;
protected string _PeopleRootDirectory;
protected string _ResizeRootDirectory;
protected string _RootDirectory;
protected string _RootResultsDirectory;
protected string _UrlRoot;
public string DistanceResultRootDirectory => _DistanceResultRootDirectory;
public string FaceRootDirectory => _FaceRootDirectory;
public string IndexInfoRootDirectory => _IndexInfoRootDirectory;
public string MetadataRootDirectory => _MetadataRootDirectory;
public string PeopleRootDirectory => _PeopleRootDirectory;
public string ResizeRootDirectory => _ResizeRootDirectory;
public string RootDirectory => _RootDirectory;
public string RootResultsDirectory => _RootResultsDirectory;
public string UrlRoot => _UrlRoot;
[JsonConstructor]
public Storage(string distanceResultRootDirectory, string faceRootDirectory, string indexInfoRootDirectory, string metadataRootDirectory, string peopleRootDirectory, string resizeRootDirectory, string rootDirectory, string rootResultsDirectory, string urlRoot)
{
_DistanceResultRootDirectory = distanceResultRootDirectory;
_FaceRootDirectory = faceRootDirectory;
_IndexInfoRootDirectory = indexInfoRootDirectory;
_MetadataRootDirectory = metadataRootDirectory;
_PeopleRootDirectory = peopleRootDirectory;
_ResizeRootDirectory = resizeRootDirectory;
_RootDirectory = rootDirectory;
_RootResultsDirectory = rootResultsDirectory;
_UrlRoot = urlRoot;
string fullRootResultsDirectory;
if (rootResultsDirectory.StartsWith(rootDirectory))
fullRootResultsDirectory = rootResultsDirectory;
else
fullRootResultsDirectory = string.Concat(rootDirectory, rootResultsDirectory);
_RootResultsDirectory = fullRootResultsDirectory;
if (!distanceResultRootDirectory.StartsWith(rootDirectory))
_DistanceResultRootDirectory = string.Concat(fullRootResultsDirectory, distanceResultRootDirectory);
if (!faceRootDirectory.StartsWith(rootDirectory))
_FaceRootDirectory = string.Concat(fullRootResultsDirectory, faceRootDirectory);
if (!indexInfoRootDirectory.StartsWith(rootDirectory))
_IndexInfoRootDirectory = string.Concat(fullRootResultsDirectory, indexInfoRootDirectory);
if (!metadataRootDirectory.StartsWith(rootDirectory))
_MetadataRootDirectory = string.Concat(fullRootResultsDirectory, metadataRootDirectory);
if (!peopleRootDirectory.StartsWith(rootDirectory))
_PeopleRootDirectory = string.Concat(fullRootResultsDirectory, peopleRootDirectory);
if (!resizeRootDirectory.StartsWith(rootDirectory))
_ResizeRootDirectory = string.Concat(fullRootResultsDirectory, resizeRootDirectory);
}
public Storage(string rootDirectory, string rootResultsDirectory, string peopleRootDirectory)
{
_DistanceResultRootDirectory = "distanceResultRootDirectory";
_FaceRootDirectory = "faceRootDirectory";
_IndexInfoRootDirectory = "indexInfoRootDirectory";
_MetadataRootDirectory = "metadataRootDirectory";
_PeopleRootDirectory = peopleRootDirectory;
_ResizeRootDirectory = "resizeRootDirectory";
_RootDirectory = rootDirectory;
_RootResultsDirectory = rootResultsDirectory;
_UrlRoot = "urlRoot";
}
public override string ToString()
{
string result = JsonSerializer.Serialize(this, new JsonSerializerOptions() { WriteIndented = true });
return result;
} // ...
}

View File

@ -2,7 +2,6 @@
<PropertyGroup>
<ImplicitUsings>enable</ImplicitUsings>
<IsPackable>false</IsPackable>
<LangVersion>10.0</LangVersion>
<Nullable>enable</Nullable>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<TargetFramework>net7.0</TargetFramework>

View File

@ -2,7 +2,6 @@
<PropertyGroup>
<ImplicitUsings>enable</ImplicitUsings>
<IsPackable>false</IsPackable>
<LangVersion>10.0</LangVersion>
<Nullable>enable</Nullable>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<TargetFramework>net7.0</TargetFramework>

View File

@ -1,7 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<ImplicitUsings>enable</ImplicitUsings>
<LangVersion>10.0</LangVersion>
<Nullable>enable</Nullable>
<OutputType>library</OutputType>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>