Added functionality to the '...' button for the 'Default New Contents' folder option on the ProfileManager form. Added a way for the user to move all newly discovered files to their default new content location.

This commit is contained in:
Admin
2020-12-06 23:02:18 -06:00
parent 9f9fdac66a
commit 21645be4ef
4 changed files with 170 additions and 78 deletions
Binary file not shown.
+116 -74
View File
@@ -43,20 +43,24 @@
this.SelectedFolderComboBox = new System.Windows.Forms.ComboBox();
this.FolderSelectButton = new System.Windows.Forms.Button();
this.label2 = new System.Windows.Forms.Label();
this.FileInfoGroupBox = new System.Windows.Forms.GroupBox();
this.ScanResultsLabel = new System.Windows.Forms.Label();
this.label7 = new System.Windows.Forms.Label();
this.label6 = new System.Windows.Forms.Label();
this.FileDetailsFullPathLabel = new System.Windows.Forms.Label();
this.FileDetailsNameLabel = new System.Windows.Forms.Label();
this.StatusStrip = new System.Windows.Forms.StatusStrip();
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.ScanResultsDetailsGroupBox = new System.Windows.Forms.GroupBox();
this.CommitScanResultsButton = new System.Windows.Forms.Button();
this.MoveModifiedFilesButton = new System.Windows.Forms.Button();
this.tableLayoutPanel1.SuspendLayout();
this.PanelOne.SuspendLayout();
this.SelectedFolderPanel.SuspendLayout();
this.ActiveFolderGroupBox.SuspendLayout();
this.StatusStrip.SuspendLayout();
this.FileInfoGroupBox.SuspendLayout();
this.StatusStrip.SuspendLayout();
this.ScanResultsDetailsGroupBox.SuspendLayout();
this.SuspendLayout();
//
// MainMenu
@@ -65,7 +69,7 @@
this.MainMenu.ImageScalingSize = new System.Drawing.Size(24, 24);
this.MainMenu.Location = new System.Drawing.Point(0, 0);
this.MainMenu.Name = "MainMenu";
this.MainMenu.Size = new System.Drawing.Size(1472, 36);
this.MainMenu.Size = new System.Drawing.Size(1472, 24);
this.MainMenu.TabIndex = 0;
this.MainMenu.Text = "menuStrip1";
//
@@ -81,35 +85,36 @@
this.tableLayoutPanel1.Controls.Add(this.PanelOne, 0, 0);
this.tableLayoutPanel1.Controls.Add(this.SelectedFolderPanel, 2, 0);
this.tableLayoutPanel1.Controls.Add(this.FileInfoGroupBox, 1, 0);
this.tableLayoutPanel1.Controls.Add(this.ScanResultsDetailsGroupBox, 1, 2);
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 36);
this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 24);
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
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, 34F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33F));
this.tableLayoutPanel1.Size = new System.Drawing.Size(1472, 870);
this.tableLayoutPanel1.Size = new System.Drawing.Size(1472, 882);
this.tableLayoutPanel1.TabIndex = 1;
//
// SecondaryTreeView
//
this.SecondaryTreeView.Dock = System.Windows.Forms.DockStyle.Fill;
this.SecondaryTreeView.Location = new System.Drawing.Point(739, 290);
this.SecondaryTreeView.Location = new System.Drawing.Point(739, 294);
this.SecondaryTreeView.Name = "SecondaryTreeView";
this.tableLayoutPanel1.SetRowSpan(this.SecondaryTreeView, 2);
this.SecondaryTreeView.ShowNodeToolTips = true;
this.SecondaryTreeView.Size = new System.Drawing.Size(362, 577);
this.SecondaryTreeView.Size = new System.Drawing.Size(362, 585);
this.SecondaryTreeView.TabIndex = 2;
//
// PrimaryFilesTreeView
//
this.PrimaryFilesTreeView.Dock = System.Windows.Forms.DockStyle.Fill;
this.PrimaryFilesTreeView.FullRowSelect = true;
this.PrimaryFilesTreeView.Location = new System.Drawing.Point(3, 290);
this.PrimaryFilesTreeView.Location = new System.Drawing.Point(3, 294);
this.PrimaryFilesTreeView.Name = "PrimaryFilesTreeView";
this.tableLayoutPanel1.SetRowSpan(this.PrimaryFilesTreeView, 2);
this.PrimaryFilesTreeView.ShowNodeToolTips = true;
this.PrimaryFilesTreeView.Size = new System.Drawing.Size(362, 577);
this.PrimaryFilesTreeView.Size = new System.Drawing.Size(362, 585);
this.PrimaryFilesTreeView.TabIndex = 0;
//
// PanelOne
@@ -122,7 +127,7 @@
this.PanelOne.Dock = System.Windows.Forms.DockStyle.Fill;
this.PanelOne.Location = new System.Drawing.Point(3, 3);
this.PanelOne.Name = "PanelOne";
this.PanelOne.Size = new System.Drawing.Size(362, 281);
this.PanelOne.Size = new System.Drawing.Size(362, 285);
this.PanelOne.TabIndex = 1;
//
// ScanRootFolderButton
@@ -178,7 +183,7 @@
this.SelectedFolderPanel.Dock = System.Windows.Forms.DockStyle.Fill;
this.SelectedFolderPanel.Location = new System.Drawing.Point(739, 3);
this.SelectedFolderPanel.Name = "SelectedFolderPanel";
this.SelectedFolderPanel.Size = new System.Drawing.Size(730, 281);
this.SelectedFolderPanel.Size = new System.Drawing.Size(730, 285);
this.SelectedFolderPanel.TabIndex = 3;
//
// ActiveFolderGroupBox
@@ -189,7 +194,7 @@
this.ActiveFolderGroupBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.ActiveFolderGroupBox.Location = new System.Drawing.Point(0, 0);
this.ActiveFolderGroupBox.Name = "ActiveFolderGroupBox";
this.ActiveFolderGroupBox.Size = new System.Drawing.Size(730, 281);
this.ActiveFolderGroupBox.Size = new System.Drawing.Size(730, 285);
this.ActiveFolderGroupBox.TabIndex = 0;
this.ActiveFolderGroupBox.TabStop = false;
this.ActiveFolderGroupBox.Text = "Folder Options";
@@ -221,6 +226,64 @@
this.label2.TabIndex = 0;
this.label2.Text = "Folder to Compare:";
//
// FileInfoGroupBox
//
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, 285);
this.FileInfoGroupBox.TabIndex = 4;
this.FileInfoGroupBox.TabStop = false;
this.FileInfoGroupBox.Text = "File Details";
//
// ScanResultsLabel
//
this.ScanResultsLabel.AutoSize = true;
this.ScanResultsLabel.Location = new System.Drawing.Point(6, 22);
this.ScanResultsLabel.Name = "ScanResultsLabel";
this.ScanResultsLabel.Size = new System.Drawing.Size(0, 20);
this.ScanResultsLabel.TabIndex = 4;
//
// 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:";
//
// 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:";
//
// 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:";
//
// 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:";
//
// StatusStrip
//
this.StatusStrip.ImageScalingSize = new System.Drawing.Size(24, 24);
@@ -238,65 +301,39 @@
this.StatusLabel.Size = new System.Drawing.Size(179, 25);
this.StatusLabel.Text = "toolStripStatusLabel1";
//
// FileInfoGroupBox
// ScanResultsDetailsGroupBox
//
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";
this.ScanResultsDetailsGroupBox.Controls.Add(this.MoveModifiedFilesButton);
this.ScanResultsDetailsGroupBox.Controls.Add(this.CommitScanResultsButton);
this.ScanResultsDetailsGroupBox.Controls.Add(this.ScanResultsLabel);
this.ScanResultsDetailsGroupBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.ScanResultsDetailsGroupBox.Location = new System.Drawing.Point(371, 593);
this.ScanResultsDetailsGroupBox.Name = "ScanResultsDetailsGroupBox";
this.ScanResultsDetailsGroupBox.Size = new System.Drawing.Size(362, 286);
this.ScanResultsDetailsGroupBox.TabIndex = 5;
this.ScanResultsDetailsGroupBox.TabStop = false;
this.ScanResultsDetailsGroupBox.Text = "Scan Results";
//
// FileDetailsNameLabel
// CommitScanResultsButton
//
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:";
this.CommitScanResultsButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.CommitScanResultsButton.Enabled = false;
this.CommitScanResultsButton.Location = new System.Drawing.Point(202, 216);
this.CommitScanResultsButton.Name = "CommitScanResultsButton";
this.CommitScanResultsButton.Size = new System.Drawing.Size(154, 38);
this.CommitScanResultsButton.TabIndex = 5;
this.CommitScanResultsButton.Text = "Update Database";
this.CommitScanResultsButton.UseVisualStyleBackColor = true;
//
// FileDetailsFullPathLabel
// MoveModifiedFilesButton
//
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:";
this.MoveModifiedFilesButton.Enabled = false;
this.MoveModifiedFilesButton.Location = new System.Drawing.Point(10, 216);
this.MoveModifiedFilesButton.Name = "MoveModifiedFilesButton";
this.MoveModifiedFilesButton.Size = new System.Drawing.Size(138, 38);
this.MoveModifiedFilesButton.TabIndex = 6;
this.MoveModifiedFilesButton.Text = "Move Files";
this.MoveModifiedFilesButton.UseVisualStyleBackColor = true;
//
// FileViewer
//
@@ -316,10 +353,12 @@
this.SelectedFolderPanel.ResumeLayout(false);
this.ActiveFolderGroupBox.ResumeLayout(false);
this.ActiveFolderGroupBox.PerformLayout();
this.StatusStrip.ResumeLayout(false);
this.StatusStrip.PerformLayout();
this.FileInfoGroupBox.ResumeLayout(false);
this.FileInfoGroupBox.PerformLayout();
this.StatusStrip.ResumeLayout(false);
this.StatusStrip.PerformLayout();
this.ScanResultsDetailsGroupBox.ResumeLayout(false);
this.ScanResultsDetailsGroupBox.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
@@ -345,10 +384,13 @@
private System.Windows.Forms.StatusStrip StatusStrip;
private System.Windows.Forms.ToolStripStatusLabel StatusLabel;
private System.Windows.Forms.GroupBox FileInfoGroupBox;
private System.Windows.Forms.Label label8;
private System.Windows.Forms.Label ScanResultsLabel;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Label FileDetailsFullPathLabel;
private System.Windows.Forms.Label FileDetailsNameLabel;
private System.Windows.Forms.GroupBox ScanResultsDetailsGroupBox;
private System.Windows.Forms.Button CommitScanResultsButton;
private System.Windows.Forms.Button MoveModifiedFilesButton;
}
}
+42 -3
View File
@@ -38,10 +38,36 @@ namespace DataOrganizer
RootFolderComboBox.SelectedIndexChanged += SelectedFolderComboBox_SelectedIndexChanged;
PrimaryFilesTreeView.NodeMouseClick += PrimaryFilesTreeView_NodeMouseClick;
FolderSelectButton.Click += FolderSelectButton_Click1;
CommitScanResultsButton.Click += CommitScanResultsButton_Click;
MoveModifiedFilesButton.Click += MoveModifiedFilesButton_Click;
ProfileComboBox.SelectedIndex = 0;
}
private void MoveModifiedFilesButton_Click(object sender, EventArgs e)
{
var profile = GetActiveProfile();
var folderGroup = GetActiveFolderGroup();
var files = new List<FileSnapshot>();
files.AddRange(ActiveSnapshotForPrimaryTree.Files.Values.Where(x => x.Status == FileSnapshot.FileStatus.PendingInsert || x.Status == FileSnapshot.FileStatus.PendingUpdate));
foreach(var file in files)
{
var path = file.ParentFolder.FullPath.Remove(0, folderGroup.Path.Length + 1);
var newFilePath = Path.Combine(profile.DefaultNewContentFolder, file.PathNoRoot);
Directory.CreateDirectory(Path.Combine(profile.DefaultNewContentFolder, path));
UpdateStatusStrip($"Moving {file.Name} to default location '{profile.DefaultNewContentFolder}'.");
if(!File.Exists(newFilePath)) File.Copy(file.FullPath, newFilePath);
}
}
private void CommitScanResultsButton_Click(object sender, EventArgs e)
{
throw new NotImplementedException();
}
private void FolderSelectButton_Click1(object sender, EventArgs e)
{
WriteFilesToDb(GetActiveFolderGroup().Path);
@@ -72,12 +98,14 @@ namespace DataOrganizer
var files = db.GetFilesForProfileByFolderGroup(profile.Id, folderGroup.Id);
ActiveSnapshotForPrimaryTree = new Snapshot(files, folderGroup);
//if(ActiveSnapshotForPrimaryTree.Directories.ContainsKey(@"W:\Test\Amagi Brilliant Park\Season 1")) ActiveSnapshotForPrimaryTree.DeleteFolder(ActiveSnapshotForPrimaryTree.Directories[@"W:\Test\Amagi Brilliant Park\Season 1"]);
foreach(var folder in ActiveSnapshotForPrimaryTree.Root.Folders)
{
PrimaryFilesTreeView.Nodes.Add(GetNodeFromSnapshot(folder));
}
CommitScanResultsButton.Enabled = false;
MoveModifiedFilesButton.Enabled = false;
ScanResultsLabel.Text = string.Empty;
}
private TreeNode GetNodeFromSnapshot(KeyValuePair<string, Folder> folder)
@@ -134,6 +162,9 @@ namespace DataOrganizer
}
RootFolderComboBox.Enabled = true;
CommitScanResultsButton.Enabled = false;
MoveModifiedFilesButton.Enabled = false;
ScanResultsLabel.Text = string.Empty;
}
private void FolderSelectButton_Click(object sender, EventArgs e)
@@ -161,6 +192,8 @@ namespace DataOrganizer
private void ScanRootFolderButton_Click(object sender, EventArgs e)
{
CommitScanResultsButton.Enabled = false;
MoveModifiedFilesButton.Enabled = false;
var folderGroup = GetActiveFolderGroup();
var files = new List<FileInfo>();
var rootFolder = new DirectoryInfo(folderGroup.Path);
@@ -218,7 +251,13 @@ namespace DataOrganizer
modifiedFilesCount++;
}
label8.Text = $"New Files: {newFilesCount}{Environment.NewLine}Modified Files: {modifiedFilesCount}{Environment.NewLine}Deleted Files: {deletedFilesCount}";
ScanResultsLabel.Text = $"New Files: {newFilesCount}{Environment.NewLine}Modified Files: {modifiedFilesCount}{Environment.NewLine}Deleted Files: {deletedFilesCount}";
if(newFilesCount > 0 || modifiedFilesCount > 0)
{
CommitScanResultsButton.Enabled = true;
MoveModifiedFilesButton.Enabled = true;
}
}
private List<Folder> ProcessFileFolders(FileSnapshot file)
+12 -1
View File
@@ -44,12 +44,23 @@ namespace DataOrganizer
MachineNameTextBox.TextChanged += MachineNameTextBox_TextChanged;
FolderGroupPathTextBox.TextChanged += ToggleGroupInsertButton;
FolderGroupListView.MouseClick += FolderGroupListView_MouseClick;
SelectNewContentLocationButton.Click += SelectNewContentLocationButton_Click1;
deleteMenuItem.Click += DeleteMenuItem_Click;
PopulateProfiles();
SetupForNewProfile();
}
private void SelectNewContentLocationButton_Click1(object sender, EventArgs e)
{
var dialog = new FolderBrowserDialog() { Description = "Select the folder where new content will be placed." };
if (dialog.ShowDialog() == DialogResult.OK)
{
NewContentLocationTextBox.Text = dialog.SelectedPath;
}
}
private void FolderGroupListView_MouseClick(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Right)
@@ -132,7 +143,7 @@ namespace DataOrganizer
if (!IsUpdating)
{
var folders = new List<DB.FolderGroup>();
//TODO: crash
foreach(ListViewItem node in FolderGroupListView.Items)
{
folders.Add(FolderGroups[node.Text]);