After testing E_Distance.SaveGroupedFaceEncodings
This commit is contained in:
@ -119,7 +119,7 @@ public static class A_Property
|
||||
public static List<(int g, string sourceDirectory, FileInfo[] sourceDirectoryFiles, int r)> GetFileInfoGroupCollection(Models.Configuration configuration, bool reverse, string searchPattern, List<string> topDirectories)
|
||||
{
|
||||
if (configuration.MaxImagesInDirectoryForTopLevelFirstPass is null)
|
||||
throw new Exception($"{nameof(configuration.MaxImagesInDirectoryForTopLevelFirstPass)} is null!");
|
||||
throw new ArgumentNullException(nameof(configuration.MaxImagesInDirectoryForTopLevelFirstPass));
|
||||
List<(int g, string sourceDirectory, FileInfo[] sourceDirectoryFiles, int r)> results = new();
|
||||
List<(int g, string sourceDirectory, string[] sourceDirectoryFiles, int r)>? collection = GetGroupCollection(configuration.RootDirectory, searchPattern, topDirectories, configuration.MaxImagesInDirectoryForTopLevelFirstPass.Value, reverse);
|
||||
foreach ((int g, string sourceDirectory, string[] sourceDirectoryFiles, int r) in collection)
|
||||
|
@ -12,8 +12,8 @@ public interface IPath
|
||||
List<string> TestStatic_GetDirectoryNames(string directory);
|
||||
static List<string> GetDirectoryNames(string directory) => XPath.GetDirectoryNames(directory);
|
||||
|
||||
bool TestStatic_WriteAllText(string path, string contents, bool compareBeforeWrite);
|
||||
static bool WriteAllText(string path, string contents, bool compareBeforeWrite) => XPath.WriteAllText(path, contents, compareBeforeWrite);
|
||||
bool TestStatic_WriteAllText(string path, string contents, bool updateDateWhenMatches, bool compareBeforeWrite);
|
||||
static bool WriteAllText(string path, string contents, bool updateDateWhenMatches, bool compareBeforeWrite, DateTime? updateToWhenMatches = null) => XPath.WriteAllText(path, contents, updateDateWhenMatches, compareBeforeWrite, updateToWhenMatches);
|
||||
|
||||
(int level, List<string> directories) TestStatic_Get(string rootDirectory, string sourceDirectory);
|
||||
static (int level, List<string> directories) Get(string rootDirectory, string sourceDirectory) => XPath.Get(rootDirectory, sourceDirectory);
|
||||
|
@ -46,7 +46,7 @@ internal class XPath
|
||||
return result;
|
||||
}
|
||||
|
||||
internal static bool WriteAllText(string path, string contents, bool compareBeforeWrite)
|
||||
internal static bool WriteAllText(string path, string contents, bool updateDateWhenMatches, bool compareBeforeWrite, DateTime? updateToWhenMatches)
|
||||
{
|
||||
bool result;
|
||||
string text;
|
||||
@ -59,6 +59,13 @@ internal class XPath
|
||||
else
|
||||
text = File.ReadAllText(path);
|
||||
result = text != contents;
|
||||
if (!result && updateDateWhenMatches)
|
||||
{
|
||||
if (updateToWhenMatches is null)
|
||||
File.SetLastWriteTime(path, DateTime.Now);
|
||||
else
|
||||
File.SetLastWriteTime(path, updateToWhenMatches.Value);
|
||||
}
|
||||
}
|
||||
if (result)
|
||||
{
|
||||
@ -85,7 +92,7 @@ internal class XPath
|
||||
string? pathRoot = Path.GetPathRoot(directory);
|
||||
string extension = Path.GetExtension(directory);
|
||||
if (string.IsNullOrEmpty(pathRoot))
|
||||
throw new Exception($"{nameof(pathRoot)} is null!");
|
||||
throw new ArgumentNullException(nameof(pathRoot));
|
||||
if (Directory.Exists(directory))
|
||||
results.Add(Path.GetFileName(directory));
|
||||
else if ((string.IsNullOrEmpty(extension) || extension.Length > 3) && !File.Exists(directory))
|
||||
|
Reference in New Issue
Block a user