Started work on a cleaner more focused file manager form. The form will only be used to diff profile group folders, other tasks will be reserved for future forms.
This commit is contained in:
Binary file not shown.
@@ -78,6 +78,12 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="DB.cs" />
|
||||
<Compile Include="FileManager.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="FileManager.Designer.cs">
|
||||
<DependentUpon>FileManager.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="FileViewer.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
@@ -106,6 +112,9 @@
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Snapshot.cs" />
|
||||
<EmbeddedResource Include="FileManager.resx">
|
||||
<DependentUpon>FileManager.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="FileViewer.resx">
|
||||
<DependentUpon>FileViewer.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
@@ -149,4 +158,8 @@
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\packages\SQLitePCLRaw.lib.e_sqlite3.2.0.2\build\net461\SQLitePCLRaw.lib.e_sqlite3.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\SQLitePCLRaw.lib.e_sqlite3.2.0.2\build\net461\SQLitePCLRaw.lib.e_sqlite3.targets'))" />
|
||||
</Target>
|
||||
<PropertyGroup>
|
||||
<PreBuildEvent>
|
||||
</PreBuildEvent>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
Generated
+274
@@ -0,0 +1,274 @@
|
||||
namespace DataOrganizer
|
||||
{
|
||||
partial class FileManager
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
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.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.ScanSelectedFolderGroupButton = new System.Windows.Forms.Button();
|
||||
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.MainLayoutPanel.SuspendLayout();
|
||||
this.MainMenuStrip.SuspendLayout();
|
||||
this.Panel1.SuspendLayout();
|
||||
this.CompareAgainstGroupBox.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// MainLayoutPanel
|
||||
//
|
||||
this.MainLayoutPanel.ColumnCount = 3;
|
||||
this.MainLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33F));
|
||||
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.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.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.TabIndex = 0;
|
||||
//
|
||||
// MainMenuStrip
|
||||
//
|
||||
this.MainLayoutPanel.SetColumnSpan(this.MainMenuStrip, 3);
|
||||
this.MainMenuStrip.GripMargin = new System.Windows.Forms.Padding(2, 2, 0, 2);
|
||||
this.MainMenuStrip.ImageScalingSize = new System.Drawing.Size(24, 24);
|
||||
this.MainMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.ManageMainMenuStrip,
|
||||
this.SelectProfileComboBoxMainMenu,
|
||||
this.SelectFolderGroupComboBoxMainMenu});
|
||||
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.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[] {
|
||||
this.ProfilesManageMainMenu,
|
||||
this.NamingPatternsManageMainMenu});
|
||||
this.ManageMainMenuStrip.Name = "ManageMainMenuStrip";
|
||||
this.ManageMainMenuStrip.Size = new System.Drawing.Size(92, 33);
|
||||
this.ManageMainMenuStrip.Text = "&Manage";
|
||||
//
|
||||
// ProfilesManageMainMenu
|
||||
//
|
||||
this.ProfilesManageMainMenu.Name = "ProfilesManageMainMenu";
|
||||
this.ProfilesManageMainMenu.Size = new System.Drawing.Size(270, 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.Text = "&Naming Patterns";
|
||||
this.NamingPatternsManageMainMenu.Click += new System.EventHandler(this.NamingPatternsManageMainMenu_Click);
|
||||
//
|
||||
// SelectFolderGroupComboBoxMainMenu
|
||||
//
|
||||
this.SelectFolderGroupComboBoxMainMenu.BackColor = System.Drawing.Color.Gainsboro;
|
||||
this.SelectFolderGroupComboBoxMainMenu.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
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.Name = "FileDetailsGroupBox";
|
||||
this.FileDetailsGroupBox.Size = new System.Drawing.Size(428, 315);
|
||||
this.FileDetailsGroupBox.TabIndex = 5;
|
||||
this.FileDetailsGroupBox.TabStop = false;
|
||||
this.FileDetailsGroupBox.Text = "File Details:";
|
||||
//
|
||||
// DiffResultsGroupBox
|
||||
//
|
||||
this.DiffResultsGroupBox.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.DiffResultsGroupBox.Location = new System.Drawing.Point(424, 524);
|
||||
this.DiffResultsGroupBox.Name = "DiffResultsGroupBox";
|
||||
this.DiffResultsGroupBox.Size = new System.Drawing.Size(428, 317);
|
||||
this.DiffResultsGroupBox.TabIndex = 6;
|
||||
this.DiffResultsGroupBox.TabStop = false;
|
||||
this.DiffResultsGroupBox.Text = "Diff Results:";
|
||||
//
|
||||
// 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.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;
|
||||
//
|
||||
// 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.Name = "CompareAgainstGroupBox";
|
||||
this.CompareAgainstGroupBox.Size = new System.Drawing.Size(417, 154);
|
||||
this.CompareAgainstGroupBox.TabIndex = 7;
|
||||
this.CompareAgainstGroupBox.TabStop = false;
|
||||
this.CompareAgainstGroupBox.Text = "Compare Against:";
|
||||
//
|
||||
// CompareAgainstProfileComboBox
|
||||
//
|
||||
this.CompareAgainstProfileComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.CompareAgainstProfileComboBox.FormattingEnabled = true;
|
||||
this.CompareAgainstProfileComboBox.Location = new System.Drawing.Point(6, 34);
|
||||
this.CompareAgainstProfileComboBox.Name = "CompareAgainstProfileComboBox";
|
||||
this.CompareAgainstProfileComboBox.Size = new System.Drawing.Size(200, 28);
|
||||
this.CompareAgainstProfileComboBox.TabIndex = 0;
|
||||
//
|
||||
// CompareAgainstFolderGroupComboBox
|
||||
//
|
||||
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;
|
||||
//
|
||||
// CompareButton
|
||||
//
|
||||
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;
|
||||
//
|
||||
// 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.Controls.Add(this.MainLayoutPanel);
|
||||
this.Name = "FileManager";
|
||||
this.Text = "File Manager";
|
||||
this.MainLayoutPanel.ResumeLayout(false);
|
||||
this.MainLayoutPanel.PerformLayout();
|
||||
this.MainMenuStrip.ResumeLayout(false);
|
||||
this.MainMenuStrip.PerformLayout();
|
||||
this.Panel1.ResumeLayout(false);
|
||||
this.CompareAgainstGroupBox.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.TableLayoutPanel MainLayoutPanel;
|
||||
private System.Windows.Forms.MenuStrip MainMenuStrip;
|
||||
private System.Windows.Forms.ToolStripComboBox SelectProfileComboBoxMainMenu;
|
||||
private System.Windows.Forms.ToolStripMenuItem ManageMainMenuStrip;
|
||||
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;
|
||||
private System.Windows.Forms.GroupBox CompareAgainstGroupBox;
|
||||
private System.Windows.Forms.ComboBox CompareAgainstProfileComboBox;
|
||||
private System.Windows.Forms.ComboBox CompareAgainstFolderGroupComboBox;
|
||||
private System.Windows.Forms.Button CompareButton;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,193 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace DataOrganizer
|
||||
{
|
||||
public partial class FileManager : Form
|
||||
{
|
||||
private List<DB.Profile> Profiles { get; set; } = new List<DB.Profile>();
|
||||
private List<DB.FolderGroup> FolderGroups { get; set; } = new List<DB.FolderGroup>();
|
||||
private Snapshot ActiveSnapshot { get; set; }
|
||||
|
||||
public FileManager()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
SelectProfileComboBoxMainMenu.SelectedIndexChanged += SelectProfileComboBoxMainMenu_SelectedIndexChanged;
|
||||
SelectFolderGroupComboBoxMainMenu.SelectedIndexChanged += SelectFolderGroupComboBoxMainMenu_SelectedIndexChanged;
|
||||
CompareAgainstProfileComboBox.SelectedIndexChanged += CompareAgainstProfileComboBox_SelectedIndexChanged;
|
||||
CompareAgainstFolderGroupComboBox.SelectedIndexChanged += CompareAgainstFolderGroupComboBox_SelectedIndexChanged;
|
||||
CompareButton.Click += CompareButton_Click;
|
||||
|
||||
PopulateProfileComboBox();
|
||||
}
|
||||
|
||||
private void CompareButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
var db = new DB();
|
||||
var p = GetProfileToCompare();
|
||||
var f = GetFolderGroupToCompare();
|
||||
|
||||
}
|
||||
|
||||
private void CompareAgainstProfileComboBox_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
ClearDiffResults();
|
||||
|
||||
CompareAgainstFolderGroupComboBox.Items.Clear();
|
||||
|
||||
var profile = GetProfileToCompare();
|
||||
|
||||
foreach(var folder in profile.FolderGroups)
|
||||
CompareAgainstFolderGroupComboBox.Items.Add(folder.Name);
|
||||
|
||||
if(profile.FolderGroups.Count > 0) CompareAgainstFolderGroupComboBox.SelectedIndex = 0;
|
||||
}
|
||||
|
||||
private void CompareAgainstFolderGroupComboBox_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
ClearDiffResults();
|
||||
|
||||
CompareButton.Enabled = ScanSelectedFolderGroupButton.Enabled;
|
||||
}
|
||||
|
||||
private void SelectFolderGroupComboBoxMainMenu_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
ClearForm(true);
|
||||
|
||||
var db = new DB();
|
||||
var folderGroup = GetSelectedFolderGroup();
|
||||
|
||||
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;
|
||||
CompareButton.Enabled = files.Count > 0;
|
||||
}
|
||||
|
||||
private TreeNode BuildTreeNode(Folder folder)
|
||||
{
|
||||
var node = new TreeNode(folder.Name) { Name = folder.FullPath };
|
||||
|
||||
foreach(var dir in folder.Folders.Values)
|
||||
{
|
||||
node.Nodes.Add(BuildTreeNode(dir));
|
||||
}
|
||||
|
||||
foreach(var file in folder.Files.Values)
|
||||
{
|
||||
node.Nodes.Add(new TreeNode(file.Name) { Name = file.FullPath });
|
||||
}
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
private void SelectProfileComboBoxMainMenu_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
ClearForm();
|
||||
|
||||
FolderGroups = GetSelectedProfile().FolderGroups;
|
||||
|
||||
SelectFolderGroupComboBoxMainMenu.Items.Clear();
|
||||
CompareAgainstProfileComboBox.Items.Clear();
|
||||
|
||||
foreach (var folder in FolderGroups)
|
||||
SelectFolderGroupComboBoxMainMenu.Items.Add(folder.Name);
|
||||
|
||||
if (FolderGroups.Count > 0) SelectFolderGroupComboBoxMainMenu.SelectedIndex = 0;
|
||||
|
||||
if(Profiles.Count > 1)
|
||||
{
|
||||
foreach(var profile in Profiles)
|
||||
if(profile.Name != SelectProfileComboBoxMainMenu.Text)
|
||||
CompareAgainstProfileComboBox.Items.Add(profile.Name);
|
||||
|
||||
CompareAgainstProfileComboBox.SelectedIndex = 0;
|
||||
}
|
||||
}
|
||||
|
||||
private void ClearForm(bool isFolderGroupChange = false)
|
||||
{
|
||||
FolderGroupTreeView.Nodes.Clear();
|
||||
DiffViewTreeView.Nodes.Clear();
|
||||
if (!isFolderGroupChange)
|
||||
{
|
||||
CompareAgainstProfileComboBox.Items.Clear();
|
||||
CompareAgainstFolderGroupComboBox.Items.Clear();
|
||||
}
|
||||
CompareButton.Enabled = false;
|
||||
ScanSelectedFolderGroupButton.Enabled = false;
|
||||
}
|
||||
|
||||
private void ClearDiffResults()
|
||||
{
|
||||
DiffViewTreeView.Nodes.Clear();
|
||||
}
|
||||
|
||||
private void PopulateProfileComboBox()
|
||||
{
|
||||
var db = new DB();
|
||||
Profiles = db.GetProfiles();
|
||||
SelectProfileComboBoxMainMenu.Items.Clear();
|
||||
|
||||
foreach(var profile in Profiles)
|
||||
SelectProfileComboBoxMainMenu.Items.Add(profile.Name);
|
||||
|
||||
if(Profiles.Count > 0) SelectProfileComboBoxMainMenu.SelectedIndex = 0;
|
||||
}
|
||||
|
||||
private void RefreshForm()
|
||||
{
|
||||
ClearForm();
|
||||
|
||||
PopulateProfileComboBox();
|
||||
}
|
||||
|
||||
private DB.Profile GetSelectedProfile()
|
||||
{
|
||||
return Profiles[SelectProfileComboBoxMainMenu.SelectedIndex];
|
||||
}
|
||||
|
||||
private DB.FolderGroup GetSelectedFolderGroup()
|
||||
{
|
||||
return FolderGroups[SelectFolderGroupComboBoxMainMenu.SelectedIndex];
|
||||
}
|
||||
|
||||
private DB.Profile GetProfileToCompare()
|
||||
{
|
||||
return Profiles.First(x => x.Name == CompareAgainstProfileComboBox.Text);
|
||||
}
|
||||
|
||||
private DB.FolderGroup GetFolderGroupToCompare()
|
||||
{
|
||||
return GetProfileToCompare().FolderGroups.First(x => x.Name == CompareAgainstFolderGroupComboBox.Text);
|
||||
|
||||
}
|
||||
|
||||
private void ProfilesManageMainMenu_Click(object sender, EventArgs e)
|
||||
{
|
||||
var form = new ProfileManager();
|
||||
form.ShowDialog();
|
||||
|
||||
RefreshForm();
|
||||
}
|
||||
|
||||
private void NamingPatternsManageMainMenu_Click(object sender, EventArgs e)
|
||||
{
|
||||
var form = new NamingConventionManager();
|
||||
form.ShowDialog();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="MainMenuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
</root>
|
||||
Generated
+11
-1
@@ -36,6 +36,7 @@
|
||||
this.debugToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.deleteDBToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.manageNamingPatternsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.newFileManagerToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.MainMenu.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
@@ -57,7 +58,8 @@
|
||||
this.FileMainMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.ManageProfilesFileMainMenu,
|
||||
this.FileManagerFileMainMenu,
|
||||
this.manageNamingPatternsToolStripMenuItem});
|
||||
this.manageNamingPatternsToolStripMenuItem,
|
||||
this.newFileManagerToolStripMenuItem});
|
||||
this.FileMainMenu.Name = "FileMainMenu";
|
||||
this.FileMainMenu.Size = new System.Drawing.Size(54, 29);
|
||||
this.FileMainMenu.Text = "&File";
|
||||
@@ -112,6 +114,13 @@
|
||||
this.manageNamingPatternsToolStripMenuItem.Text = "Manage &Naming Patterns";
|
||||
this.manageNamingPatternsToolStripMenuItem.Click += new System.EventHandler(this.manageNamingPatternsToolStripMenuItem_Click);
|
||||
//
|
||||
// newFileManagerToolStripMenuItem
|
||||
//
|
||||
this.newFileManagerToolStripMenuItem.Name = "newFileManagerToolStripMenuItem";
|
||||
this.newFileManagerToolStripMenuItem.Size = new System.Drawing.Size(314, 34);
|
||||
this.newFileManagerToolStripMenuItem.Text = "New File Manager";
|
||||
this.newFileManagerToolStripMenuItem.Click += new System.EventHandler(this.newFileManagerToolStripMenuItem_Click);
|
||||
//
|
||||
// MainForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F);
|
||||
@@ -140,6 +149,7 @@
|
||||
private System.Windows.Forms.ToolStripMenuItem debugToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem deleteDBToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem manageNamingPatternsToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem newFileManagerToolStripMenuItem;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -40,5 +40,11 @@ namespace DataOrganizer
|
||||
var form = new NamingConventionManager();
|
||||
form.ShowDialog();
|
||||
}
|
||||
|
||||
private void newFileManagerToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var form = new FileManager();
|
||||
form.ShowDialog();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -211,6 +211,51 @@ namespace DataOrganizer
|
||||
}
|
||||
}
|
||||
|
||||
public SnapshotComparsion Diff(Snapshot snapshot)
|
||||
{
|
||||
return Compare(this, snapshot);
|
||||
}
|
||||
|
||||
private SnapshotComparsion Compare(Snapshot a, Snapshot b)
|
||||
{
|
||||
var newFiles = new List<FileSnapshot>();
|
||||
var modifiedFiles = new List<FileSnapshot>();
|
||||
var deletedFiles = new List<FileSnapshot>();
|
||||
var existingFiles = a.Files.Values.Except(b.Files.Values);
|
||||
var newOrgFolders = new List<Folder>();
|
||||
|
||||
foreach (var file in b.Files)
|
||||
if (!a.Files.ContainsKey(file.Key)) newFiles.Add(file.Value);
|
||||
|
||||
foreach (var folder in b.OrganizationFolders)
|
||||
{
|
||||
if (!a.OrganizationFolders.ContainsKey(folder.Key) && folder.Key != a.Root.FullPath)
|
||||
{
|
||||
newOrgFolders.Add(b.Directories[folder.Key]);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var existingFile in existingFiles)
|
||||
{
|
||||
if (!b.Files.ContainsKey(existingFile.FullPath))
|
||||
{
|
||||
deletedFiles.Add(existingFile);
|
||||
}
|
||||
else if (existingFile.ModifiedDate != b.Files[existingFile.FullPath].ModifiedDate)
|
||||
{
|
||||
modifiedFiles.Add(b.Files[existingFile.FullPath]);
|
||||
}
|
||||
}
|
||||
|
||||
return new SnapshotComparsion()
|
||||
{
|
||||
NewFiles = newFiles,
|
||||
ModifiedFiles = modifiedFiles,
|
||||
DeletedFiles = deletedFiles,
|
||||
NewOrganizationalFolders = newOrgFolders
|
||||
};
|
||||
}
|
||||
|
||||
public struct Duplicate
|
||||
{
|
||||
public DB.DBFileSnapshot File;
|
||||
@@ -394,6 +439,9 @@ namespace DataOrganizer
|
||||
|
||||
public class SnapshotComparsion
|
||||
{
|
||||
|
||||
public List<FileSnapshot> NewFiles { get; set; }
|
||||
public List<FileSnapshot> ModifiedFiles { get; set; }
|
||||
public List<FileSnapshot> DeletedFiles { get; set; }
|
||||
public List<Folder> NewOrganizationalFolders { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user