Patched the rename detection function and had some debug output placed in the FileManager form.
This commit is contained in:
@@ -81,34 +81,46 @@ namespace DataOrganizer
|
||||
ComparisionSnapshot = new Snapshot(db.GetFilesForProfileByFolderGroup(p.Id, f.Id), f);
|
||||
var diff = ActiveSnapshot.Diff(ComparisionSnapshot);
|
||||
|
||||
//foreach (var folder in ActiveSnapshot.Directories.Values)
|
||||
//{
|
||||
// if (ComparisionSnapshot.Directories.ContainsKey(folder.FullPath))
|
||||
// {
|
||||
// renames.AddRange(ActiveSnapshot.FindFileRenames(folder, ComparisionSnapshot.Directories[folder.FullPath]));
|
||||
// }
|
||||
//}
|
||||
|
||||
//foreach (var rename in renames)
|
||||
//{
|
||||
// DiffViewTreeView.Nodes.Add($"From: {rename.From.Name}");
|
||||
// DiffViewTreeView.Nodes.Add($"To: {rename.To.Name}");
|
||||
//}
|
||||
var dupCount = 0;
|
||||
|
||||
foreach(var folder in ActiveSnapshot.TopLevelFolders.Keys)
|
||||
foreach (var folder in ActiveSnapshot.Directories.Values)
|
||||
{
|
||||
foreach(var dup in ActiveSnapshot.FindDuplicates(ActiveSnapshot.Directories[folder]))
|
||||
if (!folder.IsRootFolder)
|
||||
{
|
||||
var node = new TreeNode($"{dup.File.Name} ({dup.Duplicates.Count})") { ToolTipText = dup.File.FullPath };
|
||||
foreach(var d in dup.Duplicates)
|
||||
var noRoot = folder.FullPath.Remove(0, ActiveSnapshot.Root.FullPath.Length + 1);
|
||||
var w = Path.Combine(f.Path, noRoot);
|
||||
|
||||
if (ComparisionSnapshot.Directories.ContainsKey(w))
|
||||
{
|
||||
node.Nodes.Add(new TreeNode(d.Name) { ToolTipText = d.FullPath });
|
||||
dupCount++;
|
||||
renames.AddRange(ActiveSnapshot.FindFileRenames(folder, ComparisionSnapshot.Directories[w]));
|
||||
}
|
||||
DiffViewTreeView.Nodes.Add(node);
|
||||
}
|
||||
else
|
||||
{
|
||||
var compareRoot = ComparisionSnapshot.Directories.Single(x => x.Value.IsRootFolder).Value;
|
||||
|
||||
renames.AddRange(ActiveSnapshot.FindFileRenames(folder, compareRoot));
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var rename in renames)
|
||||
{
|
||||
DiffViewTreeView.Nodes.Add($"From: {rename.From.Name}");
|
||||
DiffViewTreeView.Nodes.Add($"To: {rename.To.Name}");
|
||||
}
|
||||
var dupCount = 0;
|
||||
|
||||
//foreach(var folder in ActiveSnapshot.TopLevelFolders.Keys)
|
||||
//{
|
||||
// foreach(var dup in ActiveSnapshot.FindDuplicates(ActiveSnapshot.Directories[folder]))
|
||||
// {
|
||||
// var node = new TreeNode($"{dup.File.Name} ({dup.Duplicates.Count})") { ToolTipText = dup.File.FullPath };
|
||||
// foreach(var d in dup.Duplicates)
|
||||
// {
|
||||
// node.Nodes.Add(new TreeNode(d.Name) { ToolTipText = d.FullPath });
|
||||
// dupCount++;
|
||||
// }
|
||||
// DiffViewTreeView.Nodes.Add(node);
|
||||
// }
|
||||
//}
|
||||
UpdateStatusLabel($"Found {dupCount} duplicate files.");
|
||||
//foreach(var file in diff.NewFiles)
|
||||
// AddFileSnapshotToDiffView(file, GetSelectedFolderGroup(), FileSnapshot.FileStatus.PendingInsert);
|
||||
|
||||
Reference in New Issue
Block a user