logger for !9

xmp and json sidecar support

Alignment with Phares 8.0.118.14905 for Shared and Metadata

A_Metadata

Parameter constructors

Removed force-property-last-write-time-to-creation-time

House Cleaning
This commit is contained in:
2025-07-27 10:57:26 -07:00
parent 30d8a270f9
commit 08164a880d
47 changed files with 1038 additions and 677 deletions

View File

@ -23,7 +23,7 @@ public class Location : Properties.ILocation, IEquatable<Location>
_ = Stateless.Methods.Location.Check(bottom, left, right, top, zCount: 1, throwException: true);
}
public Location(double confidence, int height, Location location, int locationDigits, int locationFactor, int width, int zCount) :
public Location(double confidence, int height, Location location, int width, int zCount) :
this(
location.Bottom,
confidence,
@ -32,7 +32,7 @@ public class Location : Properties.ILocation, IEquatable<Location>
location.Top) =>
Stateless.Methods.Location.Check(Bottom, height, Left, Right, Top, width, zCount, throwException: true);
public Location(int bottom, double confidence, int height, int left, int locationDigits, int locationFactor, int right, int top, int width, int zCount) :
public Location(int bottom, double confidence, int height, int left, int right, int top, int width, int zCount) :
this(
bottom,
confidence,
@ -41,7 +41,7 @@ public class Location : Properties.ILocation, IEquatable<Location>
top) =>
Stateless.Methods.Location.Check(Bottom, height, Left, Right, Top, width, zCount, throwException: true);
public Location(int height, Location location, int locationDigits, int locationFactor, int width, int zCount) :
public Location(int height, Location location, int width, int zCount) :
this(
location.Bottom,
location.Confidence,
@ -50,7 +50,7 @@ public class Location : Properties.ILocation, IEquatable<Location>
location.Top) =>
Stateless.Methods.Location.Check(Bottom, height, Left, Right, Top, width, zCount, throwException: true);
public Location(double confidence, int factor, int height, Location location, int locationDigits, int locationFactor, int width, int zCount)
public Location(double confidence, int factor, int height, Location location, int width, int zCount)
{
int x = (location.Right - location.Left) / factor;
int y = (location.Bottom - location.Top) / factor;

View File

@ -1,5 +1,3 @@
using System.Drawing;
namespace View_by_Distance.Shared.Models;
public record LocationContainer(DateOnly CreationDateOnly,
@ -14,47 +12,44 @@ public record LocationContainer(DateOnly CreationDateOnly,
int? LengthPermyriad,
FilePath? LengthSource,
long? PersonKey,
RectangleF? Rectangle,
int WholePercentages)
{
public static LocationContainer Get(LocationContainer locationContainer, object? encoding, bool keepExifDirectory)
{
LocationContainer result;
result = new(locationContainer.CreationDateOnly,
keepExifDirectory ? locationContainer.ExifDirectory : null,
locationContainer.DirectoryNumber,
locationContainer.DisplayDirectoryName,
encoding,
locationContainer.FaceFile,
locationContainer.FilePath,
locationContainer.FromDistanceContent,
locationContainer.Id,
locationContainer.LengthPermyriad,
locationContainer.LengthSource,
locationContainer.PersonKey,
locationContainer.Rectangle,
locationContainer.WholePercentages);
result = new(CreationDateOnly: locationContainer.CreationDateOnly,
ExifDirectory: keepExifDirectory ? locationContainer.ExifDirectory : null,
DirectoryNumber: locationContainer.DirectoryNumber,
DisplayDirectoryName: locationContainer.DisplayDirectoryName,
Encoding: encoding,
FaceFile: locationContainer.FaceFile,
FilePath: locationContainer.FilePath,
FromDistanceContent: locationContainer.FromDistanceContent,
Id: locationContainer.Id,
LengthPermyriad: locationContainer.LengthPermyriad,
LengthSource: locationContainer.LengthSource,
PersonKey: locationContainer.PersonKey,
WholePercentages: locationContainer.WholePercentages);
return result;
}
public static LocationContainer Get(LocationContainer source, LocationContainer locationContainer, int lengthPermyriad, bool keepExifDirectory, bool keepEncoding)
{
LocationContainer result;
result = new(locationContainer.CreationDateOnly,
keepExifDirectory ? locationContainer.ExifDirectory : null,
locationContainer.DirectoryNumber,
locationContainer.DisplayDirectoryName,
keepEncoding ? locationContainer.Encoding : null,
locationContainer.FaceFile,
locationContainer.FilePath,
locationContainer.FromDistanceContent,
locationContainer.Id,
lengthPermyriad,
source.FilePath,
locationContainer.PersonKey,
locationContainer.Rectangle,
locationContainer.WholePercentages);
result = new(CreationDateOnly: locationContainer.CreationDateOnly,
ExifDirectory: keepExifDirectory ? locationContainer.ExifDirectory : null,
DirectoryNumber: locationContainer.DirectoryNumber,
DisplayDirectoryName: locationContainer.DisplayDirectoryName,
Encoding: keepEncoding ? locationContainer.Encoding : null,
FaceFile: locationContainer.FaceFile,
FilePath: locationContainer.FilePath,
FromDistanceContent: locationContainer.FromDistanceContent,
Id: locationContainer.Id,
LengthPermyriad: lengthPermyriad,
LengthSource: source.FilePath,
PersonKey: locationContainer.PersonKey,
WholePercentages: locationContainer.WholePercentages);
return result;
}

View File

@ -8,7 +8,6 @@ public interface IPropertyConfiguration
public string[] IgnoreRulesKeyWords { init; get; }
public int IntMinValueLength { init; get; }
public string PersonBirthdayFormat { init; get; }
public bool PropertiesChangedForProperty { init; get; }
public string[] PropertyContentCollectionFiles { init; get; }
public string ResultAllInOne { init; get; }
public int ResultAllInOneSubdirectoryLength { init; get; }

View File

@ -5,7 +5,8 @@ public interface IDlibDotNet
void Tick();
long Ticks { get; }
(string, string) GetResultsFullGroupDirectories();
int? CurrentTick { get; }
string GetResultsFullGroupDirectories();
void ConstructProgressBar(int maxTicks, string message);
(string, string, string, string) GetResultsFullGroupDirectories(string outputResolution);

View File

@ -19,6 +19,9 @@ public interface IId
public static bool IsOffsetDeterministicHashCode(IPropertyConfiguration propertyConfiguration) =>
propertyConfiguration.Offset == DeterministicHashCode;
public static string GetIntelligentId(IPropertyConfiguration propertyConfiguration, FilePath filePath) =>
Id.GetIntelligentId(propertyConfiguration, filePath);
public static byte GetHasDateTimeOriginal(IPropertyConfiguration propertyConfiguration, FilePath filePath) =>
Id.GetHasDateTimeOriginal(propertyConfiguration, filePath);
@ -31,16 +34,19 @@ public interface IId
public static bool NameWithoutExtensionIsIntelligentIdFormat(IPropertyConfiguration propertyConfiguration, string fileNameFirstSegment) =>
fileNameFirstSegment.Length - 1 == propertyConfiguration.IntMinValueLength && fileNameFirstSegment[^1] is '0' or '1' or '2' or '3' or '4' or '5' or '6' or '7' or '8' or '9' && fileNameFirstSegment.All(char.IsNumber);
public static string GetIntelligentId(IPropertyConfiguration propertyConfiguration, long id, string extensionLowered, bool? hasIgnoreKeyword, bool? hasDateTimeOriginal) =>
Id.GetIntelligentId(propertyConfiguration, id, extensionLowered, hasIgnoreKeyword, hasDateTimeOriginal);
public static string? GetPaddedId(IPropertyConfiguration propertyConfiguration, FilePath filePath, bool? hasIgnoreKeyword, bool? hasDateTimeOriginal, int? index) =>
Id.GetPaddedId(propertyConfiguration, filePath, hasIgnoreKeyword, hasDateTimeOriginal, index);
public static bool NameWithoutExtensionIsPaddedIntelligentIdFormat(IPropertyConfiguration propertyConfiguration, int sortOrderOnlyLengthIndex, string fileNameFirstSegment) =>
fileNameFirstSegment.Length == propertyConfiguration.IntMinValueLength + sortOrderOnlyLengthIndex + 1
&& fileNameFirstSegment[^1] is '0' or '1' or '2' or '3' or '4' or '5' or '6' or '7' or '8' or '9'
&& fileNameFirstSegment.All(char.IsNumber);
public static string GetPaddedId(IPropertyConfiguration propertyConfiguration, int id, string extensionLowered, bool? hasIgnoreKeyword, bool? hasDateTimeOriginal, int? index) =>
Id.GetPaddedId(propertyConfiguration, id, extensionLowered, hasIgnoreKeyword, hasDateTimeOriginal, index);
public static string? GetPaddedId(IPropertyConfiguration propertyConfiguration, int id, string nameWithoutExtension, string extensionLowered, bool? hasIgnoreKeyword, bool? hasDateTimeOriginal, int? index) =>
Id.GetPaddedId(propertyConfiguration, id, nameWithoutExtension, extensionLowered, hasIgnoreKeyword, hasDateTimeOriginal, index);
public static string GetPaddedId(IPropertyConfiguration propertyConfiguration, FilePath filePath, int? index) =>
Id.GetPaddedId(propertyConfiguration, filePath, index);
internal int TestStatic_GetDeterministicHashCode(byte[] value) =>
GetDeterministicHashCode(value);
@ -51,9 +57,15 @@ public interface IId
internal int TestStatic_GetId(IPropertyConfiguration propertyConfiguration, string intelligentId) =>
GetId(propertyConfiguration, intelligentId);
internal string TestStatic_GetIntelligentId(IPropertyConfiguration propertyConfiguration, FilePath filePath) =>
GetIntelligentId(propertyConfiguration, filePath);
internal byte TestStatic_GetHasDateTimeOriginal(IPropertyConfiguration propertyConfiguration, FilePath filePath) =>
GetHasDateTimeOriginal(propertyConfiguration, filePath);
internal string TestStatic_GetPaddedId(IPropertyConfiguration propertyConfiguration, FilePath filePath, int? index) =>
GetPaddedId(propertyConfiguration, filePath, index);
internal byte TestStatic_GetMissingDateTimeOriginal(IPropertyConfiguration propertyConfiguration, FilePath filePath) =>
GetMissingDateTimeOriginal(propertyConfiguration, filePath);
@ -63,13 +75,13 @@ public interface IId
internal bool TestStatic_NameWithoutExtensionIsIntelligentIdFormat(IPropertyConfiguration propertyConfiguration, string fileNameFirstSegment) =>
NameWithoutExtensionIsIntelligentIdFormat(propertyConfiguration, fileNameFirstSegment);
internal string TestStatic_GetIntelligentId(IPropertyConfiguration propertyConfiguration, long id, string extensionLowered, bool? hasIgnoreKeyword, bool? hasDateTimeOriginal) =>
GetIntelligentId(propertyConfiguration, id, extensionLowered, hasIgnoreKeyword, hasDateTimeOriginal);
internal string? TestStatic_GetPaddedId(IPropertyConfiguration propertyConfiguration, FilePath filePath, bool? hasIgnoreKeyword, bool? hasDateTimeOriginal, int? index) =>
GetPaddedId(propertyConfiguration, filePath, hasIgnoreKeyword, hasDateTimeOriginal, index);
internal bool TestStatic_NameWithoutExtensionIsPaddedIntelligentIdFormat(IPropertyConfiguration propertyConfiguration, int sortOrderOnlyLengthIndex, string fileNameFirstSegment) =>
NameWithoutExtensionIsPaddedIntelligentIdFormat(propertyConfiguration, sortOrderOnlyLengthIndex, fileNameFirstSegment);
internal string TestStatic_GetPaddedId(IPropertyConfiguration propertyConfiguration, int id, string extensionLowered, bool? hasIgnoreKeyword, bool? hasDateTimeOriginal, int? index) =>
GetPaddedId(propertyConfiguration, id, extensionLowered, hasIgnoreKeyword, hasDateTimeOriginal, index);
internal string? TestStatic_GetPaddedId(IPropertyConfiguration propertyConfiguration, int id, string nameWithoutExtension, string extensionLowered, bool? hasIgnoreKeyword, bool? hasDateTimeOriginal, int? index) =>
GetPaddedId(propertyConfiguration, id, nameWithoutExtension, extensionLowered, hasIgnoreKeyword, hasDateTimeOriginal, index);
}

View File

@ -55,15 +55,15 @@ public interface ILocation
static string GetLeftPadded(int locationDigits, int value) =>
GetLeftPadded(locationDigits, value.ToString());
Models.Location? TestStatic_GetLocation(Models.Location? location, int locationDigits, int locationFactor, int height, int width, int zCount) =>
GetLocation(location, locationDigits, locationFactor, height, width, zCount);
static Models.Location? GetLocation(Models.Location? location, int locationDigits, int locationFactor, int height, int width, int zCount) =>
location is null ? null : new(location.Confidence, height, location, locationDigits, locationFactor, width, zCount);
Models.Location? TestStatic_GetLocation(Models.Location? location, int height, int width, int zCount) =>
GetLocation(location, height, width, zCount);
static Models.Location? GetLocation(Models.Location? location, int height, int width, int zCount) =>
location is null ? null : new(location.Confidence, height, location, width, zCount);
Models.Location? TestStatic_GetLocation(int factor, Models.Location? location, int locationDigits, int locationFactor, int height, int width, int zCount) =>
GetLocation(factor, location, locationDigits, locationFactor, height, width, zCount);
static Models.Location? GetLocation(int factor, Models.Location? location, int locationDigits, int locationFactor, int height, int width, int zCount) =>
location is null ? null : new(location.Confidence, factor, height, location, locationDigits, locationFactor, width, zCount);
Models.Location? TestStatic_GetLocation(int factor, Models.Location? location, int height, int width, int zCount) =>
GetLocation(factor, location, height, width, zCount);
static Models.Location? GetLocation(int factor, Models.Location? location, int height, int width, int zCount) =>
location is null ? null : new(location.Confidence, factor, height, location, width, zCount);
(decimal?, decimal?, decimal?, decimal?) TestStatic_GetHeightLeftTopWidth(int bottom, int height, int left, int right, int top, int width) =>
GetHeightLeftTopWidth(bottom, height, left, right, top, width);
@ -107,8 +107,6 @@ public interface ILocation
detectionConfidence,
height,
Math.Max(rectangle.Left, 0),
Stateless.ILocation.Digits,
Stateless.ILocation.Factor,
Math.Min(rectangle.Right, width),
Math.Max(rectangle.Top, 0),
width,

View File

@ -24,9 +24,6 @@ public interface IPath
public static void MakeHiddenIfAllItemsAreHidden(string rootDirectory) =>
XPath.MakeHiddenIfAllItemsAreHidden(rootDirectory);
public static void CreateDirectories(ReadOnlyCollection<string> directories) =>
XPath.CreateDirectories(directories);
public static void ChangeDateForEmptyDirectories(string rootDirectory, long ticks) =>
XPath.ChangeDateForEmptyDirectories(rootDirectory, ticks);
@ -68,9 +65,6 @@ public interface IPath
internal void TestStatic_MakeHiddenIfAllItemsAreHidden(string rootDirectory) =>
MakeHiddenIfAllItemsAreHidden(rootDirectory);
internal void TestStatic_CreateDirectories(ReadOnlyCollection<string> directories) =>
CreateDirectories(directories);
internal void TestStatic_ChangeDateForEmptyDirectories(string rootDirectory, long ticks) =>
ChangeDateForEmptyDirectories(rootDirectory, ticks);

View File

@ -1,4 +1,5 @@
using System.Text;
using View_by_Distance.Shared.Models.Properties;
namespace View_by_Distance.Shared.Models.Stateless.Methods;
@ -27,7 +28,26 @@ internal abstract class Id
internal static byte GetHasIgnoreKeyword(FilePath filePath) =>
(byte)(filePath.Id > -1 ? 8 : 2);
internal static int GetId(Properties.IPropertyConfiguration propertyConfiguration, string intelligentId)
internal static byte GetHasDateTimeOriginal(IPropertyConfiguration propertyConfiguration, FilePath filePath) =>
(byte)(IsIgnoreOrValidVideoFormatExtension(propertyConfiguration, filePath) ? filePath.Id > -1 ? 6 : 4 : filePath.Id > -1 ? 9 : 1);
private static string GetExtension(string nameWithoutExtension, string extensionLowered) =>
extensionLowered is not ".xmp" and not ".json" ? extensionLowered : Path.GetExtension(nameWithoutExtension);
private static string GetExtension(FilePath filePath) =>
GetExtension(filePath.NameWithoutExtension, filePath.ExtensionLowered);
private static bool IsIgnoreOrValidVideoFormatExtension(IPropertyConfiguration propertyConfiguration, FilePath filePath) =>
IsIgnoreOrValidVideoFormatExtension(propertyConfiguration, GetExtension(filePath));
private static bool IsIgnoreOrValidVideoFormatExtension(IPropertyConfiguration propertyConfiguration, string extensionLowered) =>
propertyConfiguration.IgnoreExtensions.Contains(extensionLowered)
|| propertyConfiguration.ValidVideoFormatExtensions.Contains(extensionLowered);
internal static byte GetMissingDateTimeOriginal(IPropertyConfiguration propertyConfiguration, FilePath filePath) =>
(byte)(IsIgnoreOrValidVideoFormatExtension(propertyConfiguration, filePath) ? filePath.Id > -1 ? 5 : 0 : filePath.Id > -1 ? 7 : 3);
internal static int GetId(IPropertyConfiguration propertyConfiguration, string intelligentId)
{
int result;
StringBuilder results = new();
@ -44,13 +64,7 @@ internal abstract class Id
return result;
}
internal static byte GetHasDateTimeOriginal(Properties.IPropertyConfiguration propertyConfiguration, FilePath filePath) =>
(byte)(propertyConfiguration.IgnoreExtensions.Contains(filePath.ExtensionLowered) || propertyConfiguration.ValidVideoFormatExtensions.Contains(filePath.ExtensionLowered) ? filePath.Id > -1 ? 6 : 4 : filePath.Id > -1 ? 9 : 1);
internal static byte GetMissingDateTimeOriginal(Properties.IPropertyConfiguration propertyConfiguration, FilePath filePath) =>
(byte)(propertyConfiguration.IgnoreExtensions.Contains(filePath.ExtensionLowered) || propertyConfiguration.ValidVideoFormatExtensions.Contains(filePath.ExtensionLowered) ? filePath.Id > -1 ? 5 : 0 : filePath.Id > -1 ? 7 : 3);
internal static bool NameWithoutExtensionIsIdFormat(Properties.IPropertyConfiguration propertyConfiguration, string fileNameWithoutExtension)
internal static bool NameWithoutExtensionIsIdFormat(IPropertyConfiguration propertyConfiguration, string fileNameWithoutExtension)
{
bool result;
if (fileNameWithoutExtension.Length < 5 || fileNameWithoutExtension.Length > propertyConfiguration.IntMinValueLength)
@ -63,7 +77,7 @@ internal abstract class Id
return result;
}
internal static string GetIntelligentId(Properties.IPropertyConfiguration propertyConfiguration, long id, string extensionLowered, bool? hasIgnoreKeyword, bool? hasDateTimeOriginal)
internal static string GetIntelligentId(IPropertyConfiguration propertyConfiguration, long id, string nameWithoutExtension, string extensionLowered, bool? hasIgnoreKeyword, bool? hasDateTimeOriginal)
{
string result;
StringBuilder stringBuilder = new();
@ -79,18 +93,20 @@ internal abstract class Id
}
else if (id > -1)
{
if (!propertyConfiguration.ValidVideoFormatExtensions.Contains(extensionLowered))
key = hasIgnoreKeyword is not null && hasIgnoreKeyword.Value ? 8 : hasDateTimeOriginal.Value ? 9 : 7;
else
string checkExtension = GetExtension(nameWithoutExtension, extensionLowered);
if (IsIgnoreOrValidVideoFormatExtension(propertyConfiguration, checkExtension))
key = hasIgnoreKeyword is not null && hasIgnoreKeyword.Value ? throw new NotImplementedException() : hasDateTimeOriginal.Value ? 6 : 5;
else
key = hasIgnoreKeyword is not null && hasIgnoreKeyword.Value ? 8 : hasDateTimeOriginal.Value ? 9 : 7;
value = id.ToString().PadLeft(propertyConfiguration.IntMinValueLength, '0');
}
else
{
if (!propertyConfiguration.ValidVideoFormatExtensions.Contains(extensionLowered))
key = hasIgnoreKeyword is not null && hasIgnoreKeyword.Value ? 2 : hasDateTimeOriginal.Value ? 1 : 3;
else
string checkExtension = GetExtension(nameWithoutExtension, extensionLowered);
if (IsIgnoreOrValidVideoFormatExtension(propertyConfiguration, checkExtension))
key = hasIgnoreKeyword is not null && hasIgnoreKeyword.Value ? throw new NotImplementedException() : hasDateTimeOriginal.Value ? 4 : 0;
else
key = hasIgnoreKeyword is not null && hasIgnoreKeyword.Value ? 2 : hasDateTimeOriginal.Value ? 1 : 3;
value = id.ToString()[1..].PadLeft(propertyConfiguration.IntMinValueLength, '0');
}
for (int i = value.Length - propertyConfiguration.ResultAllInOneSubdirectoryLength - 1; i > -1; i--)
@ -101,14 +117,51 @@ internal abstract class Id
return result;
}
internal static string GetPaddedId(Properties.IPropertyConfiguration propertyConfiguration, int id, string extensionLowered, bool? hasIgnoreKeyword, bool? hasDateTimeOriginal, int? index)
internal static string GetIntelligentId(IPropertyConfiguration propertyConfiguration, FilePath filePath) =>
filePath.Id is null ? throw new Exception() : GetIntelligentId(propertyConfiguration, filePath.Id.Value, filePath.NameWithoutExtension, filePath.ExtensionLowered, filePath.HasIgnoreKeyword, filePath.HasDateTimeOriginal);
internal static string GetPaddedId(IPropertyConfiguration propertyConfiguration, FilePath filePath, int? index)
{
string result;
if (propertyConfiguration.Offset < 0)
result = Guid.NewGuid().ToString();
else
{
string intelligentId = GetIntelligentId(propertyConfiguration, id, extensionLowered, hasIgnoreKeyword, hasDateTimeOriginal);
string intelligentId = GetIntelligentId(propertyConfiguration, filePath);
int check = GetId(propertyConfiguration, intelligentId);
if (filePath.Id is not null && check != filePath.Id.Value)
throw new NotSupportedException();
result = index is null || propertyConfiguration.Offset == IId.DeterministicHashCode ? intelligentId : $"{propertyConfiguration.Offset + index}{intelligentId}";
}
return result;
}
internal static string? GetPaddedId(IPropertyConfiguration propertyConfiguration, FilePath filePath, bool? hasIgnoreKeyword, bool? hasDateTimeOriginal, int? index)
{
string? result;
if (filePath.Id is null)
result = null;
else if (propertyConfiguration.Offset < 0)
result = Guid.NewGuid().ToString();
else
{
string intelligentId = GetIntelligentId(propertyConfiguration, filePath.Id.Value, filePath.NameWithoutExtension, filePath.ExtensionLowered, hasIgnoreKeyword, hasDateTimeOriginal);
int check = GetId(propertyConfiguration, intelligentId);
if (filePath.Id is not null && check != filePath.Id.Value)
throw new NotSupportedException();
result = index is null || propertyConfiguration.Offset == IId.DeterministicHashCode ? intelligentId : $"{propertyConfiguration.Offset + index}{intelligentId}";
}
return result;
}
internal static string GetPaddedId(IPropertyConfiguration propertyConfiguration, int id, string nameWithoutExtension, string extensionLowered, bool? hasIgnoreKeyword, bool? hasDateTimeOriginal, int? index)
{
string result;
if (propertyConfiguration.Offset < 0)
result = Guid.NewGuid().ToString();
else
{
string intelligentId = GetIntelligentId(propertyConfiguration, id, nameWithoutExtension, extensionLowered, hasIgnoreKeyword, hasDateTimeOriginal);
int check = GetId(propertyConfiguration, intelligentId);
if (check != id)
throw new NotSupportedException();

View File

@ -136,7 +136,10 @@ internal abstract class Location
result = null;
else
{
if (!int.TryParse(segments[1], out int xWholePercent) || !int.TryParse(segments[2], out int yWholePercent) || !int.TryParse(segments[3], out int wWholePercent) || !int.TryParse(segments[4], out int hWholePercent))
if (!int.TryParse(segments[1], out int xWholePercent)
|| !int.TryParse(segments[2], out int yWholePercent)
|| !int.TryParse(segments[3], out int wWholePercent)
|| !int.TryParse(segments[4], out int hWholePercent))
result = null;
else
{

View File

@ -1,4 +1,5 @@
using System.Collections.ObjectModel;
using System.Diagnostics;
namespace View_by_Distance.Shared.Models.Stateless.Methods;
@ -302,7 +303,7 @@ internal abstract partial class XDirectory
internal static (string[], List<(FilePath, string)>) GetToDoCollection(Properties.IPropertyConfiguration propertyConfiguration, bool copyDuplicates, bool ifCanUseId, ReadOnlyCollection<ReadOnlyCollection<FilePath>> filePathsCollection, ReadOnlyDictionary<byte, ReadOnlyCollection<string>> fileGroups, ReadOnlyDictionary<int, ExifDirectory>? exifDirectoriesById, Action? tick)
{
List<(FilePath, string)> results = [];
string paddedId;
string? paddedId;
string checkFile;
string directory;
FilePath filePath;
@ -353,10 +354,7 @@ internal abstract partial class XDirectory
{ }
}
if (exifDirectoriesById is null || !exifDirectoriesById.TryGetValue(filePath.Id.Value, out exifDirectory))
{
hasIgnoreKeyword = filePath.HasIgnoreKeyword;
hasDateTimeOriginal = filePath.HasDateTimeOriginal;
}
paddedId = IId.GetPaddedId(propertyConfiguration, filePath, i);
else
{
dateTime = IDate.GetDateTimeOriginal(exifDirectory);
@ -365,8 +363,8 @@ internal abstract partial class XDirectory
continue;
keywords = MetaBase.GetKeywords(exifDirectory?.ExifBaseDirectories);
hasIgnoreKeyword = propertyConfiguration.IgnoreRulesKeyWords.Any(keywords.Contains);
paddedId = IId.GetPaddedId(propertyConfiguration, filePath, hasIgnoreKeyword, hasDateTimeOriginal, i);
}
paddedId = IId.GetPaddedId(propertyConfiguration, filePath.Id.Value, filePath.ExtensionLowered, hasIgnoreKeyword, hasDateTimeOriginal, i);
paddedIdFile = Path.Combine(filePath.DirectoryFullPath, $"{paddedId}{filePath.ExtensionLowered}");
if (!File.Exists(paddedIdFile))
{
@ -384,15 +382,20 @@ internal abstract partial class XDirectory
else
{
if (filePath.Id is null)
throw new NullReferenceException(nameof(filePath.Id));
intelligentId = IId.GetIntelligentId(propertyConfiguration, filePath.Id.Value, filePath.ExtensionLowered, filePath.HasIgnoreKeyword, filePath.HasDateTimeOriginal);
{
if (Debugger.IsAttached)
continue;
else
throw new NullReferenceException(nameof(filePath.Id));
}
intelligentId = IId.GetIntelligentId(propertyConfiguration, filePath);
if (!isOffsetDeterministicHashCode)
checkFile = Path.Combine(directory, $"{intelligentId}{filePath.ExtensionLowered}");
else
{
if (filePath.DirectoryFullPath is null)
continue;
paddedId = IId.GetPaddedId(propertyConfiguration, filePath.Id.Value, filePath.ExtensionLowered, filePath.HasIgnoreKeyword, filePath.HasDateTimeOriginal, i);
paddedId = IId.GetPaddedId(propertyConfiguration, filePath, i);
paddedIdFile = Path.Combine(filePath.DirectoryFullPath, $"{paddedId}{filePath.ExtensionLowered}");
if (File.Exists(paddedIdFile))
continue;

View File

@ -233,20 +233,6 @@ internal abstract class XPath
}
}
internal static void CreateDirectories(ReadOnlyCollection<string> directories)
{
string checkDirectory;
foreach (string directory in directories)
{
for (int i = 0; i < 101; i++)
{
checkDirectory = Path.Combine(directory, i.ToString("000"));
if (!Directory.Exists(checkDirectory))
_ = Directory.CreateDirectory(checkDirectory);
}
}
}
internal static void ChangeDateForEmptyDirectories(string rootDirectory, long ticks)
{
DateTime dateTime = new(ticks);