Updated the ProfileManager so that users can change the FolderGroup's name (a very hacky job but it'll do). Hooked up the FileViewers 'Update Databse' button so new files can be commited to the database.
This commit is contained in:
Binary file not shown.
+86
-5
@@ -147,6 +147,34 @@ namespace DataOrganizer
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public FolderGroup GetFolderGroupByName(string name, int profileId)
|
||||||
|
{
|
||||||
|
var query = @"SELECT root_id, name, path, pattern_id, profile_id FROM main.folder_root WHERE profile_id = @ProfileId AND name = @Name";
|
||||||
|
|
||||||
|
using (var connection = new SqliteConnection(ConnectionString))
|
||||||
|
{
|
||||||
|
using (var command = new SqliteCommand(query, connection))
|
||||||
|
{
|
||||||
|
command.Parameters.AddWithValue("ProfileId", profileId);
|
||||||
|
command.Parameters.AddWithValue("Name", name);
|
||||||
|
|
||||||
|
connection.Open();
|
||||||
|
|
||||||
|
var reader = command.ExecuteReader();
|
||||||
|
|
||||||
|
reader.Read();
|
||||||
|
|
||||||
|
return new FolderGroup
|
||||||
|
{
|
||||||
|
Id = Convert.ToInt32(reader["root_id"]),
|
||||||
|
Name = reader["name"].ToString(),
|
||||||
|
Path = reader["path"].ToString(),
|
||||||
|
PatternId = Convert.ToInt32(reader["pattern_id"])
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public int InsertNewProfile(Profile profile)
|
public int InsertNewProfile(Profile profile)
|
||||||
{
|
{
|
||||||
var query = @"INSERT INTO main.profile (machine_name, default_new_content_folder_name, profile_name) VALUES (@MachineName, @DefaultPath, @Name)";
|
var query = @"INSERT INTO main.profile (machine_name, default_new_content_folder_name, profile_name) VALUES (@MachineName, @DefaultPath, @Name)";
|
||||||
@@ -440,6 +468,24 @@ namespace DataOrganizer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int GetPatternIdByName(string name)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(name)) return 0;
|
||||||
|
|
||||||
|
var query = @"SELECT pattern_id FROM main.naming_pattern WHERE name = @Name";
|
||||||
|
|
||||||
|
using (var connection = new SqliteConnection(ConnectionString))
|
||||||
|
{
|
||||||
|
connection.Open();
|
||||||
|
using (var command = new SqliteCommand(query, connection))
|
||||||
|
{
|
||||||
|
command.Parameters.AddWithValue("Name", name);
|
||||||
|
|
||||||
|
return Convert.ToInt32(command.ExecuteScalar());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public string GetRootPathById(int id)
|
public string GetRootPathById(int id)
|
||||||
{
|
{
|
||||||
var query = @"SELECT path FROM folder_root WHERE root_id = @ID";
|
var query = @"SELECT path FROM folder_root WHERE root_id = @ID";
|
||||||
@@ -479,9 +525,9 @@ namespace DataOrganizer
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<FileSnapshot> GetFilesForProfileByFolderGroup(int profileId, int folderGroupId)
|
public List<DBFileSnapshot> GetFilesForProfileByFolderGroup(int profileId, int folderGroupId)
|
||||||
{
|
{
|
||||||
var files = new List<FileSnapshot>();
|
var files = new List<DBFileSnapshot>();
|
||||||
|
|
||||||
var query = @"SELECT * FROM main.file INNER JOIN main.folder_root ON main.file.folder_root_id = main.folder_root.root_id WHERE main.file.profile_id = @ProfileId AND folder_root_id = @GroupId ORDER BY main.file.full_path ASC";
|
var query = @"SELECT * FROM main.file INNER JOIN main.folder_root ON main.file.folder_root_id = main.folder_root.root_id WHERE main.file.profile_id = @ProfileId AND folder_root_id = @GroupId ORDER BY main.file.full_path ASC";
|
||||||
|
|
||||||
@@ -497,7 +543,7 @@ namespace DataOrganizer
|
|||||||
|
|
||||||
while(reader.Read())
|
while(reader.Read())
|
||||||
{
|
{
|
||||||
files.Add(new FileSnapshot
|
files.Add(new DBFileSnapshot
|
||||||
{
|
{
|
||||||
Id = Convert.ToInt32(reader["file_id"]),
|
Id = Convert.ToInt32(reader["file_id"]),
|
||||||
PathNoRoot = reader["full_path"].ToString(),
|
PathNoRoot = reader["full_path"].ToString(),
|
||||||
@@ -517,7 +563,7 @@ namespace DataOrganizer
|
|||||||
return files;
|
return files;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void InsertNewFileRecord(List<FileSnapshot> files, int profileId, int folderGroupId, string root)
|
public void InsertNewFileRecord(List<DBFileSnapshot> 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 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;
|
var rootLength = root.Length;
|
||||||
@@ -552,6 +598,41 @@ 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))
|
||||||
|
{
|
||||||
|
connection.Open();
|
||||||
|
using (var transaction = connection.BeginTransaction())
|
||||||
|
{
|
||||||
|
|
||||||
|
using (var command = new SqliteCommand(query, connection, transaction))
|
||||||
|
{
|
||||||
|
foreach (var file in files)
|
||||||
|
{
|
||||||
|
command.Parameters.AddWithValue("FullPath", file.PathNoRoot);
|
||||||
|
command.Parameters.AddWithValue("Name", file.Name);
|
||||||
|
command.Parameters.AddWithValue("Size", file.Size);
|
||||||
|
command.Parameters.AddWithValue("DateCreated", file.CreatedDate);
|
||||||
|
command.Parameters.AddWithValue("DateModified", file.ModifiedDate);
|
||||||
|
command.Parameters.AddWithValue("FolderId", folderGroupId);
|
||||||
|
command.Parameters.AddWithValue("ProfileId", profileId);
|
||||||
|
command.Parameters.AddWithValue("PatternId", GetPatternIdByName(file.NamingPattern));
|
||||||
|
|
||||||
|
command.ExecuteNonQuery();
|
||||||
|
|
||||||
|
command.Parameters.Clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
transaction.Commit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public struct Profile
|
public struct Profile
|
||||||
{
|
{
|
||||||
public string Name;
|
public string Name;
|
||||||
@@ -578,7 +659,7 @@ namespace DataOrganizer
|
|||||||
public string Regex;
|
public string Regex;
|
||||||
}
|
}
|
||||||
|
|
||||||
public struct FileSnapshot
|
public struct DBFileSnapshot
|
||||||
{
|
{
|
||||||
public int Id;
|
public int Id;
|
||||||
public string PathNoRoot;
|
public string PathNoRoot;
|
||||||
|
|||||||
@@ -67,7 +67,10 @@ namespace DataOrganizer
|
|||||||
|
|
||||||
private void CommitScanResultsButton_Click(object sender, EventArgs e)
|
private void CommitScanResultsButton_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
var newFiles = ActiveSnapshotForPrimaryTree.Files.Values.Where(x => x.Status == FileSnapshot.FileStatus.PendingInsert).ToList();
|
||||||
|
var db = new DB();
|
||||||
|
|
||||||
|
db.InsertNewFileRecord(newFiles, GetActiveProfile().Id, GetActiveFolderGroup().Id, GetActiveFolderGroup().Path);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void FolderSelectButton_Click1(object sender, EventArgs e)
|
private void FolderSelectButton_Click1(object sender, EventArgs e)
|
||||||
@@ -319,17 +322,17 @@ namespace DataOrganizer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<DB.FileSnapshot> GetFileSnapshots(string path)
|
private List<DB.DBFileSnapshot> GetFileSnapshots(string path)
|
||||||
{
|
{
|
||||||
var dir = new DirectoryInfo(path);
|
var dir = new DirectoryInfo(path);
|
||||||
var profile = GetActiveProfile();
|
var profile = GetActiveProfile();
|
||||||
var folderGroup = GetActiveFolderGroup();
|
var folderGroup = GetActiveFolderGroup();
|
||||||
|
|
||||||
var snapshots = new List<DB.FileSnapshot>();
|
var snapshots = new List<DB.DBFileSnapshot>();
|
||||||
|
|
||||||
foreach(var file in dir.EnumerateFiles())
|
foreach(var file in dir.EnumerateFiles())
|
||||||
{
|
{
|
||||||
snapshots.Add(new DB.FileSnapshot
|
snapshots.Add(new DB.DBFileSnapshot
|
||||||
{
|
{
|
||||||
PathNoRoot = file.FullName,
|
PathNoRoot = file.FullName,
|
||||||
Name = file.Name,
|
Name = file.Name,
|
||||||
|
|||||||
+1
-1
@@ -179,7 +179,7 @@
|
|||||||
this.DeleteButton.Enabled = false;
|
this.DeleteButton.Enabled = false;
|
||||||
this.DeleteButton.Location = new System.Drawing.Point(13, 388);
|
this.DeleteButton.Location = new System.Drawing.Point(13, 388);
|
||||||
this.DeleteButton.Name = "DeleteButton";
|
this.DeleteButton.Name = "DeleteButton";
|
||||||
this.DeleteButton.Size = new System.Drawing.Size(107, 47);
|
this.DeleteButton.Size = new System.Drawing.Size(111, 47);
|
||||||
this.DeleteButton.TabIndex = 8;
|
this.DeleteButton.TabIndex = 8;
|
||||||
this.DeleteButton.Text = "Delete";
|
this.DeleteButton.Text = "Delete";
|
||||||
this.DeleteButton.UseVisualStyleBackColor = true;
|
this.DeleteButton.UseVisualStyleBackColor = true;
|
||||||
|
|||||||
Generated
+184
-186
@@ -33,34 +33,34 @@
|
|||||||
this.ProfilesComboBox = new System.Windows.Forms.ComboBox();
|
this.ProfilesComboBox = new System.Windows.Forms.ComboBox();
|
||||||
this.label3 = new System.Windows.Forms.Label();
|
this.label3 = new System.Windows.Forms.Label();
|
||||||
this.ProfileInfoPanel = new System.Windows.Forms.Panel();
|
this.ProfileInfoPanel = new System.Windows.Forms.Panel();
|
||||||
this.InsertGroupName = new System.Windows.Forms.Button();
|
this.groupBox2 = new System.Windows.Forms.GroupBox();
|
||||||
this.DeleteProfileButton = new System.Windows.Forms.Button();
|
this.FolderNameTextBox = new System.Windows.Forms.TextBox();
|
||||||
this.MachineNameTextBox = new System.Windows.Forms.TextBox();
|
this.label7 = new System.Windows.Forms.Label();
|
||||||
this.label4 = new System.Windows.Forms.Label();
|
this.NamingConventionComboBox = new System.Windows.Forms.ComboBox();
|
||||||
this.ProfileNameTextBox = new System.Windows.Forms.TextBox();
|
this.label5 = new System.Windows.Forms.Label();
|
||||||
this.MachineNameLabel = new System.Windows.Forms.Label();
|
|
||||||
this.AddOrUpdateProfileButton = new System.Windows.Forms.Button();
|
|
||||||
this.label1 = new System.Windows.Forms.Label();
|
|
||||||
this.SelectNewContentLocationButton = new System.Windows.Forms.Button();
|
|
||||||
this.label2 = new System.Windows.Forms.Label();
|
|
||||||
this.NewContentLocationTextBox = new System.Windows.Forms.TextBox();
|
|
||||||
this.label6 = new System.Windows.Forms.Label();
|
|
||||||
this.FolderGroupPathTextBox = new System.Windows.Forms.TextBox();
|
this.FolderGroupPathTextBox = new System.Windows.Forms.TextBox();
|
||||||
this.FolderGroupPathButton = new System.Windows.Forms.Button();
|
this.InsertGroupName = new System.Windows.Forms.Button();
|
||||||
this.FolderGroupListView = new System.Windows.Forms.ListView();
|
this.FolderGroupListView = new System.Windows.Forms.ListView();
|
||||||
this.NameColumn = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
this.NameColumn = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||||
this.label5 = new System.Windows.Forms.Label();
|
this.FolderGroupPathButton = new System.Windows.Forms.Button();
|
||||||
this.NamingConventionComboBox = new System.Windows.Forms.ComboBox();
|
this.label6 = new System.Windows.Forms.Label();
|
||||||
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
||||||
this.groupBox2 = new System.Windows.Forms.GroupBox();
|
|
||||||
this.label7 = new System.Windows.Forms.Label();
|
|
||||||
this.FolderNameTextBox = new System.Windows.Forms.TextBox();
|
|
||||||
this.label8 = new System.Windows.Forms.Label();
|
this.label8 = new System.Windows.Forms.Label();
|
||||||
|
this.NewContentLocationTextBox = new System.Windows.Forms.TextBox();
|
||||||
|
this.MachineNameTextBox = new System.Windows.Forms.TextBox();
|
||||||
|
this.AddOrUpdateProfileButton = new System.Windows.Forms.Button();
|
||||||
|
this.DeleteProfileButton = new System.Windows.Forms.Button();
|
||||||
|
this.label2 = new System.Windows.Forms.Label();
|
||||||
|
this.ProfileNameTextBox = new System.Windows.Forms.TextBox();
|
||||||
|
this.SelectNewContentLocationButton = new System.Windows.Forms.Button();
|
||||||
|
this.label4 = new System.Windows.Forms.Label();
|
||||||
|
this.label1 = new System.Windows.Forms.Label();
|
||||||
|
this.MachineNameLabel = new System.Windows.Forms.Label();
|
||||||
this.MainLayoutPanel.SuspendLayout();
|
this.MainLayoutPanel.SuspendLayout();
|
||||||
this.MainPanel.SuspendLayout();
|
this.MainPanel.SuspendLayout();
|
||||||
this.ProfileInfoPanel.SuspendLayout();
|
this.ProfileInfoPanel.SuspendLayout();
|
||||||
this.groupBox1.SuspendLayout();
|
|
||||||
this.groupBox2.SuspendLayout();
|
this.groupBox2.SuspendLayout();
|
||||||
|
this.groupBox1.SuspendLayout();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
// MainLayoutPanel
|
// MainLayoutPanel
|
||||||
@@ -116,6 +116,65 @@
|
|||||||
this.ProfileInfoPanel.Size = new System.Drawing.Size(1283, 440);
|
this.ProfileInfoPanel.Size = new System.Drawing.Size(1283, 440);
|
||||||
this.ProfileInfoPanel.TabIndex = 1;
|
this.ProfileInfoPanel.TabIndex = 1;
|
||||||
//
|
//
|
||||||
|
// groupBox2
|
||||||
|
//
|
||||||
|
this.groupBox2.Controls.Add(this.FolderNameTextBox);
|
||||||
|
this.groupBox2.Controls.Add(this.label7);
|
||||||
|
this.groupBox2.Controls.Add(this.NamingConventionComboBox);
|
||||||
|
this.groupBox2.Controls.Add(this.label5);
|
||||||
|
this.groupBox2.Controls.Add(this.FolderGroupPathTextBox);
|
||||||
|
this.groupBox2.Controls.Add(this.InsertGroupName);
|
||||||
|
this.groupBox2.Controls.Add(this.FolderGroupListView);
|
||||||
|
this.groupBox2.Controls.Add(this.FolderGroupPathButton);
|
||||||
|
this.groupBox2.Controls.Add(this.label6);
|
||||||
|
this.groupBox2.Location = new System.Drawing.Point(620, 3);
|
||||||
|
this.groupBox2.Name = "groupBox2";
|
||||||
|
this.groupBox2.Size = new System.Drawing.Size(658, 430);
|
||||||
|
this.groupBox2.TabIndex = 18;
|
||||||
|
this.groupBox2.TabStop = false;
|
||||||
|
this.groupBox2.Text = "Folder Group Details";
|
||||||
|
//
|
||||||
|
// FolderNameTextBox
|
||||||
|
//
|
||||||
|
this.FolderNameTextBox.Location = new System.Drawing.Point(163, 273);
|
||||||
|
this.FolderNameTextBox.Name = "FolderNameTextBox";
|
||||||
|
this.FolderNameTextBox.Size = new System.Drawing.Size(311, 26);
|
||||||
|
this.FolderNameTextBox.TabIndex = 5;
|
||||||
|
//
|
||||||
|
// label7
|
||||||
|
//
|
||||||
|
this.label7.AutoSize = true;
|
||||||
|
this.label7.Location = new System.Drawing.Point(6, 276);
|
||||||
|
this.label7.Name = "label7";
|
||||||
|
this.label7.Size = new System.Drawing.Size(104, 20);
|
||||||
|
this.label7.TabIndex = 15;
|
||||||
|
this.label7.Text = "Group Name:";
|
||||||
|
//
|
||||||
|
// NamingConventionComboBox
|
||||||
|
//
|
||||||
|
this.NamingConventionComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||||
|
this.NamingConventionComboBox.FormattingEnabled = true;
|
||||||
|
this.NamingConventionComboBox.Location = new System.Drawing.Point(163, 377);
|
||||||
|
this.NamingConventionComboBox.Name = "NamingConventionComboBox";
|
||||||
|
this.NamingConventionComboBox.Size = new System.Drawing.Size(311, 28);
|
||||||
|
this.NamingConventionComboBox.TabIndex = 8;
|
||||||
|
//
|
||||||
|
// label5
|
||||||
|
//
|
||||||
|
this.label5.AutoSize = true;
|
||||||
|
this.label5.Location = new System.Drawing.Point(6, 380);
|
||||||
|
this.label5.Name = "label5";
|
||||||
|
this.label5.Size = new System.Drawing.Size(151, 20);
|
||||||
|
this.label5.TabIndex = 15;
|
||||||
|
this.label5.Text = "Naming Convention:";
|
||||||
|
//
|
||||||
|
// FolderGroupPathTextBox
|
||||||
|
//
|
||||||
|
this.FolderGroupPathTextBox.Location = new System.Drawing.Point(163, 325);
|
||||||
|
this.FolderGroupPathTextBox.Name = "FolderGroupPathTextBox";
|
||||||
|
this.FolderGroupPathTextBox.Size = new System.Drawing.Size(311, 26);
|
||||||
|
this.FolderGroupPathTextBox.TabIndex = 6;
|
||||||
|
//
|
||||||
// InsertGroupName
|
// InsertGroupName
|
||||||
//
|
//
|
||||||
this.InsertGroupName.Enabled = false;
|
this.InsertGroupName.Enabled = false;
|
||||||
@@ -127,122 +186,6 @@
|
|||||||
this.InsertGroupName.UseVisualStyleBackColor = true;
|
this.InsertGroupName.UseVisualStyleBackColor = true;
|
||||||
this.InsertGroupName.Click += new System.EventHandler(this.InsertGroupName_Click);
|
this.InsertGroupName.Click += new System.EventHandler(this.InsertGroupName_Click);
|
||||||
//
|
//
|
||||||
// DeleteProfileButton
|
|
||||||
//
|
|
||||||
this.DeleteProfileButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
|
||||||
this.DeleteProfileButton.Location = new System.Drawing.Point(17, 320);
|
|
||||||
this.DeleteProfileButton.Name = "DeleteProfileButton";
|
|
||||||
this.DeleteProfileButton.Size = new System.Drawing.Size(75, 40);
|
|
||||||
this.DeleteProfileButton.TabIndex = 8;
|
|
||||||
this.DeleteProfileButton.TabStop = false;
|
|
||||||
this.DeleteProfileButton.Text = "Delete";
|
|
||||||
this.DeleteProfileButton.UseVisualStyleBackColor = true;
|
|
||||||
this.DeleteProfileButton.Click += new System.EventHandler(this.DeleteProfileButton_Click);
|
|
||||||
//
|
|
||||||
// MachineNameTextBox
|
|
||||||
//
|
|
||||||
this.MachineNameTextBox.Location = new System.Drawing.Point(195, 253);
|
|
||||||
this.MachineNameTextBox.Name = "MachineNameTextBox";
|
|
||||||
this.MachineNameTextBox.Size = new System.Drawing.Size(311, 26);
|
|
||||||
this.MachineNameTextBox.TabIndex = 4;
|
|
||||||
//
|
|
||||||
// label4
|
|
||||||
//
|
|
||||||
this.label4.AutoSize = true;
|
|
||||||
this.label4.Location = new System.Drawing.Point(10, 256);
|
|
||||||
this.label4.Name = "label4";
|
|
||||||
this.label4.Size = new System.Drawing.Size(119, 20);
|
|
||||||
this.label4.TabIndex = 7;
|
|
||||||
this.label4.Text = "Machine Name:";
|
|
||||||
//
|
|
||||||
// ProfileNameTextBox
|
|
||||||
//
|
|
||||||
this.ProfileNameTextBox.Location = new System.Drawing.Point(198, 39);
|
|
||||||
this.ProfileNameTextBox.Name = "ProfileNameTextBox";
|
|
||||||
this.ProfileNameTextBox.Size = new System.Drawing.Size(311, 26);
|
|
||||||
this.ProfileNameTextBox.TabIndex = 1;
|
|
||||||
//
|
|
||||||
// MachineNameLabel
|
|
||||||
//
|
|
||||||
this.MachineNameLabel.AutoSize = true;
|
|
||||||
this.MachineNameLabel.Location = new System.Drawing.Point(13, 186);
|
|
||||||
this.MachineNameLabel.Name = "MachineNameLabel";
|
|
||||||
this.MachineNameLabel.Size = new System.Drawing.Size(88, 20);
|
|
||||||
this.MachineNameLabel.TabIndex = 5;
|
|
||||||
this.MachineNameLabel.Text = "profile stuff";
|
|
||||||
//
|
|
||||||
// AddOrUpdateProfileButton
|
|
||||||
//
|
|
||||||
this.AddOrUpdateProfileButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
|
||||||
this.AddOrUpdateProfileButton.Location = new System.Drawing.Point(479, 320);
|
|
||||||
this.AddOrUpdateProfileButton.Name = "AddOrUpdateProfileButton";
|
|
||||||
this.AddOrUpdateProfileButton.Size = new System.Drawing.Size(86, 40);
|
|
||||||
this.AddOrUpdateProfileButton.TabIndex = 10;
|
|
||||||
this.AddOrUpdateProfileButton.Text = "button1";
|
|
||||||
this.AddOrUpdateProfileButton.UseVisualStyleBackColor = true;
|
|
||||||
this.AddOrUpdateProfileButton.Click += new System.EventHandler(this.AddOrUpdateProfileButton_Click);
|
|
||||||
//
|
|
||||||
// label1
|
|
||||||
//
|
|
||||||
this.label1.AutoSize = true;
|
|
||||||
this.label1.Location = new System.Drawing.Point(13, 42);
|
|
||||||
this.label1.Name = "label1";
|
|
||||||
this.label1.Size = new System.Drawing.Size(103, 20);
|
|
||||||
this.label1.TabIndex = 0;
|
|
||||||
this.label1.Text = "Profile Name:";
|
|
||||||
//
|
|
||||||
// SelectNewContentLocationButton
|
|
||||||
//
|
|
||||||
this.SelectNewContentLocationButton.Location = new System.Drawing.Point(512, 119);
|
|
||||||
this.SelectNewContentLocationButton.Name = "SelectNewContentLocationButton";
|
|
||||||
this.SelectNewContentLocationButton.Size = new System.Drawing.Size(50, 30);
|
|
||||||
this.SelectNewContentLocationButton.TabIndex = 3;
|
|
||||||
this.SelectNewContentLocationButton.Text = "...";
|
|
||||||
this.SelectNewContentLocationButton.UseVisualStyleBackColor = true;
|
|
||||||
this.SelectNewContentLocationButton.Click += new System.EventHandler(this.SelectNewContentLocationButton_Click);
|
|
||||||
//
|
|
||||||
// label2
|
|
||||||
//
|
|
||||||
this.label2.AutoSize = true;
|
|
||||||
this.label2.Location = new System.Drawing.Point(13, 124);
|
|
||||||
this.label2.Name = "label2";
|
|
||||||
this.label2.Size = new System.Drawing.Size(170, 20);
|
|
||||||
this.label2.TabIndex = 2;
|
|
||||||
this.label2.Text = "New Content Location:";
|
|
||||||
//
|
|
||||||
// NewContentLocationTextBox
|
|
||||||
//
|
|
||||||
this.NewContentLocationTextBox.Location = new System.Drawing.Point(195, 121);
|
|
||||||
this.NewContentLocationTextBox.Name = "NewContentLocationTextBox";
|
|
||||||
this.NewContentLocationTextBox.Size = new System.Drawing.Size(311, 26);
|
|
||||||
this.NewContentLocationTextBox.TabIndex = 2;
|
|
||||||
//
|
|
||||||
// label6
|
|
||||||
//
|
|
||||||
this.label6.AutoSize = true;
|
|
||||||
this.label6.Location = new System.Drawing.Point(6, 328);
|
|
||||||
this.label6.Name = "label6";
|
|
||||||
this.label6.Size = new System.Drawing.Size(144, 20);
|
|
||||||
this.label6.TabIndex = 11;
|
|
||||||
this.label6.Text = "Folder Group Path:";
|
|
||||||
//
|
|
||||||
// FolderGroupPathTextBox
|
|
||||||
//
|
|
||||||
this.FolderGroupPathTextBox.Location = new System.Drawing.Point(163, 325);
|
|
||||||
this.FolderGroupPathTextBox.Name = "FolderGroupPathTextBox";
|
|
||||||
this.FolderGroupPathTextBox.Size = new System.Drawing.Size(311, 26);
|
|
||||||
this.FolderGroupPathTextBox.TabIndex = 6;
|
|
||||||
//
|
|
||||||
// FolderGroupPathButton
|
|
||||||
//
|
|
||||||
this.FolderGroupPathButton.Location = new System.Drawing.Point(480, 323);
|
|
||||||
this.FolderGroupPathButton.Name = "FolderGroupPathButton";
|
|
||||||
this.FolderGroupPathButton.Size = new System.Drawing.Size(50, 30);
|
|
||||||
this.FolderGroupPathButton.TabIndex = 7;
|
|
||||||
this.FolderGroupPathButton.Text = "...";
|
|
||||||
this.FolderGroupPathButton.UseVisualStyleBackColor = true;
|
|
||||||
this.FolderGroupPathButton.Click += new System.EventHandler(this.FolderGroupPathButton_Click);
|
|
||||||
//
|
|
||||||
// FolderGroupListView
|
// FolderGroupListView
|
||||||
//
|
//
|
||||||
this.FolderGroupListView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
|
this.FolderGroupListView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
|
||||||
@@ -265,23 +208,24 @@
|
|||||||
this.NameColumn.Text = "Name";
|
this.NameColumn.Text = "Name";
|
||||||
this.NameColumn.Width = 623;
|
this.NameColumn.Width = 623;
|
||||||
//
|
//
|
||||||
// label5
|
// FolderGroupPathButton
|
||||||
//
|
//
|
||||||
this.label5.AutoSize = true;
|
this.FolderGroupPathButton.Location = new System.Drawing.Point(480, 323);
|
||||||
this.label5.Location = new System.Drawing.Point(6, 380);
|
this.FolderGroupPathButton.Name = "FolderGroupPathButton";
|
||||||
this.label5.Name = "label5";
|
this.FolderGroupPathButton.Size = new System.Drawing.Size(50, 30);
|
||||||
this.label5.Size = new System.Drawing.Size(151, 20);
|
this.FolderGroupPathButton.TabIndex = 7;
|
||||||
this.label5.TabIndex = 15;
|
this.FolderGroupPathButton.Text = "...";
|
||||||
this.label5.Text = "Naming Convention:";
|
this.FolderGroupPathButton.UseVisualStyleBackColor = true;
|
||||||
|
this.FolderGroupPathButton.Click += new System.EventHandler(this.FolderGroupPathButton_Click);
|
||||||
//
|
//
|
||||||
// NamingConventionComboBox
|
// label6
|
||||||
//
|
//
|
||||||
this.NamingConventionComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
this.label6.AutoSize = true;
|
||||||
this.NamingConventionComboBox.FormattingEnabled = true;
|
this.label6.Location = new System.Drawing.Point(6, 328);
|
||||||
this.NamingConventionComboBox.Location = new System.Drawing.Point(163, 377);
|
this.label6.Name = "label6";
|
||||||
this.NamingConventionComboBox.Name = "NamingConventionComboBox";
|
this.label6.Size = new System.Drawing.Size(144, 20);
|
||||||
this.NamingConventionComboBox.Size = new System.Drawing.Size(311, 28);
|
this.label6.TabIndex = 11;
|
||||||
this.NamingConventionComboBox.TabIndex = 8;
|
this.label6.Text = "Folder Group Path:";
|
||||||
//
|
//
|
||||||
// groupBox1
|
// groupBox1
|
||||||
//
|
//
|
||||||
@@ -303,41 +247,6 @@
|
|||||||
this.groupBox1.TabStop = false;
|
this.groupBox1.TabStop = false;
|
||||||
this.groupBox1.Text = "Profile Details";
|
this.groupBox1.Text = "Profile Details";
|
||||||
//
|
//
|
||||||
// groupBox2
|
|
||||||
//
|
|
||||||
this.groupBox2.Controls.Add(this.FolderNameTextBox);
|
|
||||||
this.groupBox2.Controls.Add(this.label7);
|
|
||||||
this.groupBox2.Controls.Add(this.NamingConventionComboBox);
|
|
||||||
this.groupBox2.Controls.Add(this.label5);
|
|
||||||
this.groupBox2.Controls.Add(this.FolderGroupPathTextBox);
|
|
||||||
this.groupBox2.Controls.Add(this.InsertGroupName);
|
|
||||||
this.groupBox2.Controls.Add(this.FolderGroupListView);
|
|
||||||
this.groupBox2.Controls.Add(this.FolderGroupPathButton);
|
|
||||||
this.groupBox2.Controls.Add(this.label6);
|
|
||||||
this.groupBox2.Location = new System.Drawing.Point(620, 3);
|
|
||||||
this.groupBox2.Name = "groupBox2";
|
|
||||||
this.groupBox2.Size = new System.Drawing.Size(658, 430);
|
|
||||||
this.groupBox2.TabIndex = 18;
|
|
||||||
this.groupBox2.TabStop = false;
|
|
||||||
this.groupBox2.Text = "Folder Group Details";
|
|
||||||
//
|
|
||||||
// label7
|
|
||||||
//
|
|
||||||
this.label7.AutoSize = true;
|
|
||||||
this.label7.Location = new System.Drawing.Point(6, 276);
|
|
||||||
this.label7.Name = "label7";
|
|
||||||
this.label7.Size = new System.Drawing.Size(104, 20);
|
|
||||||
this.label7.TabIndex = 15;
|
|
||||||
this.label7.Text = "Group Name:";
|
|
||||||
//
|
|
||||||
// FolderNameTextBox
|
|
||||||
//
|
|
||||||
this.FolderNameTextBox.Enabled = false;
|
|
||||||
this.FolderNameTextBox.Location = new System.Drawing.Point(163, 273);
|
|
||||||
this.FolderNameTextBox.Name = "FolderNameTextBox";
|
|
||||||
this.FolderNameTextBox.Size = new System.Drawing.Size(311, 26);
|
|
||||||
this.FolderNameTextBox.TabIndex = 5;
|
|
||||||
//
|
|
||||||
// label8
|
// label8
|
||||||
//
|
//
|
||||||
this.label8.AutoSize = true;
|
this.label8.AutoSize = true;
|
||||||
@@ -347,6 +256,95 @@
|
|||||||
this.label8.TabIndex = 10;
|
this.label8.TabIndex = 10;
|
||||||
this.label8.Text = "New content location is the default location where you will add new files to.";
|
this.label8.Text = "New content location is the default location where you will add new files to.";
|
||||||
//
|
//
|
||||||
|
// NewContentLocationTextBox
|
||||||
|
//
|
||||||
|
this.NewContentLocationTextBox.Location = new System.Drawing.Point(195, 121);
|
||||||
|
this.NewContentLocationTextBox.Name = "NewContentLocationTextBox";
|
||||||
|
this.NewContentLocationTextBox.Size = new System.Drawing.Size(311, 26);
|
||||||
|
this.NewContentLocationTextBox.TabIndex = 2;
|
||||||
|
//
|
||||||
|
// MachineNameTextBox
|
||||||
|
//
|
||||||
|
this.MachineNameTextBox.Location = new System.Drawing.Point(195, 253);
|
||||||
|
this.MachineNameTextBox.Name = "MachineNameTextBox";
|
||||||
|
this.MachineNameTextBox.Size = new System.Drawing.Size(311, 26);
|
||||||
|
this.MachineNameTextBox.TabIndex = 4;
|
||||||
|
//
|
||||||
|
// AddOrUpdateProfileButton
|
||||||
|
//
|
||||||
|
this.AddOrUpdateProfileButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
|
this.AddOrUpdateProfileButton.Location = new System.Drawing.Point(519, 380);
|
||||||
|
this.AddOrUpdateProfileButton.Name = "AddOrUpdateProfileButton";
|
||||||
|
this.AddOrUpdateProfileButton.Size = new System.Drawing.Size(86, 40);
|
||||||
|
this.AddOrUpdateProfileButton.TabIndex = 10;
|
||||||
|
this.AddOrUpdateProfileButton.Text = "button1";
|
||||||
|
this.AddOrUpdateProfileButton.UseVisualStyleBackColor = true;
|
||||||
|
this.AddOrUpdateProfileButton.Click += new System.EventHandler(this.AddOrUpdateProfileButton_Click);
|
||||||
|
//
|
||||||
|
// DeleteProfileButton
|
||||||
|
//
|
||||||
|
this.DeleteProfileButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||||
|
this.DeleteProfileButton.Location = new System.Drawing.Point(14, 380);
|
||||||
|
this.DeleteProfileButton.Name = "DeleteProfileButton";
|
||||||
|
this.DeleteProfileButton.Size = new System.Drawing.Size(75, 40);
|
||||||
|
this.DeleteProfileButton.TabIndex = 8;
|
||||||
|
this.DeleteProfileButton.TabStop = false;
|
||||||
|
this.DeleteProfileButton.Text = "Delete";
|
||||||
|
this.DeleteProfileButton.UseVisualStyleBackColor = true;
|
||||||
|
this.DeleteProfileButton.Click += new System.EventHandler(this.DeleteProfileButton_Click);
|
||||||
|
//
|
||||||
|
// label2
|
||||||
|
//
|
||||||
|
this.label2.AutoSize = true;
|
||||||
|
this.label2.Location = new System.Drawing.Point(13, 124);
|
||||||
|
this.label2.Name = "label2";
|
||||||
|
this.label2.Size = new System.Drawing.Size(170, 20);
|
||||||
|
this.label2.TabIndex = 2;
|
||||||
|
this.label2.Text = "New Content Location:";
|
||||||
|
//
|
||||||
|
// ProfileNameTextBox
|
||||||
|
//
|
||||||
|
this.ProfileNameTextBox.Location = new System.Drawing.Point(198, 39);
|
||||||
|
this.ProfileNameTextBox.Name = "ProfileNameTextBox";
|
||||||
|
this.ProfileNameTextBox.Size = new System.Drawing.Size(311, 26);
|
||||||
|
this.ProfileNameTextBox.TabIndex = 1;
|
||||||
|
//
|
||||||
|
// SelectNewContentLocationButton
|
||||||
|
//
|
||||||
|
this.SelectNewContentLocationButton.Location = new System.Drawing.Point(512, 119);
|
||||||
|
this.SelectNewContentLocationButton.Name = "SelectNewContentLocationButton";
|
||||||
|
this.SelectNewContentLocationButton.Size = new System.Drawing.Size(50, 30);
|
||||||
|
this.SelectNewContentLocationButton.TabIndex = 3;
|
||||||
|
this.SelectNewContentLocationButton.Text = "...";
|
||||||
|
this.SelectNewContentLocationButton.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// label4
|
||||||
|
//
|
||||||
|
this.label4.AutoSize = true;
|
||||||
|
this.label4.Location = new System.Drawing.Point(10, 256);
|
||||||
|
this.label4.Name = "label4";
|
||||||
|
this.label4.Size = new System.Drawing.Size(119, 20);
|
||||||
|
this.label4.TabIndex = 7;
|
||||||
|
this.label4.Text = "Machine Name:";
|
||||||
|
//
|
||||||
|
// label1
|
||||||
|
//
|
||||||
|
this.label1.AutoSize = true;
|
||||||
|
this.label1.Location = new System.Drawing.Point(13, 42);
|
||||||
|
this.label1.Name = "label1";
|
||||||
|
this.label1.Size = new System.Drawing.Size(103, 20);
|
||||||
|
this.label1.TabIndex = 0;
|
||||||
|
this.label1.Text = "Profile Name:";
|
||||||
|
//
|
||||||
|
// MachineNameLabel
|
||||||
|
//
|
||||||
|
this.MachineNameLabel.AutoSize = true;
|
||||||
|
this.MachineNameLabel.Location = new System.Drawing.Point(13, 186);
|
||||||
|
this.MachineNameLabel.Name = "MachineNameLabel";
|
||||||
|
this.MachineNameLabel.Size = new System.Drawing.Size(88, 20);
|
||||||
|
this.MachineNameLabel.TabIndex = 5;
|
||||||
|
this.MachineNameLabel.Text = "profile stuff";
|
||||||
|
//
|
||||||
// ProfileManager
|
// ProfileManager
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F);
|
||||||
@@ -364,10 +362,10 @@
|
|||||||
this.MainPanel.ResumeLayout(false);
|
this.MainPanel.ResumeLayout(false);
|
||||||
this.MainPanel.PerformLayout();
|
this.MainPanel.PerformLayout();
|
||||||
this.ProfileInfoPanel.ResumeLayout(false);
|
this.ProfileInfoPanel.ResumeLayout(false);
|
||||||
this.groupBox1.ResumeLayout(false);
|
|
||||||
this.groupBox1.PerformLayout();
|
|
||||||
this.groupBox2.ResumeLayout(false);
|
this.groupBox2.ResumeLayout(false);
|
||||||
this.groupBox2.PerformLayout();
|
this.groupBox2.PerformLayout();
|
||||||
|
this.groupBox1.ResumeLayout(false);
|
||||||
|
this.groupBox1.PerformLayout();
|
||||||
this.ResumeLayout(false);
|
this.ResumeLayout(false);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ namespace DataOrganizer
|
|||||||
private List<DB.Namingconvention> NamingConventions { get; }
|
private List<DB.Namingconvention> NamingConventions { get; }
|
||||||
private Dictionary<string, DB.Profile> Profiles { get; } = new Dictionary<string, DB.Profile>();
|
private Dictionary<string, DB.Profile> Profiles { get; } = new Dictionary<string, DB.Profile>();
|
||||||
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 DB.FolderGroup ActiveFolderGroup { get; set; }
|
||||||
|
|
||||||
public ProfileManager()
|
public ProfileManager()
|
||||||
{
|
{
|
||||||
@@ -43,6 +44,8 @@ namespace DataOrganizer
|
|||||||
NewContentLocationTextBox.TextChanged += ToggleAddOrUpdateButton;
|
NewContentLocationTextBox.TextChanged += ToggleAddOrUpdateButton;
|
||||||
MachineNameTextBox.TextChanged += MachineNameTextBox_TextChanged;
|
MachineNameTextBox.TextChanged += MachineNameTextBox_TextChanged;
|
||||||
FolderGroupPathTextBox.TextChanged += ToggleGroupInsertButton;
|
FolderGroupPathTextBox.TextChanged += ToggleGroupInsertButton;
|
||||||
|
FolderNameTextBox.TextChanged += ToggleGroupInsertButton;
|
||||||
|
FolderGroupListView.SelectedIndexChanged += FolderGroupListView_SelectedIndexChanged;
|
||||||
FolderGroupListView.MouseClick += FolderGroupListView_MouseClick;
|
FolderGroupListView.MouseClick += FolderGroupListView_MouseClick;
|
||||||
SelectNewContentLocationButton.Click += SelectNewContentLocationButton_Click1;
|
SelectNewContentLocationButton.Click += SelectNewContentLocationButton_Click1;
|
||||||
deleteMenuItem.Click += DeleteMenuItem_Click;
|
deleteMenuItem.Click += DeleteMenuItem_Click;
|
||||||
@@ -51,6 +54,23 @@ namespace DataOrganizer
|
|||||||
SetupForNewProfile();
|
SetupForNewProfile();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void FolderGroupListView_SelectedIndexChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var db = new DB();
|
||||||
|
GetSelectedFolderGroup(out DB.FolderGroup folderGroup);
|
||||||
|
|
||||||
|
FolderGroupPathTextBox.Text = folderGroup.Path;
|
||||||
|
FolderNameTextBox.Text = folderGroup.Name;
|
||||||
|
var index = NamingConventions.FindIndex(x => x.Id == folderGroup.PatternId);
|
||||||
|
|
||||||
|
if (index != -1)
|
||||||
|
NamingConventionComboBox.SelectedIndex = index + 1;
|
||||||
|
else
|
||||||
|
NamingConventionComboBox.SelectedIndex = 0;
|
||||||
|
|
||||||
|
InsertGroupName.Text = "Update Folder Group";
|
||||||
|
}
|
||||||
|
|
||||||
private void SelectNewContentLocationButton_Click1(object sender, EventArgs e)
|
private void SelectNewContentLocationButton_Click1(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var dialog = new FolderBrowserDialog() { Description = "Select the folder where new content will be placed." };
|
var dialog = new FolderBrowserDialog() { Description = "Select the folder where new content will be placed." };
|
||||||
@@ -124,7 +144,7 @@ namespace DataOrganizer
|
|||||||
|
|
||||||
private void ToggleGroupInsertButton(object sender, EventArgs e)
|
private void ToggleGroupInsertButton(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (!string.IsNullOrEmpty(FolderGroupPathTextBox.Text))
|
if (!string.IsNullOrEmpty(FolderGroupPathTextBox.Text) && !string.IsNullOrEmpty(FolderNameTextBox.Text))
|
||||||
InsertGroupName.Enabled = true;
|
InsertGroupName.Enabled = true;
|
||||||
else
|
else
|
||||||
InsertGroupName.Enabled = false;
|
InsertGroupName.Enabled = false;
|
||||||
@@ -181,16 +201,45 @@ namespace DataOrganizer
|
|||||||
|
|
||||||
private void InsertGroupName_Click(object sender, EventArgs e)
|
private void InsertGroupName_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
if (FolderGroups.ContainsKey(FolderNameTextBox.Text))
|
||||||
|
{
|
||||||
|
MessageBox.Show($"'{FolderNameTextBox.Text}' already exists as a Folder Group. Duplicate names are not allowed.", "Duplication Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
FolderNameTextBox.Focus();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
FolderGroupPathTextBox.Text = FolderGroupPathTextBox.Text.TrimEnd(new char[] { '\\' });
|
FolderGroupPathTextBox.Text = FolderGroupPathTextBox.Text.TrimEnd(new char[] { '\\' });
|
||||||
|
|
||||||
var dir = new DirectoryInfo(FolderGroupPathTextBox.Text);
|
if(GetSelectedFolderGroup(out DB.FolderGroup folderGroup))
|
||||||
var groupName = dir.Name;
|
|
||||||
|
|
||||||
if (!FolderGroups.ContainsKey(groupName))
|
|
||||||
{
|
{
|
||||||
|
FolderGroups.Remove(folderGroup.Name);
|
||||||
|
|
||||||
|
folderGroup.Path = FolderGroupPathTextBox.Text;
|
||||||
|
folderGroup.Name = FolderNameTextBox.Text;
|
||||||
|
GetCurrentNamingConvention(out DB.Namingconvention convention);
|
||||||
|
folderGroup.PatternId = convention.Id;
|
||||||
|
InsertGroupName.Text = "Insert Folder Group";
|
||||||
|
|
||||||
|
if (IsUpdating)
|
||||||
|
{
|
||||||
|
var db = new DB();
|
||||||
|
db.UpdateFolderGroup(folderGroup);
|
||||||
|
FolderGroupListView.SelectedItems[0].Text = folderGroup.Name;
|
||||||
|
}
|
||||||
|
|
||||||
|
FolderGroups.Add(folderGroup.Name, folderGroup);
|
||||||
|
|
||||||
|
NamingConventionComboBox.SelectedIndex = 0;
|
||||||
|
FolderNameTextBox.Text = string.Empty;
|
||||||
|
FolderGroupPathTextBox.Text = string.Empty;
|
||||||
|
InsertGroupName.Enabled = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var groupName = FolderNameTextBox.Text;
|
||||||
GetCurrentNamingConvention(out DB.Namingconvention convention);
|
GetCurrentNamingConvention(out DB.Namingconvention convention);
|
||||||
GetCurrentProfile(out DB.Profile profile);
|
GetCurrentProfile(out DB.Profile profile);
|
||||||
var newFolder = new DB.FolderGroup { Name = groupName, Path = FolderGroupPathTextBox.Text, PatternId = convention.Id};
|
var newFolder = new DB.FolderGroup { Name = groupName, Path = FolderGroupPathTextBox.Text, PatternId = convention.Id };
|
||||||
|
|
||||||
FolderGroupListView.Items.Add(groupName);
|
FolderGroupListView.Items.Add(groupName);
|
||||||
|
|
||||||
@@ -212,28 +261,6 @@ namespace DataOrganizer
|
|||||||
FolderGroupPathTextBox.Text = string.Empty;
|
FolderGroupPathTextBox.Text = string.Empty;
|
||||||
InsertGroupName.Enabled = false;
|
InsertGroupName.Enabled = false;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
var folderGroup = FolderGroups[groupName];//(DB.FolderGroup) FolderGroupListView.Items.Find(groupName, true)[0].Tag;
|
|
||||||
folderGroup.Path = FolderGroupPathTextBox.Text;
|
|
||||||
folderGroup.Name = groupName;
|
|
||||||
GetCurrentNamingConvention(out DB.Namingconvention convention);
|
|
||||||
folderGroup.PatternId = convention.Id;
|
|
||||||
InsertGroupName.Text = "Insert Folder Group";
|
|
||||||
|
|
||||||
if (IsUpdating)
|
|
||||||
{
|
|
||||||
var db = new DB();
|
|
||||||
db.UpdateFolderGroup(folderGroup);
|
|
||||||
}
|
|
||||||
|
|
||||||
FolderGroups[groupName] = folderGroup;
|
|
||||||
|
|
||||||
NamingConventionComboBox.SelectedIndex = 0;
|
|
||||||
FolderNameTextBox.Text = string.Empty;
|
|
||||||
FolderGroupPathTextBox.Text = string.Empty;
|
|
||||||
InsertGroupName.Enabled = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
FolderGroupPathButton.Focus();
|
FolderGroupPathButton.Focus();
|
||||||
}
|
}
|
||||||
@@ -297,6 +324,8 @@ namespace DataOrganizer
|
|||||||
{
|
{
|
||||||
FolderGroupPathTextBox.Text = dialog.SelectedPath;
|
FolderGroupPathTextBox.Text = dialog.SelectedPath;
|
||||||
InsertGroupName.Text = "Insert Folder Group";
|
InsertGroupName.Text = "Insert Folder Group";
|
||||||
|
var dir = new DirectoryInfo(dialog.SelectedPath);
|
||||||
|
FolderNameTextBox.Text = dir.Name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -413,6 +442,13 @@ namespace DataOrganizer
|
|||||||
{
|
{
|
||||||
ClearForm();
|
ClearForm();
|
||||||
IsUpdating = true;
|
IsUpdating = true;
|
||||||
|
Profiles.Clear();
|
||||||
|
var db = new DB();
|
||||||
|
|
||||||
|
foreach(var p in db.GetProfiles())
|
||||||
|
{
|
||||||
|
Profiles.Add(p.Name, p);
|
||||||
|
}
|
||||||
|
|
||||||
GetCurrentProfile(out DB.Profile profile);
|
GetCurrentProfile(out DB.Profile profile);
|
||||||
|
|
||||||
@@ -435,15 +471,5 @@ namespace DataOrganizer
|
|||||||
AddOrUpdateProfileButton.Enabled = true;
|
AddOrUpdateProfileButton.Enabled = true;
|
||||||
DeleteProfileButton.Enabled = true;
|
DeleteProfileButton.Enabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SelectNewContentLocationButton_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
var dialog = new FolderBrowserDialog() { Description = "Select the default location to look for new content." };
|
|
||||||
|
|
||||||
if (dialog.ShowDialog() == DialogResult.OK)
|
|
||||||
{
|
|
||||||
NewContentLocationTextBox.Text = dialog.SelectedPath;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ namespace DataOrganizer
|
|||||||
//with the text "Death Note" would return all files in that folder.
|
//with the text "Death Note" would return all files in that folder.
|
||||||
public Dictionary<string, List<FileSnapshot>> OrganizationFolders { get; private set; } = new Dictionary<string, List<FileSnapshot>>();
|
public Dictionary<string, List<FileSnapshot>> OrganizationFolders { get; private set; } = new Dictionary<string, List<FileSnapshot>>();
|
||||||
|
|
||||||
public Snapshot(List<DB.FileSnapshot> fileRecords, DB.FolderGroup folderGroup)
|
public Snapshot(List<DB.DBFileSnapshot> fileRecords, DB.FolderGroup folderGroup)
|
||||||
{
|
{
|
||||||
Root = new Folder(folderGroup.Name, folderGroup.Path, null);
|
Root = new Folder(folderGroup.Name, folderGroup.Path, null);
|
||||||
Directories.Add(Root.FullPath, Root);
|
Directories.Add(Root.FullPath, Root);
|
||||||
@@ -39,7 +39,7 @@ namespace DataOrganizer
|
|||||||
ProcessFilesAsOneLevel(files, folderGroup);
|
ProcessFilesAsOneLevel(files, folderGroup);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ProcessFilesAsOneLevel(List<DB.FileSnapshot> files, DB.FolderGroup folderGroup)
|
private void ProcessFilesAsOneLevel(List<DB.DBFileSnapshot> files, DB.FolderGroup folderGroup)
|
||||||
{
|
{
|
||||||
Folder firstLevelFolder = null;
|
Folder firstLevelFolder = null;
|
||||||
|
|
||||||
@@ -137,7 +137,7 @@ namespace DataOrganizer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ProcessFilesAsFlat(List<DB.FileSnapshot> files, DB.FolderGroup folderGroup)
|
private void ProcessFilesAsFlat(List<DB.DBFileSnapshot> files, DB.FolderGroup folderGroup)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -213,7 +213,7 @@ namespace DataOrganizer
|
|||||||
|
|
||||||
public struct Duplicate
|
public struct Duplicate
|
||||||
{
|
{
|
||||||
public DB.FileSnapshot File;
|
public DB.DBFileSnapshot File;
|
||||||
public List<FileSnapshot> Duplicates;
|
public List<FileSnapshot> Duplicates;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -324,7 +324,7 @@ namespace DataOrganizer
|
|||||||
get { return _Name; }
|
get { return _Name; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public FileSnapshot(DB.FileSnapshot file, Folder organizationalFolder, Folder parentFolder, string rootPath)
|
public FileSnapshot(DB.DBFileSnapshot file, Folder organizationalFolder, Folder parentFolder, string rootPath)
|
||||||
{
|
{
|
||||||
OrganizationalFolder = organizationalFolder;
|
OrganizationalFolder = organizationalFolder;
|
||||||
ParentFolder = parentFolder;
|
ParentFolder = parentFolder;
|
||||||
|
|||||||
Reference in New Issue
Block a user