ResultAllInOneSubdirectoryLength

This commit is contained in:
2023-06-25 21:00:54 -07:00
parent 8dfcc33e74
commit 3092cd5b9e
52 changed files with 351 additions and 221 deletions

View File

@ -175,17 +175,17 @@ internal abstract partial class XDirectory
return results;
}
private static void IsUniqueLoop(string resultAllInOne, string resultAllInOneDirectory, FilePair item, List<(string, string)> rename)
private static void IsUniqueLoop(string resultAllInOne, string resultAllInOneDirectory, int resultAllInOneSubdirectoryLength, FilePair item, List<(string, string)> rename)
{
char directory;
string fileName;
string directoryName;
foreach (string path in item.Collection)
{
if (path.Contains(resultAllInOne))
continue;
fileName = Path.GetFileName(path);
directory = IDirectory.GetDirectory(fileName);
rename.Add(new(path, Path.Combine(resultAllInOneDirectory, directory.ToString(), fileName)));
(directoryName, _) = IPath.GetDirectoryNameAndIndex(resultAllInOneSubdirectoryLength, fileName);
rename.Add(new(path, Path.Combine(resultAllInOneDirectory, directoryName, fileName)));
}
}
@ -202,7 +202,7 @@ internal abstract partial class XDirectory
}
}
internal static int MaybeMove(string directory, string resultAllInOne, List<FilePair> filePairs, string jsonGroupDirectory, string extension)
internal static int MaybeMove(string directory, string resultAllInOne, int resultAllInOneSubdirectoryLength, List<FilePair> filePairs, string jsonGroupDirectory, string extension)
{
FileInfo? toFileInfo;
FileInfo fromFileInfo;
@ -212,7 +212,7 @@ internal abstract partial class XDirectory
foreach (FilePair item in filePairs)
{
if (item.IsUnique)
IsUniqueLoop(resultAllInOne, resultAllInOneDirectory, item, rename);
IsUniqueLoop(resultAllInOne, resultAllInOneDirectory, resultAllInOneSubdirectoryLength, item, rename);
else
IsNotUniqueLoop(directory, resultAllInOne, jsonGroupDirectory, extension, item, rename);
}