Patched the rename detection function and had some debug output placed in the FileManager form.
This commit is contained in:
Binary file not shown.
Generated
+1
@@ -379,6 +379,7 @@
|
|||||||
this.ClientSize = new System.Drawing.Size(1306, 964);
|
this.ClientSize = new System.Drawing.Size(1306, 964);
|
||||||
this.Controls.Add(this.MainLayoutPanel);
|
this.Controls.Add(this.MainLayoutPanel);
|
||||||
this.Name = "FileManager";
|
this.Name = "FileManager";
|
||||||
|
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||||
this.Text = "File Manager";
|
this.Text = "File Manager";
|
||||||
this.MainLayoutPanel.ResumeLayout(false);
|
this.MainLayoutPanel.ResumeLayout(false);
|
||||||
this.MainLayoutPanel.PerformLayout();
|
this.MainLayoutPanel.PerformLayout();
|
||||||
|
|||||||
@@ -81,34 +81,46 @@ namespace DataOrganizer
|
|||||||
ComparisionSnapshot = new Snapshot(db.GetFilesForProfileByFolderGroup(p.Id, f.Id), f);
|
ComparisionSnapshot = new Snapshot(db.GetFilesForProfileByFolderGroup(p.Id, f.Id), f);
|
||||||
var diff = ActiveSnapshot.Diff(ComparisionSnapshot);
|
var diff = ActiveSnapshot.Diff(ComparisionSnapshot);
|
||||||
|
|
||||||
//foreach (var folder in ActiveSnapshot.Directories.Values)
|
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 dup in ActiveSnapshot.FindDuplicates(ActiveSnapshot.Directories[folder]))
|
if (!folder.IsRootFolder)
|
||||||
{
|
{
|
||||||
var node = new TreeNode($"{dup.File.Name} ({dup.Duplicates.Count})") { ToolTipText = dup.File.FullPath };
|
var noRoot = folder.FullPath.Remove(0, ActiveSnapshot.Root.FullPath.Length + 1);
|
||||||
foreach(var d in dup.Duplicates)
|
var w = Path.Combine(f.Path, noRoot);
|
||||||
|
|
||||||
|
if (ComparisionSnapshot.Directories.ContainsKey(w))
|
||||||
{
|
{
|
||||||
node.Nodes.Add(new TreeNode(d.Name) { ToolTipText = d.FullPath });
|
renames.AddRange(ActiveSnapshot.FindFileRenames(folder, ComparisionSnapshot.Directories[w]));
|
||||||
dupCount++;
|
|
||||||
}
|
}
|
||||||
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.");
|
UpdateStatusLabel($"Found {dupCount} duplicate files.");
|
||||||
//foreach(var file in diff.NewFiles)
|
//foreach(var file in diff.NewFiles)
|
||||||
// AddFileSnapshotToDiffView(file, GetSelectedFolderGroup(), FileSnapshot.FileStatus.PendingInsert);
|
// AddFileSnapshotToDiffView(file, GetSelectedFolderGroup(), FileSnapshot.FileStatus.PendingInsert);
|
||||||
|
|||||||
@@ -123,4 +123,10 @@
|
|||||||
<metadata name="statusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
<metadata name="statusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
<value>205, 17</value>
|
<value>205, 17</value>
|
||||||
</metadata>
|
</metadata>
|
||||||
|
<metadata name="MainMenuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
|
<value>17, 17</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="statusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
|
<value>205, 17</value>
|
||||||
|
</metadata>
|
||||||
</root>
|
</root>
|
||||||
@@ -265,7 +265,10 @@ namespace DataOrganizer
|
|||||||
foreach(var f in b.Files.Values)
|
foreach(var f in b.Files.Values)
|
||||||
{
|
{
|
||||||
if (file.Size == f.Size && file.CreatedDate == f.CreatedDate && file.ModifiedDate == f.ModifiedDate)
|
if (file.Size == f.Size && file.CreatedDate == f.CreatedDate && file.ModifiedDate == f.ModifiedDate)
|
||||||
renames.Add(new SnapshotComparsion.RenamedFile() { From = file, To = f });
|
{
|
||||||
|
if(f.Name != file.Name)
|
||||||
|
renames.Add(new SnapshotComparsion.RenamedFile() { From = file, To = f });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user