diff --git a/Instance/DlibDotNet.cs b/Instance/DlibDotNet.cs index c70dcc4..c18bdb9 100644 --- a/Instance/DlibDotNet.cs +++ b/Instance/DlibDotNet.cs @@ -951,7 +951,7 @@ public partial class DlibDotNet subFileTuples.Add(new Tuple(nameof(A_Property), item.SourceDirectoryFileHolder.LastWriteTime.Value)); else subFileTuples.Add(new Tuple(nameof(A_Property), new FileInfo(item.SourceDirectoryFileHolder.FullName).LastWriteTime)); - int sortOrderOnlyLengthIndex = IDirectory.GetSortOrderOnlyLengthIndex(_Configuration.PropertyConfiguration.Offset); + short sortOrderOnlyLengthIndex = IDirectory.GetSortOrderOnlyLengthIndex(_Configuration.PropertyConfiguration.Offset); bool nameWithoutExtensionIsIdFormat = Shared.Models.Stateless.Methods.IProperty.NameWithoutExtensionIsIdFormat(item.ImageFileHolder); bool nameWithoutExtensionIsPaddedIdFormat = IDirectory.NameWithoutExtensionIsPaddedIdFormat(item.ImageFileHolder, sortOrderOnlyLengthIndex); if (nameWithoutExtensionIsIdFormat && item.ImageFileHolder.NameWithoutExtension != item.Property.Id.ToString()) diff --git a/Map/Models/Stateless/LookForAbandonedLogic.cs b/Map/Models/Stateless/LookForAbandonedLogic.cs index c97fac8..466b756 100644 --- a/Map/Models/Stateless/LookForAbandonedLogic.cs +++ b/Map/Models/Stateless/LookForAbandonedLogic.cs @@ -11,7 +11,7 @@ internal abstract class LookForAbandonedLogic bool nameWithoutExtensionIsIdFormat; List renameCollection = []; bool nameWithoutExtensionIsPaddedIdFormat; - int sortOrderOnlyLengthIndex = IDirectory.GetSortOrderOnlyLengthIndex(propertyConfiguration.Offset); + short sortOrderOnlyLengthIndex = IDirectory.GetSortOrderOnlyLengthIndex(propertyConfiguration.Offset); string[] distinctFilteredIdsValues = distinctFilteredIds.Select(l => l.ToString()).ToArray(); string[] files = Directory.GetFiles(directory, "*", SearchOption.AllDirectories); foreach (string file in files) diff --git a/Move-By-Id/MoveById.cs b/Move-By-Id/MoveById.cs index 45defb9..5b5f282 100644 --- a/Move-By-Id/MoveById.cs +++ b/Move-By-Id/MoveById.cs @@ -112,7 +112,7 @@ public class MoveById ASCIIEncoding asciiEncoding = new(); bool nameWithoutExtensionIsIdFormat; bool nameWithoutExtensionIsPaddedIdFormat; - int sortOrderOnlyLengthIndex = IDirectory.GetSortOrderOnlyLengthIndex(_PropertyConfiguration.Offset); + short sortOrderOnlyLengthIndex = IDirectory.GetSortOrderOnlyLengthIndex(_PropertyConfiguration.Offset); foreach (string file in allFiles) { progressBar.Tick(); diff --git a/Rename/Rename.cs b/Rename/Rename.cs index 51e3c85..a488d12 100644 --- a/Rename/Rename.cs +++ b/Rename/Rename.cs @@ -225,7 +225,7 @@ public class Rename bool nameWithoutExtensionIsIdFormat; bool nameWithoutExtensionIsPaddedIdFormat; IReadOnlyList directories; - int sortOrderOnlyLengthIndex = IDirectory.GetSortOrderOnlyLengthIndex(_PropertyConfiguration.Offset); + short sortOrderOnlyLengthIndex = IDirectory.GetSortOrderOnlyLengthIndex(_PropertyConfiguration.Offset); for (int i = 0; i < files.Length; i++) { progressBar.Tick(); diff --git a/Shared/Models/Stateless/Methods/IDirectory.cs b/Shared/Models/Stateless/Methods/IDirectory.cs index 8abccea..5930c0d 100644 --- a/Shared/Models/Stateless/Methods/IDirectory.cs +++ b/Shared/Models/Stateless/Methods/IDirectory.cs @@ -23,17 +23,17 @@ public interface IDirectory static string GetPaddedId(int intMinValueLength, int index, int id) => id > -1 ? $"{index}070{id.ToString().PadLeft(intMinValueLength, '0')}" : $"{index}030{id.ToString()[1..].PadLeft(intMinValueLength, '0')}"; - bool TestStatic_NameWithoutExtensionIsPaddedIdFormat(string fileNameWithoutExtension, int sortOrderOnlyLengthIndex) => + bool TestStatic_NameWithoutExtensionIsPaddedIdFormat(string fileNameWithoutExtension, short sortOrderOnlyLengthIndex) => NameWithoutExtensionIsPaddedIdFormat(fileNameWithoutExtension, sortOrderOnlyLengthIndex); - static bool NameWithoutExtensionIsPaddedIdFormat(string fileNameWithoutExtension, int sortOrderOnlyLengthIndex) => + static bool NameWithoutExtensionIsPaddedIdFormat(string fileNameWithoutExtension, short sortOrderOnlyLengthIndex) => fileNameWithoutExtension.Length > sortOrderOnlyLengthIndex && fileNameWithoutExtension[sortOrderOnlyLengthIndex] == '0' && fileNameWithoutExtension[sortOrderOnlyLengthIndex - 3] == '0' && fileNameWithoutExtension.All(l => char.IsNumber(l)); - bool TestStatic_NameWithoutExtensionIsPaddedIdFormat(Models.FileHolder fileHolder, int sortOrderOnlyLengthIndex) => + bool TestStatic_NameWithoutExtensionIsPaddedIdFormat(Models.FileHolder fileHolder, short sortOrderOnlyLengthIndex) => NameWithoutExtensionIsPaddedIdFormat(fileHolder, sortOrderOnlyLengthIndex); - static bool NameWithoutExtensionIsPaddedIdFormat(Models.FileHolder fileHolder, int sortOrderOnlyLengthIndex) => + static bool NameWithoutExtensionIsPaddedIdFormat(Models.FileHolder fileHolder, short sortOrderOnlyLengthIndex) => NameWithoutExtensionIsPaddedIdFormat(fileHolder.NameWithoutExtension, sortOrderOnlyLengthIndex); List TestStatic_GetFilesCollection(string directory, string directorySearchFilter, string fileSearchFilter, bool useCeilingAverage) =>