DistanceLimits
This commit is contained in:
@ -68,19 +68,25 @@ internal abstract partial class XDirectory
|
||||
internal static int LookForAbandoned(List<string[]> jsonFilesCollection, IReadOnlyDictionary<string, List<string>> fileNamesToFiles, string extension)
|
||||
{
|
||||
string fileName;
|
||||
string fileNameWith;
|
||||
List<string>? collection;
|
||||
string fileNameUpperExtension;
|
||||
int length = extension.Length;
|
||||
List<(string, string)> rename = new();
|
||||
foreach (string[] files in jsonFilesCollection)
|
||||
{
|
||||
foreach (string file in files)
|
||||
{
|
||||
fileName = Path.GetFileName(file);
|
||||
if (fileName.Length < length || !fileName.EndsWith(extension))
|
||||
fileNameWith = Path.GetFileName(file);
|
||||
if (fileNameWith.Length < length || !fileNameWith.EndsWith(extension))
|
||||
throw new Exception();
|
||||
if (!fileNamesToFiles.TryGetValue(fileName[..^length], out collection))
|
||||
rename.Add(new(file, string.Concat(file, ".del")));
|
||||
|
||||
fileName = fileNameWith[..^length];
|
||||
if (!fileNamesToFiles.TryGetValue(fileName, out collection))
|
||||
{
|
||||
fileNameUpperExtension = string.Concat(Path.GetFileNameWithoutExtension(fileName), Path.GetExtension(fileName).ToUpper());
|
||||
if (fileName == fileNameUpperExtension || !fileNamesToFiles.TryGetValue(fileNameUpperExtension, out collection))
|
||||
rename.Add(new(file, string.Concat(file, ".del")));
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach ((string from, string to) in rename)
|
||||
@ -236,7 +242,6 @@ internal abstract partial class XDirectory
|
||||
}
|
||||
File.Move(from, checkDirectory);
|
||||
}
|
||||
_ = IPath.DeleteEmptyDirectories(jsonGroupDirectory);
|
||||
return rename.Count;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user