Removed CopyManualFiles

Updated Tests
This commit is contained in:
2023-08-07 22:02:08 -07:00
parent 9991d2bfac
commit 5582504c4b
15 changed files with 166 additions and 183 deletions

View File

@ -42,6 +42,7 @@ taskTemplate: '^+^_${overdue ? ''^R'' : ''''}${name}^: ${relations ? (''\n^-^/^g
- [eof-error](tasks/eof-error.md)
- [shrink-percent](tasks/shrink-percent.md)
- [setup-photo-prism-again-in-wsl-docker](tasks/setup-photo-prism-again-in-wsl-docker.md)
- [move-copy-manual-files-to-get-display-directory-all-files](tasks/move-copy-manual-files-to-get-display-directory-all-files.md)
- [rename-files-to-padded-number-string](tasks/rename-files-to-padded-number-string.md)
- [genealogical-data-communication-as-golden](tasks/genealogical-data-communication-as-golden.md)
- [look-for-family-from-jlink-in-x-mapped](tasks/look-for-family-from-jlink-in-x-mapped.md)

View File

@ -0,0 +1,11 @@
---
created: 2023-08-08T00:50:02.553Z
updated: 2023-08-08T05:01:29.188Z
assigned: ""
progress: 0
tags: []
started: 2023-08-07T00:00:00.000Z
completed: 2023-08-08T05:01:29.188Z
---
# Move CopyManualFiles to GetDisplayDirectoryAllFiles

View File

@ -34,7 +34,7 @@
{
"label": "File-Folder-Helper AOT s G File System to Genealogical Data Communication",
"type": "shell",
"command": "& L:/DevOps/Mesa_FI/File-Folder-Helper/bin/Release/net7.0/win-x64/publish/File-Folder-Helper.exe s F 'D:/1-Images-A/Images-dd514b88-Results/A2) People/dd514b88/([])/File-Folder-Helper/638268289384407819' -d 'D:/1-Images-A/Images-dd514b88-Results/A2) People/dd514b88/{2}'",
"command": "& L:/DevOps/Mesa_FI/File-Folder-Helper/bin/Release/net7.0/win-x64/publish/File-Folder-Helper.exe s G 'D:/1-Images-A/Images-dd514b88-Results/A2) People/dd514b88/([])/File-Folder-Helper/638268289384407819' -d 'D:/1-Images-A/Images-dd514b88-Results/A2) People/dd514b88/{2}'",
"problemMatcher": []
}
]

View File

@ -6,5 +6,6 @@ public interface IBlurHasher
string Encode(FileHolder fileHolder);
string GetFile(FileHolder fileHolder);
string EncodeAndSave(FileHolder fileHolder);
void Update(string resultsFullGroupDirectory);
}

View File

@ -79,9 +79,19 @@ public interface IDirectory
static (string[], List<(Models.FileHolder, string)>) GetToDoCollection(Properties.IPropertyConfiguration propertyConfiguration, bool copyDuplicates, bool ifCanUseId, List<string[]> filesCollection, string[] directories, Action? tick) =>
XDirectory.GetToDoCollection(propertyConfiguration, copyDuplicates, ifCanUseId, filesCollection, directories, tick);
void TestStatic_CopyOrMove(List<(Models.FileHolder, string)> toDoCollection, bool move, bool moveBack, Action? tick) =>
List<string> TestStatic_CopyOrMove(List<(Models.FileHolder, string)> toDoCollection, bool move, bool moveBack, Action? tick) =>
CopyOrMove(toDoCollection, move, moveBack, tick);
static List<string> CopyOrMove(List<(Models.FileHolder, string)> toDoCollection, bool move, bool moveBack, Action? tick) =>
XDirectory.CopyOrMove(toDoCollection, move, moveBack, tick);
(bool, int?) TestStatic_GetId(int sortOrderOnlyLengthIndex, Models.FileHolder fileHolder) =>
GetId(sortOrderOnlyLengthIndex, fileHolder);
static (bool, int?) GetId(int sortOrderOnlyLengthIndex, Models.FileHolder fileHolder) =>
XDirectory.GetId(sortOrderOnlyLengthIndex, fileHolder);
(bool, int?) TestStatic_GetId(Models.FileHolder fileHolder) =>
GetId(fileHolder);
static (bool, int?) GetId(Models.FileHolder fileHolder) =>
XDirectory.GetId(GetSortOrderOnlyLengthIndex(), fileHolder);
}

View File

@ -280,55 +280,57 @@ internal abstract partial class XDirectory
}
}
private static SortedRecord[] GetSortedRecords(List<string[]> filesCollection)
internal static (bool, int?) GetId(int sortOrderOnlyLengthIndex, Models.FileHolder fileHolder)
{
List<SortedRecord> results = new();
int? id;
short? multiplier;
char negativeMarker;
int absoluteValueOfId;
bool nameWithoutExtensionIsIdFormat = IProperty.NameWithoutExtensionIsIdFormat(fileHolder);
bool nameWithoutExtensionIsPaddedIdFormat = IDirectory.NameWithoutExtensionIsPaddedIdFormat(fileHolder, sortOrderOnlyLengthIndex);
if (!nameWithoutExtensionIsIdFormat && !nameWithoutExtensionIsPaddedIdFormat)
id = null;
else if (nameWithoutExtensionIsIdFormat)
{
if (!int.TryParse(fileHolder.NameWithoutExtension, out absoluteValueOfId))
id = null;
else
id = absoluteValueOfId;
}
else
{
negativeMarker = fileHolder.NameWithoutExtension[sortOrderOnlyLengthIndex - 2];
if (negativeMarker == '7')
multiplier = 1;
else if (negativeMarker == '3')
multiplier = -1;
else
multiplier = null;
if (!int.TryParse(fileHolder.NameWithoutExtension[sortOrderOnlyLengthIndex..], out absoluteValueOfId))
id = null;
else
{
id = absoluteValueOfId * multiplier;
if (id is null || !fileHolder.NameWithoutExtension.EndsWith(id.Value.ToString()[1..]))
id = null;
}
}
return (nameWithoutExtensionIsIdFormat, id);
}
private static SortedRecord[] GetSortedRecords(List<string[]> filesCollection)
{
List<SortedRecord> results = new();
int? id;
Models.FileHolder fileHolder;
bool nameWithoutExtensionIsIdFormat;
bool nameWithoutExtensionIsPaddedIdFormat;
int sortOrderOnlyLengthIndex = IDirectory.GetSortOrderOnlyLengthIndex();
foreach (string[] files in filesCollection)
{
foreach (string file in files)
{
fileHolder = new Models.FileHolder(file);
nameWithoutExtensionIsIdFormat = IProperty.NameWithoutExtensionIsIdFormat(fileHolder);
nameWithoutExtensionIsPaddedIdFormat = IDirectory.NameWithoutExtensionIsPaddedIdFormat(fileHolder, sortOrderOnlyLengthIndex);
if (nameWithoutExtensionIsIdFormat)
{
multiplier = null;
if (!int.TryParse(fileHolder.NameWithoutExtension, out absoluteValueOfId))
id = null;
else
id = absoluteValueOfId;
}
else if (!nameWithoutExtensionIsPaddedIdFormat)
{
id = null;
multiplier = null;
}
else
{
negativeMarker = fileHolder.NameWithoutExtension[sortOrderOnlyLengthIndex - 2];
if (negativeMarker == '7')
multiplier = 1;
else if (negativeMarker == '3')
multiplier = -1;
else
multiplier = null;
if (!int.TryParse(fileHolder.NameWithoutExtension[sortOrderOnlyLengthIndex..], out absoluteValueOfId))
id = null;
else
{
id = absoluteValueOfId * multiplier;
if (id is null || !fileHolder.NameWithoutExtension.EndsWith(id.Value.ToString()[1..]))
id = null;
}
}
fileHolder = new(file);
(nameWithoutExtensionIsIdFormat, id) = GetId(sortOrderOnlyLengthIndex, fileHolder);
results.Add(new(fileHolder, nameWithoutExtensionIsIdFormat, id));
}
}