Start of ;9

This commit is contained in:
2023-05-05 09:39:15 -07:00
parent e6acce3852
commit 1e85c0ba2e
2 changed files with 18 additions and 2 deletions

View File

@ -108,7 +108,9 @@ internal abstract partial class XDirectory
if (possibleFileInfo.LastWriteTime == fileInfo.LastWriteTime && possibleFileInfo.Length == fileInfo.Length)
continue;
timeSpan = new(possibleFileInfo.LastWriteTime.Ticks - fileInfo.LastWriteTime.Ticks);
if (timeSpan.TotalMinutes < 2 && possibleFileInfo.Length == fileInfo.Length)
if (possibleFileInfo.Length != fileInfo.Length)
throw new Exception(Path.GetFileNameWithoutExtension(file));
if (timeSpan.TotalMinutes < 61)
{
File.SetLastWriteTime(file, new DateTime[] { possibleFileInfo.LastWriteTime, fileInfo.LastWriteTime }.Min());
continue;
@ -134,7 +136,7 @@ internal abstract partial class XDirectory
continue;
matches.Add(possible);
}
if (matches.Count == 1 || (lengths.Distinct().Count() == 1 && creationTimes.Distinct().Count() == 1))
if (matches.Count == 1 || (matches.Any() && lengths.Distinct().Count() == 1 && creationTimes.Distinct().Count() == 1))
result = matches.First();
return result;
}