Introduced a concept of folder depth in the database code, and updated the Snapshot class to take advantage of it. Only working for a 'OneLevel' Folder Group type.
This commit is contained in:
Binary file not shown.
+32
-7
@@ -86,12 +86,29 @@ namespace DataOrganizer
|
|||||||
|
|
||||||
while(reader.Read())
|
while(reader.Read())
|
||||||
{
|
{
|
||||||
|
var type = OrganizationType.Custom;
|
||||||
|
var patternId = Convert.ToInt32(reader["pattern_id"]);
|
||||||
|
|
||||||
|
switch (patternId)
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
|
type = OrganizationType.SingleLevel;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
type = OrganizationType.Flat;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
type = OrganizationType.Custom;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
profile.FolderGroups.Add(new FolderGroup
|
profile.FolderGroups.Add(new FolderGroup
|
||||||
{
|
{
|
||||||
Name = reader["name"].ToString(),
|
Name = reader["name"].ToString(),
|
||||||
Id = Convert.ToInt32(reader["root_id"]),
|
Id = Convert.ToInt32(reader["root_id"]),
|
||||||
Path = reader["path"].ToString(),
|
Path = reader["path"].ToString(),
|
||||||
PatternId = Convert.ToInt32(reader["pattern_id"])
|
PatternId = Convert.ToInt32(reader["pattern_id"]),
|
||||||
|
Type = type
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -365,19 +382,18 @@ namespace DataOrganizer
|
|||||||
|
|
||||||
while(reader.Read())
|
while(reader.Read())
|
||||||
{
|
{
|
||||||
var fullPath = string.Format("{0}{1}", reader["path"], reader["full_path"]);
|
|
||||||
|
|
||||||
files.Add(new FileSnapshot
|
files.Add(new FileSnapshot
|
||||||
{
|
{
|
||||||
Id = Convert.ToInt32(reader["file_id"]),
|
Id = Convert.ToInt32(reader["file_id"]),
|
||||||
FullPath = fullPath,
|
PathNoRoot = reader["full_path"].ToString(),
|
||||||
Name = reader["name"].ToString(),
|
Name = reader["name"].ToString(),
|
||||||
ProfileId = profileId,
|
ProfileId = profileId,
|
||||||
RootFolderId = folderGroupId,
|
RootFolderId = folderGroupId,
|
||||||
Size = Convert.ToInt64(reader["size"]),
|
Size = Convert.ToInt64(reader["size"]),
|
||||||
CreationDate = Convert.ToDateTime(reader["date_created"]),
|
CreationDate = Convert.ToDateTime(reader["date_created"]),
|
||||||
ModifiedDate = Convert.ToDateTime(reader["date_modified"]),
|
ModifiedDate = Convert.ToDateTime(reader["date_modified"]),
|
||||||
PatternId = Convert.ToInt32(reader["pattern_override_id"])
|
PatternId = Convert.ToInt32(reader["pattern_override_id"]),
|
||||||
|
RootPath = reader["path"].ToString(),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -401,7 +417,7 @@ namespace DataOrganizer
|
|||||||
{
|
{
|
||||||
foreach (var file in files)
|
foreach (var file in files)
|
||||||
{
|
{
|
||||||
command.Parameters.AddWithValue("FullPath", file.FullPath.Remove(0, rootLength));
|
command.Parameters.AddWithValue("FullPath", file.PathNoRoot.Remove(0, rootLength));
|
||||||
command.Parameters.AddWithValue("Name", file.Name);
|
command.Parameters.AddWithValue("Name", file.Name);
|
||||||
command.Parameters.AddWithValue("Size", file.Size);
|
command.Parameters.AddWithValue("Size", file.Size);
|
||||||
command.Parameters.AddWithValue("DateCreated", file.CreationDate);
|
command.Parameters.AddWithValue("DateCreated", file.CreationDate);
|
||||||
@@ -435,6 +451,7 @@ namespace DataOrganizer
|
|||||||
public int Id;
|
public int Id;
|
||||||
public string Name;
|
public string Name;
|
||||||
public string Path;
|
public string Path;
|
||||||
|
public OrganizationType Type;
|
||||||
public int PatternId;
|
public int PatternId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -449,7 +466,7 @@ namespace DataOrganizer
|
|||||||
public struct FileSnapshot
|
public struct FileSnapshot
|
||||||
{
|
{
|
||||||
public int Id;
|
public int Id;
|
||||||
public string FullPath;
|
public string PathNoRoot;
|
||||||
public string Name;
|
public string Name;
|
||||||
public int ProfileId;
|
public int ProfileId;
|
||||||
public int PatternId;
|
public int PatternId;
|
||||||
@@ -457,6 +474,14 @@ namespace DataOrganizer
|
|||||||
public DateTime CreationDate;
|
public DateTime CreationDate;
|
||||||
public DateTime ModifiedDate;
|
public DateTime ModifiedDate;
|
||||||
public long Size;
|
public long Size;
|
||||||
|
public string RootPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum OrganizationType
|
||||||
|
{
|
||||||
|
Flat = 0,
|
||||||
|
SingleLevel = 1,
|
||||||
|
Custom = 2
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Generated
+87
-10
@@ -45,11 +45,18 @@
|
|||||||
this.label2 = new System.Windows.Forms.Label();
|
this.label2 = new System.Windows.Forms.Label();
|
||||||
this.StatusStrip = new System.Windows.Forms.StatusStrip();
|
this.StatusStrip = new System.Windows.Forms.StatusStrip();
|
||||||
this.StatusLabel = new System.Windows.Forms.ToolStripStatusLabel();
|
this.StatusLabel = new System.Windows.Forms.ToolStripStatusLabel();
|
||||||
|
this.FileInfoGroupBox = new System.Windows.Forms.GroupBox();
|
||||||
|
this.FileDetailsNameLabel = new System.Windows.Forms.Label();
|
||||||
|
this.FileDetailsFullPathLabel = new System.Windows.Forms.Label();
|
||||||
|
this.label6 = new System.Windows.Forms.Label();
|
||||||
|
this.label7 = new System.Windows.Forms.Label();
|
||||||
|
this.label8 = new System.Windows.Forms.Label();
|
||||||
this.tableLayoutPanel1.SuspendLayout();
|
this.tableLayoutPanel1.SuspendLayout();
|
||||||
this.PanelOne.SuspendLayout();
|
this.PanelOne.SuspendLayout();
|
||||||
this.SelectedFolderPanel.SuspendLayout();
|
this.SelectedFolderPanel.SuspendLayout();
|
||||||
this.ActiveFolderGroupBox.SuspendLayout();
|
this.ActiveFolderGroupBox.SuspendLayout();
|
||||||
this.StatusStrip.SuspendLayout();
|
this.StatusStrip.SuspendLayout();
|
||||||
|
this.FileInfoGroupBox.SuspendLayout();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
// MainMenu
|
// MainMenu
|
||||||
@@ -58,7 +65,7 @@
|
|||||||
this.MainMenu.ImageScalingSize = new System.Drawing.Size(24, 24);
|
this.MainMenu.ImageScalingSize = new System.Drawing.Size(24, 24);
|
||||||
this.MainMenu.Location = new System.Drawing.Point(0, 0);
|
this.MainMenu.Location = new System.Drawing.Point(0, 0);
|
||||||
this.MainMenu.Name = "MainMenu";
|
this.MainMenu.Name = "MainMenu";
|
||||||
this.MainMenu.Size = new System.Drawing.Size(1472, 24);
|
this.MainMenu.Size = new System.Drawing.Size(1472, 36);
|
||||||
this.MainMenu.TabIndex = 0;
|
this.MainMenu.TabIndex = 0;
|
||||||
this.MainMenu.Text = "menuStrip1";
|
this.MainMenu.Text = "menuStrip1";
|
||||||
//
|
//
|
||||||
@@ -73,34 +80,36 @@
|
|||||||
this.tableLayoutPanel1.Controls.Add(this.PrimaryFilesTreeView, 0, 1);
|
this.tableLayoutPanel1.Controls.Add(this.PrimaryFilesTreeView, 0, 1);
|
||||||
this.tableLayoutPanel1.Controls.Add(this.PanelOne, 0, 0);
|
this.tableLayoutPanel1.Controls.Add(this.PanelOne, 0, 0);
|
||||||
this.tableLayoutPanel1.Controls.Add(this.SelectedFolderPanel, 2, 0);
|
this.tableLayoutPanel1.Controls.Add(this.SelectedFolderPanel, 2, 0);
|
||||||
|
this.tableLayoutPanel1.Controls.Add(this.FileInfoGroupBox, 1, 0);
|
||||||
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
|
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 24);
|
this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 36);
|
||||||
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
|
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
|
||||||
this.tableLayoutPanel1.RowCount = 3;
|
this.tableLayoutPanel1.RowCount = 3;
|
||||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33F));
|
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33F));
|
||||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 34F));
|
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 34F));
|
||||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33F));
|
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33F));
|
||||||
this.tableLayoutPanel1.Size = new System.Drawing.Size(1472, 882);
|
this.tableLayoutPanel1.Size = new System.Drawing.Size(1472, 870);
|
||||||
this.tableLayoutPanel1.TabIndex = 1;
|
this.tableLayoutPanel1.TabIndex = 1;
|
||||||
//
|
//
|
||||||
// SecondaryTreeView
|
// SecondaryTreeView
|
||||||
//
|
//
|
||||||
this.SecondaryTreeView.Dock = System.Windows.Forms.DockStyle.Fill;
|
this.SecondaryTreeView.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
this.SecondaryTreeView.Location = new System.Drawing.Point(739, 294);
|
this.SecondaryTreeView.Location = new System.Drawing.Point(739, 290);
|
||||||
this.SecondaryTreeView.Name = "SecondaryTreeView";
|
this.SecondaryTreeView.Name = "SecondaryTreeView";
|
||||||
this.tableLayoutPanel1.SetRowSpan(this.SecondaryTreeView, 2);
|
this.tableLayoutPanel1.SetRowSpan(this.SecondaryTreeView, 2);
|
||||||
this.SecondaryTreeView.Size = new System.Drawing.Size(362, 585);
|
this.SecondaryTreeView.ShowNodeToolTips = true;
|
||||||
|
this.SecondaryTreeView.Size = new System.Drawing.Size(362, 577);
|
||||||
this.SecondaryTreeView.TabIndex = 2;
|
this.SecondaryTreeView.TabIndex = 2;
|
||||||
//
|
//
|
||||||
// PrimaryFilesTreeView
|
// PrimaryFilesTreeView
|
||||||
//
|
//
|
||||||
this.PrimaryFilesTreeView.Dock = System.Windows.Forms.DockStyle.Fill;
|
this.PrimaryFilesTreeView.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
this.PrimaryFilesTreeView.FullRowSelect = true;
|
this.PrimaryFilesTreeView.FullRowSelect = true;
|
||||||
this.PrimaryFilesTreeView.Location = new System.Drawing.Point(3, 294);
|
this.PrimaryFilesTreeView.Location = new System.Drawing.Point(3, 290);
|
||||||
this.PrimaryFilesTreeView.Name = "PrimaryFilesTreeView";
|
this.PrimaryFilesTreeView.Name = "PrimaryFilesTreeView";
|
||||||
this.tableLayoutPanel1.SetRowSpan(this.PrimaryFilesTreeView, 2);
|
this.tableLayoutPanel1.SetRowSpan(this.PrimaryFilesTreeView, 2);
|
||||||
this.PrimaryFilesTreeView.ShowNodeToolTips = true;
|
this.PrimaryFilesTreeView.ShowNodeToolTips = true;
|
||||||
this.PrimaryFilesTreeView.Size = new System.Drawing.Size(362, 585);
|
this.PrimaryFilesTreeView.Size = new System.Drawing.Size(362, 577);
|
||||||
this.PrimaryFilesTreeView.TabIndex = 0;
|
this.PrimaryFilesTreeView.TabIndex = 0;
|
||||||
//
|
//
|
||||||
// PanelOne
|
// PanelOne
|
||||||
@@ -113,7 +122,7 @@
|
|||||||
this.PanelOne.Dock = System.Windows.Forms.DockStyle.Fill;
|
this.PanelOne.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
this.PanelOne.Location = new System.Drawing.Point(3, 3);
|
this.PanelOne.Location = new System.Drawing.Point(3, 3);
|
||||||
this.PanelOne.Name = "PanelOne";
|
this.PanelOne.Name = "PanelOne";
|
||||||
this.PanelOne.Size = new System.Drawing.Size(362, 285);
|
this.PanelOne.Size = new System.Drawing.Size(362, 281);
|
||||||
this.PanelOne.TabIndex = 1;
|
this.PanelOne.TabIndex = 1;
|
||||||
//
|
//
|
||||||
// ScanRootFolderButton
|
// ScanRootFolderButton
|
||||||
@@ -169,7 +178,7 @@
|
|||||||
this.SelectedFolderPanel.Dock = System.Windows.Forms.DockStyle.Fill;
|
this.SelectedFolderPanel.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
this.SelectedFolderPanel.Location = new System.Drawing.Point(739, 3);
|
this.SelectedFolderPanel.Location = new System.Drawing.Point(739, 3);
|
||||||
this.SelectedFolderPanel.Name = "SelectedFolderPanel";
|
this.SelectedFolderPanel.Name = "SelectedFolderPanel";
|
||||||
this.SelectedFolderPanel.Size = new System.Drawing.Size(730, 285);
|
this.SelectedFolderPanel.Size = new System.Drawing.Size(730, 281);
|
||||||
this.SelectedFolderPanel.TabIndex = 3;
|
this.SelectedFolderPanel.TabIndex = 3;
|
||||||
//
|
//
|
||||||
// ActiveFolderGroupBox
|
// ActiveFolderGroupBox
|
||||||
@@ -180,7 +189,7 @@
|
|||||||
this.ActiveFolderGroupBox.Dock = System.Windows.Forms.DockStyle.Fill;
|
this.ActiveFolderGroupBox.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
this.ActiveFolderGroupBox.Location = new System.Drawing.Point(0, 0);
|
this.ActiveFolderGroupBox.Location = new System.Drawing.Point(0, 0);
|
||||||
this.ActiveFolderGroupBox.Name = "ActiveFolderGroupBox";
|
this.ActiveFolderGroupBox.Name = "ActiveFolderGroupBox";
|
||||||
this.ActiveFolderGroupBox.Size = new System.Drawing.Size(730, 285);
|
this.ActiveFolderGroupBox.Size = new System.Drawing.Size(730, 281);
|
||||||
this.ActiveFolderGroupBox.TabIndex = 0;
|
this.ActiveFolderGroupBox.TabIndex = 0;
|
||||||
this.ActiveFolderGroupBox.TabStop = false;
|
this.ActiveFolderGroupBox.TabStop = false;
|
||||||
this.ActiveFolderGroupBox.Text = "Folder Options";
|
this.ActiveFolderGroupBox.Text = "Folder Options";
|
||||||
@@ -229,6 +238,66 @@
|
|||||||
this.StatusLabel.Size = new System.Drawing.Size(179, 25);
|
this.StatusLabel.Size = new System.Drawing.Size(179, 25);
|
||||||
this.StatusLabel.Text = "toolStripStatusLabel1";
|
this.StatusLabel.Text = "toolStripStatusLabel1";
|
||||||
//
|
//
|
||||||
|
// FileInfoGroupBox
|
||||||
|
//
|
||||||
|
this.FileInfoGroupBox.Controls.Add(this.label8);
|
||||||
|
this.FileInfoGroupBox.Controls.Add(this.label7);
|
||||||
|
this.FileInfoGroupBox.Controls.Add(this.label6);
|
||||||
|
this.FileInfoGroupBox.Controls.Add(this.FileDetailsFullPathLabel);
|
||||||
|
this.FileInfoGroupBox.Controls.Add(this.FileDetailsNameLabel);
|
||||||
|
this.FileInfoGroupBox.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
|
this.FileInfoGroupBox.Location = new System.Drawing.Point(371, 3);
|
||||||
|
this.FileInfoGroupBox.Name = "FileInfoGroupBox";
|
||||||
|
this.FileInfoGroupBox.Size = new System.Drawing.Size(362, 281);
|
||||||
|
this.FileInfoGroupBox.TabIndex = 4;
|
||||||
|
this.FileInfoGroupBox.TabStop = false;
|
||||||
|
this.FileInfoGroupBox.Text = "File Details";
|
||||||
|
//
|
||||||
|
// FileDetailsNameLabel
|
||||||
|
//
|
||||||
|
this.FileDetailsNameLabel.AutoSize = true;
|
||||||
|
this.FileDetailsNameLabel.Location = new System.Drawing.Point(6, 20);
|
||||||
|
this.FileDetailsNameLabel.Name = "FileDetailsNameLabel";
|
||||||
|
this.FileDetailsNameLabel.Size = new System.Drawing.Size(55, 20);
|
||||||
|
this.FileDetailsNameLabel.TabIndex = 0;
|
||||||
|
this.FileDetailsNameLabel.Text = "Name:";
|
||||||
|
//
|
||||||
|
// FileDetailsFullPathLabel
|
||||||
|
//
|
||||||
|
this.FileDetailsFullPathLabel.AutoSize = true;
|
||||||
|
this.FileDetailsFullPathLabel.Location = new System.Drawing.Point(6, 60);
|
||||||
|
this.FileDetailsFullPathLabel.Name = "FileDetailsFullPathLabel";
|
||||||
|
this.FileDetailsFullPathLabel.Size = new System.Drawing.Size(75, 20);
|
||||||
|
this.FileDetailsFullPathLabel.TabIndex = 1;
|
||||||
|
this.FileDetailsFullPathLabel.Text = "Full Path:";
|
||||||
|
//
|
||||||
|
// label6
|
||||||
|
//
|
||||||
|
this.label6.AutoSize = true;
|
||||||
|
this.label6.Location = new System.Drawing.Point(6, 100);
|
||||||
|
this.label6.Name = "label6";
|
||||||
|
this.label6.Size = new System.Drawing.Size(55, 20);
|
||||||
|
this.label6.TabIndex = 2;
|
||||||
|
this.label6.Text = "Name:";
|
||||||
|
//
|
||||||
|
// label7
|
||||||
|
//
|
||||||
|
this.label7.AutoSize = true;
|
||||||
|
this.label7.Location = new System.Drawing.Point(6, 140);
|
||||||
|
this.label7.Name = "label7";
|
||||||
|
this.label7.Size = new System.Drawing.Size(55, 20);
|
||||||
|
this.label7.TabIndex = 3;
|
||||||
|
this.label7.Text = "Name:";
|
||||||
|
//
|
||||||
|
// label8
|
||||||
|
//
|
||||||
|
this.label8.AutoSize = true;
|
||||||
|
this.label8.Location = new System.Drawing.Point(6, 180);
|
||||||
|
this.label8.Name = "label8";
|
||||||
|
this.label8.Size = new System.Drawing.Size(55, 20);
|
||||||
|
this.label8.TabIndex = 4;
|
||||||
|
this.label8.Text = "Name:";
|
||||||
|
//
|
||||||
// FileViewer
|
// FileViewer
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F);
|
||||||
@@ -249,6 +318,8 @@
|
|||||||
this.ActiveFolderGroupBox.PerformLayout();
|
this.ActiveFolderGroupBox.PerformLayout();
|
||||||
this.StatusStrip.ResumeLayout(false);
|
this.StatusStrip.ResumeLayout(false);
|
||||||
this.StatusStrip.PerformLayout();
|
this.StatusStrip.PerformLayout();
|
||||||
|
this.FileInfoGroupBox.ResumeLayout(false);
|
||||||
|
this.FileInfoGroupBox.PerformLayout();
|
||||||
this.ResumeLayout(false);
|
this.ResumeLayout(false);
|
||||||
this.PerformLayout();
|
this.PerformLayout();
|
||||||
|
|
||||||
@@ -273,5 +344,11 @@
|
|||||||
private System.Windows.Forms.Button ScanRootFolderButton;
|
private System.Windows.Forms.Button ScanRootFolderButton;
|
||||||
private System.Windows.Forms.StatusStrip StatusStrip;
|
private System.Windows.Forms.StatusStrip StatusStrip;
|
||||||
private System.Windows.Forms.ToolStripStatusLabel StatusLabel;
|
private System.Windows.Forms.ToolStripStatusLabel StatusLabel;
|
||||||
|
private System.Windows.Forms.GroupBox FileInfoGroupBox;
|
||||||
|
private System.Windows.Forms.Label label8;
|
||||||
|
private System.Windows.Forms.Label label7;
|
||||||
|
private System.Windows.Forms.Label label6;
|
||||||
|
private System.Windows.Forms.Label FileDetailsFullPathLabel;
|
||||||
|
private System.Windows.Forms.Label FileDetailsNameLabel;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+108
-76
@@ -18,6 +18,8 @@ namespace DataOrganizer
|
|||||||
private Dictionary<string, DB.FolderGroup> FolderGroups { get; } = new Dictionary<string, DB.FolderGroup>();
|
private Dictionary<string, DB.FolderGroup> FolderGroups { get; } = new Dictionary<string, DB.FolderGroup>();
|
||||||
private string CurrentNamingPattern { get; set; } = string.Empty;
|
private string CurrentNamingPattern { get; set; } = string.Empty;
|
||||||
private ContextMenu PrimaryTreeContextMenu { get; set; } = new ContextMenu(); //Copy to default new content location, set new naming rules etc..
|
private ContextMenu PrimaryTreeContextMenu { get; set; } = new ContextMenu(); //Copy to default new content location, set new naming rules etc..
|
||||||
|
private Snapshot ActiveSnapshotForPrimaryTree { get; set; }
|
||||||
|
private Dictionary<string, TreeNode> PrimaryTreeNodes { get; set; } = new Dictionary<string, TreeNode>();
|
||||||
|
|
||||||
public FileViewer()
|
public FileViewer()
|
||||||
{
|
{
|
||||||
@@ -34,10 +36,22 @@ namespace DataOrganizer
|
|||||||
|
|
||||||
ProfileComboBox.SelectedIndexChanged += ProfileComboBox_SelectedIndexChanged;
|
ProfileComboBox.SelectedIndexChanged += ProfileComboBox_SelectedIndexChanged;
|
||||||
RootFolderComboBox.SelectedIndexChanged += SelectedFolderComboBox_SelectedIndexChanged;
|
RootFolderComboBox.SelectedIndexChanged += SelectedFolderComboBox_SelectedIndexChanged;
|
||||||
|
PrimaryFilesTreeView.NodeMouseClick += PrimaryFilesTreeView_NodeMouseClick;
|
||||||
|
|
||||||
ProfileComboBox.SelectedIndex = 0;
|
ProfileComboBox.SelectedIndex = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void PrimaryFilesTreeView_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
|
||||||
|
{
|
||||||
|
if(ActiveSnapshotForPrimaryTree.Files.ContainsKey(e.Node.Name))
|
||||||
|
{
|
||||||
|
var file = ActiveSnapshotForPrimaryTree.Files[e.Node.Name];
|
||||||
|
|
||||||
|
FileDetailsNameLabel.Text = $"Name: {file.Name}";
|
||||||
|
FileDetailsFullPathLabel.Text = $"Full Path: {file.PathNoRoot}";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void SelectedFolderComboBox_SelectedIndexChanged(object sender, EventArgs e)
|
private void SelectedFolderComboBox_SelectedIndexChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var db = new DB();
|
var db = new DB();
|
||||||
@@ -47,14 +61,25 @@ namespace DataOrganizer
|
|||||||
var profile = Profiles[ProfileComboBox.Text];
|
var profile = Profiles[ProfileComboBox.Text];
|
||||||
|
|
||||||
PrimaryFilesTreeView.Nodes.Clear();
|
PrimaryFilesTreeView.Nodes.Clear();
|
||||||
|
PrimaryTreeNodes.Clear();
|
||||||
|
|
||||||
var files = db.GetFilesForProfileByFolderGroup(profile.Id, folderGroup.Id);
|
var files = db.GetFilesForProfileByFolderGroup(profile.Id, folderGroup.Id);
|
||||||
var snapshot = new Snapshot(files, profile, folderGroup);
|
ActiveSnapshotForPrimaryTree = new Snapshot(files, profile, folderGroup);
|
||||||
|
|
||||||
foreach(var folder in snapshot.Root.Folders)
|
foreach(var folder in ActiveSnapshotForPrimaryTree.Root.Folders)
|
||||||
{
|
{
|
||||||
PrimaryFilesTreeView.Nodes.Add(GetNodeFromSnapshot(folder));
|
PrimaryFilesTreeView.Nodes.Add(GetNodeFromSnapshot(folder));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//var count = 1;
|
||||||
|
|
||||||
|
//foreach(var file in ActiveSnapshotForPrimaryTree.FileDuplicates)
|
||||||
|
//{
|
||||||
|
// PrimaryTreeNodes[file.Value.File.PathNoRoot].Text = $"{count} ) {file.Value.File.Name}";
|
||||||
|
// PrimaryTreeNodes[file.Value.Duplicates[0].PathNoRoot].Text = $"{count} ) {file.Value.Duplicates[0].Name}";
|
||||||
|
|
||||||
|
// count++;
|
||||||
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
private TreeNode GetNodeFromSnapshot(KeyValuePair<string, Folder> folder)
|
private TreeNode GetNodeFromSnapshot(KeyValuePair<string, Folder> folder)
|
||||||
@@ -65,6 +90,7 @@ namespace DataOrganizer
|
|||||||
foreach(var f in folder.Value.Folders)
|
foreach(var f in folder.Value.Folders)
|
||||||
{
|
{
|
||||||
var folderNode = GetNodeFromSnapshot(f);
|
var folderNode = GetNodeFromSnapshot(f);
|
||||||
|
//PrimaryTreeNodes.Add(f.Key, folderNode);
|
||||||
node.Nodes.Add(folderNode);
|
node.Nodes.Add(folderNode);
|
||||||
if (folderNode.ForeColor == Color.Orange)
|
if (folderNode.ForeColor == Color.Orange)
|
||||||
{
|
{
|
||||||
@@ -76,13 +102,17 @@ namespace DataOrganizer
|
|||||||
foreach(var file in folder.Value.Files)
|
foreach(var file in folder.Value.Files)
|
||||||
{
|
{
|
||||||
var fileNode = new TreeNode(file.Value.Name) { Name = file.Key, ToolTipText = file.Key };
|
var fileNode = new TreeNode(file.Value.Name) { Name = file.Key, ToolTipText = file.Key };
|
||||||
|
//PrimaryTreeNodes.Add(file.Key, fileNode);
|
||||||
|
|
||||||
if (!regex.IsMatch(file.Value.Name)) fileNode.ForeColor = Color.Orange;
|
if (!regex.IsMatch(file.Value.Name)) fileNode.ForeColor = Color.Orange;
|
||||||
|
|
||||||
node.Nodes.Add(fileNode);
|
node.Nodes.Add(fileNode);
|
||||||
node.ForeColor = fileNode.ForeColor;
|
if(node.ForeColor != Color.Orange) node.ForeColor = fileNode.ForeColor;
|
||||||
|
PrimaryTreeNodes.Add(file.Key, fileNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PrimaryTreeNodes.Add(folder.Key, node);
|
||||||
|
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -91,6 +121,7 @@ namespace DataOrganizer
|
|||||||
var profile = Profiles[ProfileComboBox.Text];
|
var profile = Profiles[ProfileComboBox.Text];
|
||||||
|
|
||||||
RootFolderComboBox.Items.Clear();
|
RootFolderComboBox.Items.Clear();
|
||||||
|
PrimaryTreeNodes.Clear();
|
||||||
FolderGroups.Clear();
|
FolderGroups.Clear();
|
||||||
|
|
||||||
if (profile.FolderGroups.Count > 0)
|
if (profile.FolderGroups.Count > 0)
|
||||||
@@ -132,83 +163,84 @@ namespace DataOrganizer
|
|||||||
|
|
||||||
private void ScanRootFolderButton_Click(object sender, EventArgs e)
|
private void ScanRootFolderButton_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var folder = FolderGroups[RootFolderComboBox.Text];
|
var folderGroup = GetActiveFolderGroup();
|
||||||
//var db = new DB();
|
var rootDepth = folderGroup.Path.Split(new char[] { Path.DirectorySeparatorChar }).Length;
|
||||||
//var pattern = db.GetNamingPatternById(folder.PatternId);
|
var newFiles = new List<FileInfo>();
|
||||||
//var regex = new Regex(pattern);
|
var rootFolder = new DirectoryInfo(folderGroup.Path);
|
||||||
//PrimaryFilesTreeView.Nodes.Clear();
|
|
||||||
|
|
||||||
//var dirs = Directory.EnumerateDirectories(folder.Path);
|
foreach (var dir in rootFolder.EnumerateDirectories()) newFiles.AddRange(ScanDirectory(dir));
|
||||||
|
|
||||||
//foreach (var dir in dirs)
|
foreach (var file in rootFolder.EnumerateFiles())
|
||||||
//{
|
|
||||||
// var dirInfo = new DirectoryInfo(dir);
|
|
||||||
// PrimaryFilesTreeView.Nodes.Add(CreateNode(dirInfo, pattern));
|
|
||||||
//}
|
|
||||||
|
|
||||||
//foreach(var file in Directory.EnumerateFiles(folder.Path))
|
|
||||||
//{
|
|
||||||
// var fileInfo = new FileInfo(file);
|
|
||||||
// var fileNode = new TreeNode(fileInfo.Name) { Name = fileInfo.FullName };
|
|
||||||
|
|
||||||
// if (!regex.IsMatch(fileInfo.Name))
|
|
||||||
// {
|
|
||||||
// fileNode.ForeColor = Color.DarkOrange;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// PrimaryFilesTreeView.Nodes.Add(fileNode);
|
|
||||||
//}
|
|
||||||
|
|
||||||
WriteFilesToDb(folder.Path);
|
|
||||||
}
|
|
||||||
|
|
||||||
private TreeNode CreateNode(DirectoryInfo dir, string pattern)
|
|
||||||
{
|
|
||||||
var folder = FolderGroups[RootFolderComboBox.Text];
|
|
||||||
var profile = Profiles[ProfileComboBox.Text];
|
|
||||||
var namingViolation = false;
|
|
||||||
var node = new TreeNode(dir.Name) { Name = dir.FullName };
|
|
||||||
var regex = new Regex(pattern);
|
|
||||||
var db = new DB();
|
|
||||||
|
|
||||||
var files = Directory.EnumerateFiles(dir.FullName);
|
|
||||||
|
|
||||||
foreach (var file in files)
|
|
||||||
{
|
{
|
||||||
var fileInfo = new FileInfo(file);
|
if (!ActiveSnapshotForPrimaryTree.Files.ContainsKey(file.FullName))
|
||||||
var fileNode = new TreeNode(fileInfo.Name) { Name = fileInfo.FullName };
|
|
||||||
//var match = regex.Match(fileInfo.Name);
|
|
||||||
//var stringBuilder = new StringBuilder();
|
|
||||||
|
|
||||||
//if (!match.Groups[1].Success)
|
|
||||||
// stringBuilder.Append($"Failed to match {regex.GroupNameFromNumber(1)} ");//match.Groups[0].Name}");
|
|
||||||
//if (!match.Groups[2].Success)
|
|
||||||
// stringBuilder.Append($"Failed to match {regex.GroupNameFromNumber(2)} ");
|
|
||||||
|
|
||||||
if (!regex.IsMatch(fileInfo.Name))
|
|
||||||
{
|
{
|
||||||
namingViolation = true;
|
newFiles.Add(file);
|
||||||
fileNode.ForeColor = Color.DarkOrange;
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var newFile in newFiles)
|
||||||
|
{
|
||||||
|
var folders = newFile.DirectoryName.Split(new char[] { Path.DirectorySeparatorChar });
|
||||||
|
var currentPath = folderGroup.Path;
|
||||||
|
|
||||||
|
for(var i = rootDepth; i < folders.Length; i++)
|
||||||
|
{
|
||||||
|
var previousPath = currentPath;
|
||||||
|
currentPath = Path.Combine(currentPath, folders[i]);
|
||||||
|
|
||||||
|
if(!PrimaryTreeNodes.ContainsKey(currentPath))
|
||||||
|
{
|
||||||
|
var node = new TreeNode(folders[i]) { ForeColor = Color.Blue, ToolTipText = currentPath };
|
||||||
|
PrimaryTreeNodes[currentPath] = node;
|
||||||
|
if (previousPath == folderGroup.Path)
|
||||||
|
{
|
||||||
|
PrimaryFilesTreeView.Nodes.Add(node);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
PrimaryTreeNodes[previousPath].Nodes.Add(node);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
node.Nodes.Add(fileNode);
|
PrimaryTreeNodes[currentPath].Nodes.Add(new TreeNode(newFile.Name) { ForeColor = Color.Blue });
|
||||||
db.InsertNewFileRecord(GetFileSnapshots(dir.FullName), profile.Id, folder.Id, folder.Path);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (namingViolation) node.ForeColor = Color.DarkOrange;
|
|
||||||
|
|
||||||
var dirs = Directory.EnumerateDirectories(dir.FullName);
|
|
||||||
|
|
||||||
foreach(var f in dirs)
|
|
||||||
{
|
|
||||||
var child = CreateNode(new DirectoryInfo(f), pattern);
|
|
||||||
node.ForeColor = child.ForeColor;
|
|
||||||
node.Nodes.Add(child);
|
|
||||||
}
|
|
||||||
|
|
||||||
return node;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private List<FileInfo> ScanDirectory(DirectoryInfo dir)
|
||||||
|
{
|
||||||
|
var newFiles = new List<FileInfo>();
|
||||||
|
|
||||||
|
foreach (var d in dir.EnumerateDirectories())
|
||||||
|
{
|
||||||
|
UpdateStatusStrip($"Processing {d.FullName}");
|
||||||
|
newFiles.AddRange(ScanDirectory(d));
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach(var file in dir.EnumerateFiles())
|
||||||
|
{
|
||||||
|
if (!ActiveSnapshotForPrimaryTree.Files.ContainsKey(file.FullName))
|
||||||
|
{
|
||||||
|
newFiles.Add(file);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//TODO: check for modifications
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach(var file in ActiveSnapshotForPrimaryTree.Files)
|
||||||
|
{
|
||||||
|
UpdateStatusStrip($"Checking for the existance of {file.Value.Name}");
|
||||||
|
|
||||||
|
if(File.Exists(file.Key))
|
||||||
|
{
|
||||||
|
//TODO: mark this file as deleted. Also scan the folders.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return newFiles;
|
||||||
|
}
|
||||||
private void WriteFilesToDb(string root)
|
private void WriteFilesToDb(string root)
|
||||||
{
|
{
|
||||||
var dir = new DirectoryInfo(root);
|
var dir = new DirectoryInfo(root);
|
||||||
@@ -241,8 +273,8 @@ namespace DataOrganizer
|
|||||||
private List<DB.FileSnapshot> GetFileSnapshots(string path)
|
private List<DB.FileSnapshot> GetFileSnapshots(string path)
|
||||||
{
|
{
|
||||||
var dir = new DirectoryInfo(path);
|
var dir = new DirectoryInfo(path);
|
||||||
var profile = GetCurrentProfile();
|
var profile = GetActiveProfile();
|
||||||
var folderGroup = GetCurrentFolderGroup();
|
var folderGroup = GetActiveFolderGroup();
|
||||||
|
|
||||||
var snapshots = new List<DB.FileSnapshot>();
|
var snapshots = new List<DB.FileSnapshot>();
|
||||||
|
|
||||||
@@ -250,7 +282,7 @@ namespace DataOrganizer
|
|||||||
{
|
{
|
||||||
snapshots.Add(new DB.FileSnapshot
|
snapshots.Add(new DB.FileSnapshot
|
||||||
{
|
{
|
||||||
FullPath = file.FullName,
|
PathNoRoot = file.FullName,
|
||||||
Name = file.Name,
|
Name = file.Name,
|
||||||
CreationDate = file.CreationTimeUtc,
|
CreationDate = file.CreationTimeUtc,
|
||||||
ModifiedDate = file.LastWriteTimeUtc,
|
ModifiedDate = file.LastWriteTimeUtc,
|
||||||
@@ -264,12 +296,12 @@ namespace DataOrganizer
|
|||||||
return snapshots;
|
return snapshots;
|
||||||
}
|
}
|
||||||
|
|
||||||
private DB.Profile GetCurrentProfile()
|
private DB.Profile GetActiveProfile()
|
||||||
{
|
{
|
||||||
return Profiles[ProfileComboBox.Text];
|
return Profiles[ProfileComboBox.Text];
|
||||||
}
|
}
|
||||||
|
|
||||||
private DB.FolderGroup GetCurrentFolderGroup()
|
private DB.FolderGroup GetActiveFolderGroup()
|
||||||
{
|
{
|
||||||
return FolderGroups[RootFolderComboBox.Text];
|
return FolderGroups[RootFolderComboBox.Text];
|
||||||
}
|
}
|
||||||
|
|||||||
+110
-20
@@ -4,6 +4,7 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using System.Security.Cryptography.X509Certificates;
|
||||||
|
|
||||||
namespace DataOrganizer
|
namespace DataOrganizer
|
||||||
{
|
{
|
||||||
@@ -12,42 +13,112 @@ namespace DataOrganizer
|
|||||||
public Folder Root { get; private set; }
|
public Folder Root { get; private set; }
|
||||||
public Dictionary<string, DB.FileSnapshot> Files { get; private set; } = new Dictionary<string, DB.FileSnapshot>();
|
public Dictionary<string, DB.FileSnapshot> Files { get; private set; } = new Dictionary<string, DB.FileSnapshot>();
|
||||||
public Dictionary<string, Folder> Directories { get; private set; } = new Dictionary<string, Folder>();
|
public Dictionary<string, Folder> Directories { get; private set; } = new Dictionary<string, Folder>();
|
||||||
|
public Dictionary<string, Duplicate> FileDuplicates { get; private set; } = new Dictionary<string, Duplicate>();
|
||||||
|
//Contains files associated with particular, first level folders.
|
||||||
|
//So if the root folder group is X:\Anime and we have a folder path of x:\Anime\Death Note, then indexing this dictonary
|
||||||
|
//with the text "Death Note" would return all files in that folder.
|
||||||
|
public Dictionary<string, List<DB.FileSnapshot>> OrganizationFolders { get; private set; } = new Dictionary<string, List<DB.FileSnapshot>>();
|
||||||
|
|
||||||
public Snapshot(List<DB.FileSnapshot> fileRecords, DB.Profile profile, DB.FolderGroup folderGroup)
|
public Snapshot(List<DB.FileSnapshot> fileRecords, DB.Profile profile, DB.FolderGroup folderGroup)
|
||||||
{
|
{
|
||||||
Root = new Folder(folderGroup.Name, folderGroup.Path);
|
Root = new Folder(folderGroup.Name, folderGroup.Path);
|
||||||
Directories.Add(Root.FullPath, Root);
|
Directories.Add(Root.FullPath, Root);
|
||||||
|
|
||||||
var rootDepth = folderGroup.Path.Split(new char[] { Path.DirectorySeparatorChar }).Length;
|
if(folderGroup.Type == DB.OrganizationType.SingleLevel)
|
||||||
|
ProcessFilesAsOneLevel(fileRecords, folderGroup);
|
||||||
|
|
||||||
foreach (var file in fileRecords)
|
//var rootDepth = folderGroup.Path.Split(new char[] { Path.DirectorySeparatorChar }).Length;
|
||||||
|
|
||||||
|
//foreach (var file in fileRecords)
|
||||||
|
//{
|
||||||
|
// var folders = file.PathNoRoot.Split(new char[] { Path.DirectorySeparatorChar });
|
||||||
|
// var currentPath = folderGroup.Path;
|
||||||
|
|
||||||
|
// if (folders.Length == rootDepth + 1)
|
||||||
|
// {
|
||||||
|
// Root.AddFile(file);
|
||||||
|
// Files.Add(file.PathNoRoot, file);
|
||||||
|
// continue;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// for (var i = rootDepth; i < folders.Length - 1; i++)
|
||||||
|
// {
|
||||||
|
// string previousPath = currentPath;
|
||||||
|
// currentPath = Path.Combine(currentPath, folders[i]);
|
||||||
|
|
||||||
|
// if (!Directories.ContainsKey(currentPath))
|
||||||
|
// {
|
||||||
|
// var newFolder = new Folder(folders[i], currentPath);
|
||||||
|
// Directories[previousPath].AddDirectory(newFolder);
|
||||||
|
// Directories.Add(currentPath, newFolder);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
// Directories[currentPath].AddFile(file);
|
||||||
|
|
||||||
|
// var duplicates = Files.Values.Where(x => x.Size == file.Size && x.Id != file.Id);
|
||||||
|
|
||||||
|
// Files.Add(file.PathNoRoot, file);
|
||||||
|
|
||||||
|
// foreach (var duplicate in duplicates)
|
||||||
|
// {
|
||||||
|
// FileDuplicates.Add(file.PathNoRoot, new Duplicate() { File = file, Duplicates = new List<DB.FileSnapshot> { duplicate } });
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ProcessFilesAsOneLevel(List<DB.FileSnapshot> files, DB.FolderGroup folderGroup)
|
||||||
|
{
|
||||||
|
Folder firstLevelFolder = null;
|
||||||
|
|
||||||
|
foreach (var file in files)
|
||||||
{
|
{
|
||||||
var folders = file.FullPath.Split(new char[] { Path.DirectorySeparatorChar });
|
var folders = file.PathNoRoot.Split(new char[] { Path.DirectorySeparatorChar }, StringSplitOptions.RemoveEmptyEntries);
|
||||||
var currentPath = folderGroup.Path;
|
var orgFolder = Path.Combine(folderGroup.Path, folders[0]);
|
||||||
|
var currentPath = Path.Combine(folderGroup.Path, folders[0]);
|
||||||
|
|
||||||
if (folders.Length == rootDepth + 1)
|
if(firstLevelFolder == null || firstLevelFolder.Name != folders[0])
|
||||||
{
|
{
|
||||||
Root.AddFile(file);
|
firstLevelFolder = new Folder(folders[0], Path.Combine(folderGroup.Path, folders[0]));
|
||||||
Files.Add(file.FullPath, file);
|
Directories.Add(orgFolder, firstLevelFolder);
|
||||||
continue;
|
OrganizationFolders.Add(orgFolder, new List<DB.FileSnapshot>());
|
||||||
|
Root.AddDirectory(firstLevelFolder);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (var i = rootDepth; i < folders.Length - 1; i++)
|
for(var i = 1; i < folders.Length - 1; i++)
|
||||||
{
|
{
|
||||||
string previousPath = currentPath;
|
var parentFolder = currentPath;
|
||||||
currentPath = Path.Combine(currentPath, folders[i]);
|
currentPath = Path.Combine(currentPath, folders[i]);
|
||||||
|
if(!Directories.ContainsKey(currentPath))
|
||||||
if (!Directories.ContainsKey(currentPath))
|
|
||||||
{
|
{
|
||||||
var newFolder = new Folder(folders[i], currentPath);
|
var newFolder = new Folder(folders[i], currentPath);
|
||||||
Directories[previousPath].AddDirectory(newFolder);
|
|
||||||
Directories.Add(currentPath, newFolder);
|
Directories.Add(currentPath, newFolder);
|
||||||
|
Directories[parentFolder].AddDirectory(newFolder);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var duplicates = OrganizationFolders[orgFolder].Where(x => x.Size == file.Size && x.Id != file.Id);
|
||||||
|
|
||||||
|
foreach(var dup in duplicates)
|
||||||
|
{
|
||||||
|
if(FileDuplicates.ContainsKey(file.PathNoRoot))
|
||||||
|
{
|
||||||
|
FileDuplicates[file.PathNoRoot].Duplicates.Add(dup);
|
||||||
|
}
|
||||||
|
else FileDuplicates.Add(file.PathNoRoot, new Duplicate() { File = file, Duplicates = new List<DB.FileSnapshot>() { dup } });
|
||||||
|
}
|
||||||
|
|
||||||
|
OrganizationFolders[orgFolder].Add(file);
|
||||||
Directories[currentPath].AddFile(file);
|
Directories[currentPath].AddFile(file);
|
||||||
|
Files.Add(file.PathNoRoot, file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public struct Duplicate
|
||||||
|
{
|
||||||
|
public DB.FileSnapshot File;
|
||||||
|
public List<DB.FileSnapshot> Duplicates;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Folder
|
public class Folder
|
||||||
@@ -56,7 +127,7 @@ namespace DataOrganizer
|
|||||||
public string FullPath { get; private set; }
|
public string FullPath { get; private set; }
|
||||||
public Dictionary<string, DB.FileSnapshot> Files { get; private set; } = new Dictionary<string, DB.FileSnapshot>();
|
public Dictionary<string, DB.FileSnapshot> Files { get; private set; } = new Dictionary<string, DB.FileSnapshot>();
|
||||||
public Dictionary<string, Folder> Folders { get; private set; } = new Dictionary<string, Folder>();
|
public Dictionary<string, Folder> Folders { get; private set; } = new Dictionary<string, Folder>();
|
||||||
public List<Duplicate> Duplicates { get; private set; }
|
public Folder OrganizationalFolder { get; private set; }
|
||||||
|
|
||||||
public Folder(string name, string fullPath)
|
public Folder(string name, string fullPath)
|
||||||
{
|
{
|
||||||
@@ -66,7 +137,16 @@ namespace DataOrganizer
|
|||||||
|
|
||||||
public void AddFile(DB.FileSnapshot file)
|
public void AddFile(DB.FileSnapshot file)
|
||||||
{
|
{
|
||||||
Files.Add(file.FullPath, file);
|
//var possibleDuplicates = Files.Values.Where(x => x.Size == file.Size);
|
||||||
|
|
||||||
|
Files.Add(file.PathNoRoot, file);
|
||||||
|
|
||||||
|
//foreach (var f in possibleDuplicates)
|
||||||
|
//{
|
||||||
|
// if (f.Id == file.Id) continue;
|
||||||
|
|
||||||
|
// Duplicates.Add(new Duplicate() { FileA = file, FileB = f });
|
||||||
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddDirectory(Folder folder)
|
public void AddDirectory(Folder folder)
|
||||||
@@ -74,10 +154,20 @@ namespace DataOrganizer
|
|||||||
Folders.Add(folder.FullPath, folder);
|
Folders.Add(folder.FullPath, folder);
|
||||||
}
|
}
|
||||||
|
|
||||||
public struct Duplicate
|
//public struct Duplicate
|
||||||
{
|
//{
|
||||||
DB.FileSnapshot FileA;
|
// public DB.FileSnapshot FileA;
|
||||||
DB.FileSnapshot FileB;
|
// public DB.FileSnapshot FileB;
|
||||||
}
|
//}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class FileSnapshot
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public class SnapshotComparsion
|
||||||
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user