From 864a3dfdb6bc0ba62bdb700a4da1eb8d13c2efbe Mon Sep 17 00:00:00 2001 From: Admin Date: Wed, 9 Dec 2020 22:57:39 -0600 Subject: [PATCH] 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. --- .vs/DataOrganizer/v16/.suo | Bin 139776 -> 151040 bytes DataOrganizer/DB.cs | 1 - DataOrganizer/FileManager.Designer.cs | 225 ++++++++++++++++---------- DataOrganizer/FileManager.cs | 73 +++++++-- DataOrganizer/FileManager.resx | 3 + 5 files changed, 205 insertions(+), 97 deletions(-) diff --git a/.vs/DataOrganizer/v16/.suo b/.vs/DataOrganizer/v16/.suo index 94407ebc402f7548673347e8472fd854771c3df7..19a591d476d932afe01ee122cb037f52ca3ec5bc 100644 GIT binary patch delta 5268 zcmZoT!qG5?bApX54+8@O69WUozyJULGcYhPFfuSOh%+!Sure|*XiawHl-^j-!#Ih_ zhtYPjB9lDdgv(QZtv`2-QGtPh;ehGnDyAyNHIu(G)w3xwFfeRlnq0-)#>g?5kwv^- zl7WHY|NsC0MHv_vWT0$51_lNe1_lOh1_lOUsF*AR1A`C)1A{Ch1A`a?1A{yx0|PGu z1A`m`1H)gC0ssI1mxek}o`HdZje&tdih+TFlYxOjfPsNQ32M$iD6Iye75{56FfeE{ zFff=v1pb2z(_vs>(1m()Vxk0>8C1@kVe&1Gdn_R9Chy^NnZ%UC_rR!86Xa80Ts~#* zlaWAjBPakt`i-GRPQJh*p{WYxfIP^|2ni5=C=F5!!ulXJlQ(k72eN`#|NsBzhthgb z8srO*N-wB&$i6UOU|>*YU|=w0U|`^a%9}#<`GDeYVu8uz0~{=zpfCdkf#zgGR$;~+ zlU-T!S@Ree7z!ruWObj!wPkV)H-{p~6EM7)fq`KQ0|UcW1_p+03=9n085kILOuieX zuX%)lf#E1LN4ri~Dx1IXH{h0?{6(;V)tZ5U;qK&0p=w5}$zO%)87(K53I}t5OaNi9 zDXbQtyt4VH>}f_G5e5b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^ijPd0uCN66ctuUU|HJ*$>nA@ArR_iD%nFEp z$$dO>dgW%YLZ7)_>4XPmJ8l_}FPM#i@38(EqBw{b8nVw`Tm z#UzCuS4GB*Ga5<9<916 zsWqW`h8x({>3=MkOr~G4WYU>F&z*^b9nzDT2T2E3a~NfoSurtk7cuBDBr_Bq*CgSH28Fs@6Up2W)JvE74-X$RwUrs<3o z)2-$(sxZU!PH%8!db2Etk!hI+6Qf}9Vnw_C{PMmVrtds(N#5L(ZTduaCVeUNyw3)z zLcn;s<4i_14w(G(4o@Zvc2Ly~YTK=y#b{~E2(86fp*0z(Gs4CQ={|xAR8UUk0(D^+ z85npN85pD)85sB&85jgWYNp%rFo`>gF)}cSGcqtpfO!Wc3cQW?q_rcW$n)CIMw3``7l z3=Iq*B}XblCPNiNDnk)N41)_pB0~v7A_FWXz)Gm;>nxb0rcbkG5}Pa#mBejm1}$ca OQzuW<7M^^`%K-rKh*L)Z diff --git a/DataOrganizer/DB.cs b/DataOrganizer/DB.cs index e9e9a8a..8a94452 100644 --- a/DataOrganizer/DB.cs +++ b/DataOrganizer/DB.cs @@ -601,7 +601,6 @@ namespace DataOrganizer public void InsertNewFileRecord(List 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)) { diff --git a/DataOrganizer/FileManager.Designer.cs b/DataOrganizer/FileManager.Designer.cs index 4143bab..9f2f4ba 100644 --- a/DataOrganizer/FileManager.Designer.cs +++ b/DataOrganizer/FileManager.Designer.cs @@ -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; } } \ No newline at end of file diff --git a/DataOrganizer/FileManager.cs b/DataOrganizer/FileManager.cs index 702c113..52ce3be 100644 --- a/DataOrganizer/FileManager.cs +++ b/DataOrganizer/FileManager.cs @@ -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 GetAllFilesFromDirectory(DirectoryInfo directory) + { + var files = new List(); + + 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(); + } } } diff --git a/DataOrganizer/FileManager.resx b/DataOrganizer/FileManager.resx index e6884dd..0e5bf2c 100644 --- a/DataOrganizer/FileManager.resx +++ b/DataOrganizer/FileManager.resx @@ -120,4 +120,7 @@ 17, 17 + + 205, 17 + \ No newline at end of file