Re-did the way the FileManager works. No more loading what's already in the data directly to a TreeView, instead only the diff between two profile folder groups will be loaded into that, more or less.

This commit is contained in:
Admin
2020-12-09 22:57:39 -06:00
parent 5404a8836d
commit 864a3dfdb6
5 changed files with 205 additions and 97 deletions
Binary file not shown.
-1
View File
@@ -601,7 +601,6 @@ namespace DataOrganizer
public void InsertNewFileRecord(List<FileSnapshot> files, int profileId, int folderGroupId, string root)
{
var query = @"INSERT INTO main.file (full_path, name, size, date_created, date_modified, folder_root_id, profile_id, pattern_override_id) VALUES (@FullPath, @Name, @Size, @DateCreated, @DateModified, @FolderId, @ProfileId, @PatternId)";
var rootLength = root.Length;
using (var connection = new SqliteConnection(ConnectionString))
{
+140 -85
View File
@@ -30,25 +30,31 @@
{
this.MainLayoutPanel = new System.Windows.Forms.TableLayoutPanel();
this.MainMenuStrip = new System.Windows.Forms.MenuStrip();
this.SelectProfileComboBoxMainMenu = new System.Windows.Forms.ToolStripComboBox();
this.ManageMainMenuStrip = new System.Windows.Forms.ToolStripMenuItem();
this.ProfilesManageMainMenu = new System.Windows.Forms.ToolStripMenuItem();
this.NamingPatternsManageMainMenu = new System.Windows.Forms.ToolStripMenuItem();
this.SelectProfileComboBoxMainMenu = new System.Windows.Forms.ToolStripComboBox();
this.SelectFolderGroupComboBoxMainMenu = new System.Windows.Forms.ToolStripComboBox();
this.FolderGroupTreeView = new System.Windows.Forms.TreeView();
this.DiffViewTreeView = new System.Windows.Forms.TreeView();
this.Panel1 = new System.Windows.Forms.Panel();
this.FileDetailsGroupBox = new System.Windows.Forms.GroupBox();
this.DiffResultsGroupBox = new System.Windows.Forms.GroupBox();
this.CommitFilesChangesButton = new System.Windows.Forms.Button();
this.MoveNewFilesButton = new System.Windows.Forms.Button();
this.DiffViewTreeView = new System.Windows.Forms.TreeView();
this.SelectedProfileInfoGroupBox = new System.Windows.Forms.GroupBox();
this.ScanSelectedFolderGroupButton = new System.Windows.Forms.Button();
this.SelectedProfileDataLabel = new System.Windows.Forms.Label();
this.CompareAgainstGroupBox = new System.Windows.Forms.GroupBox();
this.CompareAgainstProfileComboBox = new System.Windows.Forms.ComboBox();
this.CompareAgainstFolderGroupComboBox = new System.Windows.Forms.ComboBox();
this.CompareButton = new System.Windows.Forms.Button();
this.CompareAgainstFolderGroupComboBox = new System.Windows.Forms.ComboBox();
this.CompareAgainstProfileComboBox = new System.Windows.Forms.ComboBox();
this.statusStrip1 = new System.Windows.Forms.StatusStrip();
this.StatusLabel = new System.Windows.Forms.ToolStripStatusLabel();
this.MainLayoutPanel.SuspendLayout();
this.MainMenuStrip.SuspendLayout();
this.Panel1.SuspendLayout();
this.DiffResultsGroupBox.SuspendLayout();
this.SelectedProfileInfoGroupBox.SuspendLayout();
this.CompareAgainstGroupBox.SuspendLayout();
this.statusStrip1.SuspendLayout();
this.SuspendLayout();
//
// MainLayoutPanel
@@ -58,21 +64,22 @@
this.MainLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 34F));
this.MainLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33F));
this.MainLayoutPanel.Controls.Add(this.MainMenuStrip, 0, 0);
this.MainLayoutPanel.Controls.Add(this.FolderGroupTreeView, 0, 2);
this.MainLayoutPanel.Controls.Add(this.DiffViewTreeView, 2, 2);
this.MainLayoutPanel.Controls.Add(this.Panel1, 0, 1);
this.MainLayoutPanel.Controls.Add(this.FileDetailsGroupBox, 1, 2);
this.MainLayoutPanel.Controls.Add(this.DiffResultsGroupBox, 1, 3);
this.MainLayoutPanel.Controls.Add(this.CompareAgainstGroupBox, 2, 1);
this.MainLayoutPanel.Controls.Add(this.DiffViewTreeView, 0, 2);
this.MainLayoutPanel.Controls.Add(this.SelectedProfileInfoGroupBox, 0, 1);
this.MainLayoutPanel.Controls.Add(this.CompareAgainstGroupBox, 1, 1);
this.MainLayoutPanel.Controls.Add(this.statusStrip1, 0, 4);
this.MainLayoutPanel.Dock = System.Windows.Forms.DockStyle.Fill;
this.MainLayoutPanel.Location = new System.Drawing.Point(0, 0);
this.MainLayoutPanel.Name = "MainLayoutPanel";
this.MainLayoutPanel.RowCount = 4;
this.MainLayoutPanel.RowCount = 5;
this.MainLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 40F));
this.MainLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20F));
this.MainLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 40F));
this.MainLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 40F));
this.MainLayoutPanel.Size = new System.Drawing.Size(1278, 844);
this.MainLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 30F));
this.MainLayoutPanel.Size = new System.Drawing.Size(1306, 964);
this.MainLayoutPanel.TabIndex = 0;
//
// MainMenuStrip
@@ -87,17 +94,10 @@
this.MainMenuStrip.Location = new System.Drawing.Point(0, 0);
this.MainMenuStrip.Name = "MainMenuStrip";
this.MainMenuStrip.RenderMode = System.Windows.Forms.ToolStripRenderMode.System;
this.MainMenuStrip.Size = new System.Drawing.Size(1278, 37);
this.MainMenuStrip.Size = new System.Drawing.Size(1306, 37);
this.MainMenuStrip.TabIndex = 0;
this.MainMenuStrip.Text = "menuStrip1";
//
// SelectProfileComboBoxMainMenu
//
this.SelectProfileComboBoxMainMenu.BackColor = System.Drawing.Color.Gainsboro;
this.SelectProfileComboBoxMainMenu.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.SelectProfileComboBoxMainMenu.Name = "SelectProfileComboBoxMainMenu";
this.SelectProfileComboBoxMainMenu.Size = new System.Drawing.Size(200, 33);
//
// ManageMainMenuStrip
//
this.ManageMainMenuStrip.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
@@ -110,17 +110,24 @@
// ProfilesManageMainMenu
//
this.ProfilesManageMainMenu.Name = "ProfilesManageMainMenu";
this.ProfilesManageMainMenu.Size = new System.Drawing.Size(270, 34);
this.ProfilesManageMainMenu.Size = new System.Drawing.Size(245, 34);
this.ProfilesManageMainMenu.Text = "&Profiles";
this.ProfilesManageMainMenu.Click += new System.EventHandler(this.ProfilesManageMainMenu_Click);
//
// NamingPatternsManageMainMenu
//
this.NamingPatternsManageMainMenu.Name = "NamingPatternsManageMainMenu";
this.NamingPatternsManageMainMenu.Size = new System.Drawing.Size(270, 34);
this.NamingPatternsManageMainMenu.Size = new System.Drawing.Size(245, 34);
this.NamingPatternsManageMainMenu.Text = "&Naming Patterns";
this.NamingPatternsManageMainMenu.Click += new System.EventHandler(this.NamingPatternsManageMainMenu_Click);
//
// SelectProfileComboBoxMainMenu
//
this.SelectProfileComboBoxMainMenu.BackColor = System.Drawing.Color.Gainsboro;
this.SelectProfileComboBoxMainMenu.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.SelectProfileComboBoxMainMenu.Name = "SelectProfileComboBoxMainMenu";
this.SelectProfileComboBoxMainMenu.Size = new System.Drawing.Size(200, 33);
//
// SelectFolderGroupComboBoxMainMenu
//
this.SelectFolderGroupComboBoxMainMenu.BackColor = System.Drawing.Color.Gainsboro;
@@ -128,81 +135,123 @@
this.SelectFolderGroupComboBoxMainMenu.Name = "SelectFolderGroupComboBoxMainMenu";
this.SelectFolderGroupComboBoxMainMenu.Size = new System.Drawing.Size(200, 33);
//
// FolderGroupTreeView
//
this.FolderGroupTreeView.BackColor = System.Drawing.Color.WhiteSmoke;
this.FolderGroupTreeView.Dock = System.Windows.Forms.DockStyle.Fill;
this.FolderGroupTreeView.FullRowSelect = true;
this.FolderGroupTreeView.Location = new System.Drawing.Point(3, 203);
this.FolderGroupTreeView.Name = "FolderGroupTreeView";
this.MainLayoutPanel.SetRowSpan(this.FolderGroupTreeView, 2);
this.FolderGroupTreeView.ShowLines = false;
this.FolderGroupTreeView.Size = new System.Drawing.Size(415, 638);
this.FolderGroupTreeView.TabIndex = 1;
this.FolderGroupTreeView.TabStop = false;
//
// DiffViewTreeView
//
this.DiffViewTreeView.BackColor = System.Drawing.Color.WhiteSmoke;
this.DiffViewTreeView.Dock = System.Windows.Forms.DockStyle.Fill;
this.DiffViewTreeView.Location = new System.Drawing.Point(858, 203);
this.DiffViewTreeView.Name = "DiffViewTreeView";
this.MainLayoutPanel.SetRowSpan(this.DiffViewTreeView, 2);
this.DiffViewTreeView.Size = new System.Drawing.Size(417, 638);
this.DiffViewTreeView.TabIndex = 2;
//
// Panel1
//
this.Panel1.Controls.Add(this.ScanSelectedFolderGroupButton);
this.Panel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.Panel1.Location = new System.Drawing.Point(3, 43);
this.Panel1.Name = "Panel1";
this.Panel1.Size = new System.Drawing.Size(415, 154);
this.Panel1.TabIndex = 3;
//
// FileDetailsGroupBox
//
this.FileDetailsGroupBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.FileDetailsGroupBox.Location = new System.Drawing.Point(424, 203);
this.FileDetailsGroupBox.Location = new System.Drawing.Point(433, 221);
this.FileDetailsGroupBox.Name = "FileDetailsGroupBox";
this.FileDetailsGroupBox.Size = new System.Drawing.Size(428, 315);
this.FileDetailsGroupBox.Size = new System.Drawing.Size(438, 351);
this.FileDetailsGroupBox.TabIndex = 5;
this.FileDetailsGroupBox.TabStop = false;
this.FileDetailsGroupBox.Text = "File Details:";
//
// DiffResultsGroupBox
//
this.DiffResultsGroupBox.Controls.Add(this.CommitFilesChangesButton);
this.DiffResultsGroupBox.Controls.Add(this.MoveNewFilesButton);
this.DiffResultsGroupBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.DiffResultsGroupBox.Location = new System.Drawing.Point(424, 524);
this.DiffResultsGroupBox.Location = new System.Drawing.Point(433, 578);
this.DiffResultsGroupBox.Name = "DiffResultsGroupBox";
this.DiffResultsGroupBox.Size = new System.Drawing.Size(428, 317);
this.DiffResultsGroupBox.Size = new System.Drawing.Size(438, 351);
this.DiffResultsGroupBox.TabIndex = 6;
this.DiffResultsGroupBox.TabStop = false;
this.DiffResultsGroupBox.Text = "Diff Results:";
//
// CommitFilesChangesButton
//
this.CommitFilesChangesButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.CommitFilesChangesButton.Enabled = false;
this.CommitFilesChangesButton.Location = new System.Drawing.Point(227, 299);
this.CommitFilesChangesButton.Name = "CommitFilesChangesButton";
this.CommitFilesChangesButton.Size = new System.Drawing.Size(205, 43);
this.CommitFilesChangesButton.TabIndex = 1;
this.CommitFilesChangesButton.Text = "Commit Changes to DB";
this.CommitFilesChangesButton.UseVisualStyleBackColor = true;
//
// MoveNewFilesButton
//
this.MoveNewFilesButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.MoveNewFilesButton.Enabled = false;
this.MoveNewFilesButton.Location = new System.Drawing.Point(6, 299);
this.MoveNewFilesButton.Name = "MoveNewFilesButton";
this.MoveNewFilesButton.Size = new System.Drawing.Size(200, 43);
this.MoveNewFilesButton.TabIndex = 0;
this.MoveNewFilesButton.Text = "Move File Changes";
this.MoveNewFilesButton.UseVisualStyleBackColor = true;
//
// DiffViewTreeView
//
this.DiffViewTreeView.BackColor = System.Drawing.Color.WhiteSmoke;
this.DiffViewTreeView.Dock = System.Windows.Forms.DockStyle.Fill;
this.DiffViewTreeView.Location = new System.Drawing.Point(3, 221);
this.DiffViewTreeView.Name = "DiffViewTreeView";
this.MainLayoutPanel.SetRowSpan(this.DiffViewTreeView, 2);
this.DiffViewTreeView.Size = new System.Drawing.Size(424, 708);
this.DiffViewTreeView.TabIndex = 2;
//
// SelectedProfileInfoGroupBox
//
this.SelectedProfileInfoGroupBox.Controls.Add(this.ScanSelectedFolderGroupButton);
this.SelectedProfileInfoGroupBox.Controls.Add(this.SelectedProfileDataLabel);
this.SelectedProfileInfoGroupBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.SelectedProfileInfoGroupBox.Location = new System.Drawing.Point(3, 43);
this.SelectedProfileInfoGroupBox.Name = "SelectedProfileInfoGroupBox";
this.SelectedProfileInfoGroupBox.Size = new System.Drawing.Size(424, 172);
this.SelectedProfileInfoGroupBox.TabIndex = 8;
this.SelectedProfileInfoGroupBox.TabStop = false;
this.SelectedProfileInfoGroupBox.Text = "Selected Profile Data:";
//
// ScanSelectedFolderGroupButton
//
this.ScanSelectedFolderGroupButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.ScanSelectedFolderGroupButton.Enabled = false;
this.ScanSelectedFolderGroupButton.Location = new System.Drawing.Point(227, 111);
this.ScanSelectedFolderGroupButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.ScanSelectedFolderGroupButton.Location = new System.Drawing.Point(9, 111);
this.ScanSelectedFolderGroupButton.Name = "ScanSelectedFolderGroupButton";
this.ScanSelectedFolderGroupButton.Size = new System.Drawing.Size(185, 40);
this.ScanSelectedFolderGroupButton.TabIndex = 0;
this.ScanSelectedFolderGroupButton.Text = "Scan for Changes";
this.ScanSelectedFolderGroupButton.UseVisualStyleBackColor = true;
//
// SelectedProfileDataLabel
//
this.SelectedProfileDataLabel.AutoSize = true;
this.SelectedProfileDataLabel.Location = new System.Drawing.Point(10, 34);
this.SelectedProfileDataLabel.Name = "SelectedProfileDataLabel";
this.SelectedProfileDataLabel.Size = new System.Drawing.Size(51, 20);
this.SelectedProfileDataLabel.TabIndex = 0;
this.SelectedProfileDataLabel.Text = "label1";
//
// CompareAgainstGroupBox
//
this.CompareAgainstGroupBox.Controls.Add(this.CompareButton);
this.CompareAgainstGroupBox.Controls.Add(this.CompareAgainstFolderGroupComboBox);
this.CompareAgainstGroupBox.Controls.Add(this.CompareAgainstProfileComboBox);
this.CompareAgainstGroupBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.CompareAgainstGroupBox.Location = new System.Drawing.Point(858, 43);
this.CompareAgainstGroupBox.Location = new System.Drawing.Point(433, 43);
this.CompareAgainstGroupBox.Name = "CompareAgainstGroupBox";
this.CompareAgainstGroupBox.Size = new System.Drawing.Size(417, 154);
this.CompareAgainstGroupBox.Size = new System.Drawing.Size(438, 172);
this.CompareAgainstGroupBox.TabIndex = 7;
this.CompareAgainstGroupBox.TabStop = false;
this.CompareAgainstGroupBox.Text = "Compare Against:";
this.CompareAgainstGroupBox.Text = "Compared Against:";
//
// CompareButton
//
this.CompareButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.CompareButton.Enabled = false;
this.CompareButton.Location = new System.Drawing.Point(6, 110);
this.CompareButton.Name = "CompareButton";
this.CompareButton.Size = new System.Drawing.Size(107, 41);
this.CompareButton.TabIndex = 2;
this.CompareButton.Text = "Compare";
this.CompareButton.UseVisualStyleBackColor = true;
//
// CompareAgainstFolderGroupComboBox
//
this.CompareAgainstFolderGroupComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.CompareAgainstFolderGroupComboBox.FormattingEnabled = true;
this.CompareAgainstFolderGroupComboBox.Location = new System.Drawing.Point(6, 75);
this.CompareAgainstFolderGroupComboBox.Name = "CompareAgainstFolderGroupComboBox";
this.CompareAgainstFolderGroupComboBox.Size = new System.Drawing.Size(200, 28);
this.CompareAgainstFolderGroupComboBox.TabIndex = 1;
//
// CompareAgainstProfileComboBox
//
@@ -213,31 +262,29 @@
this.CompareAgainstProfileComboBox.Size = new System.Drawing.Size(200, 28);
this.CompareAgainstProfileComboBox.TabIndex = 0;
//
// CompareAgainstFolderGroupComboBox
// statusStrip1
//
this.CompareAgainstFolderGroupComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.CompareAgainstFolderGroupComboBox.FormattingEnabled = true;
this.CompareAgainstFolderGroupComboBox.Location = new System.Drawing.Point(6, 83);
this.CompareAgainstFolderGroupComboBox.Name = "CompareAgainstFolderGroupComboBox";
this.CompareAgainstFolderGroupComboBox.Size = new System.Drawing.Size(200, 28);
this.CompareAgainstFolderGroupComboBox.TabIndex = 1;
this.MainLayoutPanel.SetColumnSpan(this.statusStrip1, 3);
this.statusStrip1.ImageScalingSize = new System.Drawing.Size(24, 24);
this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.StatusLabel});
this.statusStrip1.Location = new System.Drawing.Point(0, 932);
this.statusStrip1.Name = "statusStrip1";
this.statusStrip1.Size = new System.Drawing.Size(1306, 32);
this.statusStrip1.TabIndex = 9;
this.statusStrip1.Text = "statusStrip1";
//
// CompareButton
// StatusLabel
//
this.CompareButton.Anchor = System.Windows.Forms.AnchorStyles.Right;
this.CompareButton.Enabled = false;
this.CompareButton.Location = new System.Drawing.Point(301, 109);
this.CompareButton.Name = "CompareButton";
this.CompareButton.Size = new System.Drawing.Size(107, 41);
this.CompareButton.TabIndex = 2;
this.CompareButton.Text = "Compare";
this.CompareButton.UseVisualStyleBackColor = true;
this.StatusLabel.Name = "StatusLabel";
this.StatusLabel.Size = new System.Drawing.Size(165, 25);
this.StatusLabel.Text = "Nothing to report...";
//
// FileManager
//
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1278, 844);
this.ClientSize = new System.Drawing.Size(1306, 964);
this.Controls.Add(this.MainLayoutPanel);
this.Name = "FileManager";
this.Text = "File Manager";
@@ -245,8 +292,12 @@
this.MainLayoutPanel.PerformLayout();
this.MainMenuStrip.ResumeLayout(false);
this.MainMenuStrip.PerformLayout();
this.Panel1.ResumeLayout(false);
this.DiffResultsGroupBox.ResumeLayout(false);
this.SelectedProfileInfoGroupBox.ResumeLayout(false);
this.SelectedProfileInfoGroupBox.PerformLayout();
this.CompareAgainstGroupBox.ResumeLayout(false);
this.statusStrip1.ResumeLayout(false);
this.statusStrip1.PerformLayout();
this.ResumeLayout(false);
}
@@ -260,9 +311,7 @@
private System.Windows.Forms.ToolStripMenuItem ProfilesManageMainMenu;
private System.Windows.Forms.ToolStripMenuItem NamingPatternsManageMainMenu;
private System.Windows.Forms.ToolStripComboBox SelectFolderGroupComboBoxMainMenu;
private System.Windows.Forms.TreeView FolderGroupTreeView;
private System.Windows.Forms.TreeView DiffViewTreeView;
private System.Windows.Forms.Panel Panel1;
private System.Windows.Forms.GroupBox FileDetailsGroupBox;
private System.Windows.Forms.GroupBox DiffResultsGroupBox;
private System.Windows.Forms.Button ScanSelectedFolderGroupButton;
@@ -270,5 +319,11 @@
private System.Windows.Forms.ComboBox CompareAgainstProfileComboBox;
private System.Windows.Forms.ComboBox CompareAgainstFolderGroupComboBox;
private System.Windows.Forms.Button CompareButton;
private System.Windows.Forms.GroupBox SelectedProfileInfoGroupBox;
private System.Windows.Forms.Label SelectedProfileDataLabel;
private System.Windows.Forms.Button CommitFilesChangesButton;
private System.Windows.Forms.Button MoveNewFilesButton;
private System.Windows.Forms.StatusStrip statusStrip1;
private System.Windows.Forms.ToolStripStatusLabel StatusLabel;
}
}
+62 -11
View File
@@ -2,7 +2,7 @@
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@@ -20,6 +20,7 @@ namespace DataOrganizer
{
InitializeComponent();
ScanSelectedFolderGroupButton.Click += ScanSelectedFolderGroupButton_Click;
SelectProfileComboBoxMainMenu.SelectedIndexChanged += SelectProfileComboBoxMainMenu_SelectedIndexChanged;
SelectFolderGroupComboBoxMainMenu.SelectedIndexChanged += SelectFolderGroupComboBoxMainMenu_SelectedIndexChanged;
CompareAgainstProfileComboBox.SelectedIndexChanged += CompareAgainstProfileComboBox_SelectedIndexChanged;
@@ -29,6 +30,27 @@ namespace DataOrganizer
PopulateProfileComboBox();
}
private void ScanSelectedFolderGroupButton_Click(object sender, EventArgs e)
{
var folderGroup = GetSelectedFolderGroup();
var files = GetAllFilesFromDirectory(new DirectoryInfo(folderGroup.Path));
var snapshot = new Snapshot(files, folderGroup);
foreach (var folder in snapshot.Root.Folders.Values)
DiffViewTreeView.Nodes.Add(BuildTreeNode(folder));
CommitFilesChangesButton.Enabled = true;
MoveNewFilesButton.Enabled = true;
if (ActiveSnapshot.Files.Count == 0) CommitFirstTimeScaneToDatabase(snapshot);
}
private void CommitFirstTimeScaneToDatabase(Snapshot snapshot)
{
var db = new DB();
db.InsertNewFileRecord(snapshot.Files.Values.ToList(), GetSelectedProfile().Id, GetSelectedFolderGroup().Id, GetSelectedFolderGroup().Path);
}
private void CompareButton_Click(object sender, EventArgs e)
{
var db = new DB();
@@ -55,7 +77,7 @@ namespace DataOrganizer
{
ClearDiffResults();
CompareButton.Enabled = ScanSelectedFolderGroupButton.Enabled;
CompareButton.Enabled = ActiveSnapshot.Files.Count > 0;
}
private void SelectFolderGroupComboBoxMainMenu_SelectedIndexChanged(object sender, EventArgs e)
@@ -67,14 +89,21 @@ namespace DataOrganizer
var files = db.GetFilesForProfileByFolderGroup(GetSelectedProfile().Id, folderGroup.Id);
ActiveSnapshot = new Snapshot(files, folderGroup);
foreach(var orgFolder in ActiveSnapshot.Root.Folders.Values)
{
FolderGroupTreeView.Nodes.Add(BuildTreeNode(orgFolder));
}
ScanSelectedFolderGroupButton.Enabled = files.Count > 0;
//foreach (var orgFolder in ActiveSnapshot.Root.Folders.Values)
//{
// FolderGroupTreeView.Nodes.Add(BuildTreeNode(orgFolder));
//}
CompareButton.Enabled = files.Count > 0;
if (CompareAgainstFolderGroupComboBox.FindString(folderGroup.Name) != -1)
CompareAgainstFolderGroupComboBox.SelectedIndex = CompareAgainstFolderGroupComboBox.FindString(folderGroup.Name);
if (files.Count == 0)
ScanSelectedFolderGroupButton.Text = "Scan Folder Group";
SelectedProfileDataLabel.Text = $"Loaded snapshot data for {files.Count} file(s).";
}
private TreeNode BuildTreeNode(Folder folder)
@@ -94,6 +123,21 @@ namespace DataOrganizer
return node;
}
private List<FileInfo> GetAllFilesFromDirectory(DirectoryInfo directory)
{
var files = new List<FileInfo>();
files.AddRange(directory.EnumerateFiles());
foreach (var dir in directory.EnumerateDirectories())
{
UpdateStatusLabel($"Scanning Directory {dir.Name}...");
files.AddRange(GetAllFilesFromDirectory(dir));
}
return files;
}
private void SelectProfileComboBoxMainMenu_SelectedIndexChanged(object sender, EventArgs e)
{
ClearForm();
@@ -120,7 +164,6 @@ namespace DataOrganizer
private void ClearForm(bool isFolderGroupChange = false)
{
FolderGroupTreeView.Nodes.Clear();
DiffViewTreeView.Nodes.Clear();
if (!isFolderGroupChange)
{
@@ -128,7 +171,10 @@ namespace DataOrganizer
CompareAgainstFolderGroupComboBox.Items.Clear();
}
CompareButton.Enabled = false;
ScanSelectedFolderGroupButton.Enabled = false;
ScanSelectedFolderGroupButton.Text = "Scan for Changes";
MoveNewFilesButton.Enabled = false;
CommitFilesChangesButton.Enabled = false;
}
private void ClearDiffResults()
@@ -179,7 +225,6 @@ namespace DataOrganizer
private DB.FolderGroup GetFolderGroupToCompare()
{
return GetProfileToCompare().FolderGroups.First(x => x.Name == CompareAgainstFolderGroupComboBox.Text);
}
private void ProfilesManageMainMenu_Click(object sender, EventArgs e)
@@ -195,5 +240,11 @@ namespace DataOrganizer
var form = new NamingConventionManager();
form.ShowDialog();
}
private void UpdateStatusLabel(string message)
{
StatusLabel.Text = message;
statusStrip1.Refresh();
}
}
}
+3
View File
@@ -120,4 +120,7 @@
<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>