Bug fix from
Single Level AppSettings
This commit is contained in:
@ -38,7 +38,7 @@ public record FilePath(long CreationTicks,
|
||||
throw new NullReferenceException(nameof(fileHolder.Length));
|
||||
FilePath result;
|
||||
int? id;
|
||||
int? sortOder;
|
||||
int? sortOrder;
|
||||
string fileNameFirstSegment = fileHolder.Name.Split('.')[0];
|
||||
int sortOrderOnlyLengthIndex = metadataSettings.Offset.ToString().Length;
|
||||
string fileDirectoryFullPath = fileHolder.DirectoryFullPath ?? throw new NullReferenceException();
|
||||
@ -48,15 +48,15 @@ public record FilePath(long CreationTicks,
|
||||
bool? hasIgnoreKeyword = !isIntelligentIdFormat && !isPaddedIntelligentIdFormat ? null : fileNameFirstSegment[^1] is '2' or '8';
|
||||
bool? hasDateTimeOriginal = !isIntelligentIdFormat && !isPaddedIntelligentIdFormat ? null : fileNameFirstSegment[^1] is '1' or '9';
|
||||
if (!fileNameFirstSegmentIsIdFormat && !isIntelligentIdFormat && !isPaddedIntelligentIdFormat)
|
||||
(id, sortOder) = (null, null);
|
||||
(id, sortOrder) = (null, null);
|
||||
else if (isIntelligentIdFormat)
|
||||
(id, sortOder) = (IId.GetId(resultSettings, metadataSettings, fileNameFirstSegment), null);
|
||||
(id, sortOrder) = (IId.GetId(resultSettings, metadataSettings, fileNameFirstSegment), null);
|
||||
else if (isPaddedIntelligentIdFormat)
|
||||
{
|
||||
if (!int.TryParse(fileNameFirstSegment[..sortOrderOnlyLengthIndex], out int absoluteValueOfSortOrder))
|
||||
(id, sortOder) = (null, null);
|
||||
(id, sortOrder) = (null, null);
|
||||
else
|
||||
(id, sortOder) = (IId.GetId(resultSettings, metadataSettings, fileNameFirstSegment[sortOrderOnlyLengthIndex..]), absoluteValueOfSortOrder);
|
||||
(id, sortOrder) = (IId.GetId(resultSettings, metadataSettings, fileNameFirstSegment[sortOrderOnlyLengthIndex..]), absoluteValueOfSortOrder);
|
||||
}
|
||||
else if (fileNameFirstSegmentIsIdFormat)
|
||||
{
|
||||
@ -64,7 +64,7 @@ public record FilePath(long CreationTicks,
|
||||
throw new NullReferenceException(nameof(index));
|
||||
if (!int.TryParse(fileNameFirstSegment, out int valueOfFileNameFirstSegment))
|
||||
throw new NotSupportedException();
|
||||
(id, sortOder) = (valueOfFileNameFirstSegment, metadataSettings.Offset + index);
|
||||
(id, sortOrder) = (valueOfFileNameFirstSegment, metadataSettings.Offset + index);
|
||||
}
|
||||
else
|
||||
throw new NotSupportedException();
|
||||
@ -81,10 +81,26 @@ public record FilePath(long CreationTicks,
|
||||
fileHolder.Length.Value,
|
||||
fileHolder.Name,
|
||||
fileHolder.NameWithoutExtension,
|
||||
sortOder);
|
||||
sortOrder);
|
||||
return result;
|
||||
}
|
||||
|
||||
public static FilePath Get(FilePath filePath, DeterministicHashCode deterministicHashCode) =>
|
||||
new(filePath.CreationTicks,
|
||||
filePath.DirectoryFullPath,
|
||||
filePath.ExtensionLowered,
|
||||
filePath.FileNameFirstSegment,
|
||||
filePath.FullName,
|
||||
deterministicHashCode.Id ?? filePath.Id,
|
||||
filePath.HasIgnoreKeyword,
|
||||
filePath.HasDateTimeOriginal,
|
||||
filePath.IsIntelligentIdFormat,
|
||||
filePath.LastWriteTicks,
|
||||
filePath.Length,
|
||||
filePath.Name,
|
||||
filePath.NameWithoutExtension,
|
||||
filePath.SortOrder);
|
||||
|
||||
}
|
||||
|
||||
[JsonSourceGenerationOptions(WriteIndented = true)]
|
||||
|
Reference in New Issue
Block a user