Added a form to manage 'profiles' and of course, added the database code to handle such things.
This commit is contained in:
@@ -0,0 +1,126 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.IO;
|
||||
using Microsoft.Data.Sqlite;
|
||||
using System.Reflection;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace DataOrganizer
|
||||
{
|
||||
public class DB
|
||||
{
|
||||
public static string DatabasePath { get; private set; }
|
||||
public static string ConnectionString { get; private set; }
|
||||
public static string TempScriptLocal = "Y:\\Database Template.sql";
|
||||
|
||||
public DB()
|
||||
{
|
||||
DatabasePath = $"{new FileInfo(new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath).Directory.FullName}\\Organizer Data\\Main.sqlite";
|
||||
|
||||
ConnectionString = $"Data Source={DatabasePath}";
|
||||
|
||||
if (!Directory.Exists(new FileInfo(DatabasePath).Directory.FullName))
|
||||
{
|
||||
Directory.CreateDirectory(new FileInfo(DatabasePath).Directory.FullName);
|
||||
CreateDatabase();
|
||||
}
|
||||
}
|
||||
|
||||
private void CreateDatabase()
|
||||
{
|
||||
//TODO: this is tmp
|
||||
var query = File.ReadAllText(TempScriptLocal);
|
||||
|
||||
using (var connection = new SqliteConnection(ConnectionString))
|
||||
{
|
||||
using(var command = new SqliteCommand(query, connection))
|
||||
{
|
||||
connection.Open();
|
||||
|
||||
command.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public List<Profile> GetProfiles()
|
||||
{
|
||||
var query = "SELECT * FROM profile";
|
||||
var profiles = new List<Profile>();
|
||||
|
||||
using (var connection = new SqliteConnection(ConnectionString))
|
||||
{
|
||||
using (var command = new SqliteCommand(query, connection))
|
||||
{
|
||||
connection.Open();
|
||||
|
||||
var reader = command.ExecuteReader();
|
||||
|
||||
while (reader.Read())
|
||||
{
|
||||
profiles.Add(new Profile
|
||||
{
|
||||
Name = reader["profile_name"].ToString(),
|
||||
DefaultNewContentFolder = reader["default_new_content_folder_name"].ToString(),
|
||||
MachineName = reader["machine_name"].ToString(),
|
||||
RowId = Convert.ToInt32(reader["profile_id"])
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return profiles;
|
||||
}
|
||||
|
||||
public bool UpdateProfile(Profile profile)
|
||||
{
|
||||
var query = @"UPDATE main.profile SET machine_name = @MachineName, default_new_content_folder_name = @DefaultPath, profile_name = @Name WHERE profile_id = @ID";
|
||||
using (var connection = new SqliteConnection(ConnectionString))
|
||||
{
|
||||
using (var command = new SqliteCommand(query, connection))
|
||||
{
|
||||
command.Parameters.AddWithValue("MachineName", profile.MachineName);
|
||||
command.Parameters.AddWithValue("DefaultPath", profile.DefaultNewContentFolder);
|
||||
command.Parameters.AddWithValue("Name", profile.Name);
|
||||
command.Parameters.AddWithValue("ID", profile.RowId);
|
||||
|
||||
connection.Open();
|
||||
|
||||
command.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool InsertNewProfile(Profile profile)
|
||||
{
|
||||
var query = @"INSERT INTO main.profile (machine_name, default_new_content_folder_name, profile_name) VALUES (@MachineName, @DefaultPath, @Name)";
|
||||
using (var connection = new SqliteConnection(ConnectionString))
|
||||
{
|
||||
using (var command = new SqliteCommand(query, connection))
|
||||
{
|
||||
command.Parameters.AddWithValue("MachineName", profile.MachineName);
|
||||
command.Parameters.AddWithValue("DefaultPath", profile.DefaultNewContentFolder);
|
||||
command.Parameters.AddWithValue("Name", profile.Name);
|
||||
|
||||
connection.Open();
|
||||
|
||||
command.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public struct Profile
|
||||
{
|
||||
public string Name;
|
||||
public string DefaultNewContentFolder;
|
||||
public string MachineName;
|
||||
public int RowId;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,8 @@
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
<Deterministic>true</Deterministic>
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
@@ -33,9 +35,37 @@
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.Data.Sqlite, Version=3.1.9.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Data.Sqlite.Core.3.1.9\lib\netstandard2.0\Microsoft.Data.Sqlite.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="SQLitePCLRaw.batteries_v2, Version=2.0.2.669, Culture=neutral, PublicKeyToken=8226ea5df37bcae9, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\SQLitePCLRaw.bundle_e_sqlite3.2.0.2\lib\net461\SQLitePCLRaw.batteries_v2.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="SQLitePCLRaw.core, Version=2.0.2.669, Culture=neutral, PublicKeyToken=1488e028ca7ab535, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\SQLitePCLRaw.core.2.0.2\lib\netstandard2.0\SQLitePCLRaw.core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="SQLitePCLRaw.nativelibrary, Version=2.0.2.669, Culture=neutral, PublicKeyToken=502ed628492ab262, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\SQLitePCLRaw.bundle_e_sqlite3.2.0.2\lib\net461\SQLitePCLRaw.nativelibrary.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="SQLitePCLRaw.provider.dynamic_cdecl, Version=2.0.2.669, Culture=neutral, PublicKeyToken=b68184102cba0b3b, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\SQLitePCLRaw.provider.dynamic_cdecl.2.0.2\lib\netstandard2.0\SQLitePCLRaw.provider.dynamic_cdecl.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Buffers, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Buffers.4.4.0\lib\netstandard2.0\System.Buffers.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Memory.4.5.3\lib\netstandard2.0\System.Memory.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Numerics" />
|
||||
<Reference Include="System.Numerics.Vectors, Version=4.1.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Numerics.Vectors.4.4.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.4.5.2\lib\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
@@ -47,6 +77,13 @@
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="DB.cs" />
|
||||
<Compile Include="FileViewer.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="FileViewer.Designer.cs">
|
||||
<DependentUpon>FileViewer.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="MainForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
@@ -54,11 +91,23 @@
|
||||
<DependentUpon>MainForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="GlobalSettings.cs" />
|
||||
<Compile Include="ProfileManager.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="ProfileManager.Designer.cs">
|
||||
<DependentUpon>ProfileManager.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<EmbeddedResource Include="FileViewer.resx">
|
||||
<DependentUpon>FileViewer.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="MainForm.resx">
|
||||
<DependentUpon>MainForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="ProfileManager.resx">
|
||||
<DependentUpon>ProfileManager.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
@@ -68,6 +117,7 @@
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
<None Include="packages.config" />
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
@@ -82,4 +132,11 @@
|
||||
<None Include="App.config" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="..\packages\SQLitePCLRaw.lib.e_sqlite3.2.0.2\build\net461\SQLitePCLRaw.lib.e_sqlite3.targets" Condition="Exists('..\packages\SQLitePCLRaw.lib.e_sqlite3.2.0.2\build\net461\SQLitePCLRaw.lib.e_sqlite3.targets')" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</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>
|
||||
</Project>
|
||||
Generated
+236
@@ -0,0 +1,236 @@
|
||||
namespace DataOrganizer
|
||||
{
|
||||
partial class FileViewer
|
||||
{
|
||||
/// <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.MainMenu = new System.Windows.Forms.MenuStrip();
|
||||
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.PrimaryFilesTreeView = new System.Windows.Forms.TreeView();
|
||||
this.PanelOne = new System.Windows.Forms.Panel();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.ProfileComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.SecondaryTreeView = new System.Windows.Forms.TreeView();
|
||||
this.SelectedFolderPanel = new System.Windows.Forms.Panel();
|
||||
this.ActiveFolderGroupBox = new System.Windows.Forms.GroupBox();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.FolderSelectButton = new System.Windows.Forms.Button();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.SelectedFolderComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.RootFolderComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.tableLayoutPanel1.SuspendLayout();
|
||||
this.PanelOne.SuspendLayout();
|
||||
this.SelectedFolderPanel.SuspendLayout();
|
||||
this.ActiveFolderGroupBox.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// MainMenu
|
||||
//
|
||||
this.MainMenu.GripMargin = new System.Windows.Forms.Padding(2, 2, 0, 2);
|
||||
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, 24);
|
||||
this.MainMenu.TabIndex = 0;
|
||||
this.MainMenu.Text = "menuStrip1";
|
||||
//
|
||||
// tableLayoutPanel1
|
||||
//
|
||||
this.tableLayoutPanel1.ColumnCount = 4;
|
||||
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F));
|
||||
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F));
|
||||
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F));
|
||||
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F));
|
||||
this.tableLayoutPanel1.Controls.Add(this.SecondaryTreeView, 2, 1);
|
||||
this.tableLayoutPanel1.Controls.Add(this.PrimaryFilesTreeView, 0, 1);
|
||||
this.tableLayoutPanel1.Controls.Add(this.PanelOne, 0, 0);
|
||||
this.tableLayoutPanel1.Controls.Add(this.SelectedFolderPanel, 2, 0);
|
||||
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
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, 882);
|
||||
this.tableLayoutPanel1.TabIndex = 1;
|
||||
//
|
||||
// PrimaryFilesTreeView
|
||||
//
|
||||
this.PrimaryFilesTreeView.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.PrimaryFilesTreeView.Location = new System.Drawing.Point(3, 294);
|
||||
this.PrimaryFilesTreeView.Name = "PrimaryFilesTreeView";
|
||||
this.tableLayoutPanel1.SetRowSpan(this.PrimaryFilesTreeView, 2);
|
||||
this.PrimaryFilesTreeView.Size = new System.Drawing.Size(362, 585);
|
||||
this.PrimaryFilesTreeView.TabIndex = 0;
|
||||
//
|
||||
// PanelOne
|
||||
//
|
||||
this.PanelOne.Controls.Add(this.RootFolderComboBox);
|
||||
this.PanelOne.Controls.Add(this.label3);
|
||||
this.PanelOne.Controls.Add(this.ProfileComboBox);
|
||||
this.PanelOne.Controls.Add(this.label1);
|
||||
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, 285);
|
||||
this.PanelOne.TabIndex = 1;
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(10, 20);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(104, 20);
|
||||
this.label1.TabIndex = 0;
|
||||
this.label1.Text = "Active Profile:";
|
||||
//
|
||||
// ProfileComboBox
|
||||
//
|
||||
this.ProfileComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.ProfileComboBox.FormattingEnabled = true;
|
||||
this.ProfileComboBox.Location = new System.Drawing.Point(120, 17);
|
||||
this.ProfileComboBox.Name = "ProfileComboBox";
|
||||
this.ProfileComboBox.Size = new System.Drawing.Size(239, 28);
|
||||
this.ProfileComboBox.TabIndex = 1;
|
||||
//
|
||||
// SecondaryTreeView
|
||||
//
|
||||
this.SecondaryTreeView.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.SecondaryTreeView.Location = new System.Drawing.Point(739, 294);
|
||||
this.SecondaryTreeView.Name = "SecondaryTreeView";
|
||||
this.tableLayoutPanel1.SetRowSpan(this.SecondaryTreeView, 2);
|
||||
this.SecondaryTreeView.Size = new System.Drawing.Size(362, 585);
|
||||
this.SecondaryTreeView.TabIndex = 2;
|
||||
//
|
||||
// SelectedFolderPanel
|
||||
//
|
||||
this.tableLayoutPanel1.SetColumnSpan(this.SelectedFolderPanel, 2);
|
||||
this.SelectedFolderPanel.Controls.Add(this.ActiveFolderGroupBox);
|
||||
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, 285);
|
||||
this.SelectedFolderPanel.TabIndex = 3;
|
||||
//
|
||||
// ActiveFolderGroupBox
|
||||
//
|
||||
this.ActiveFolderGroupBox.Controls.Add(this.SelectedFolderComboBox);
|
||||
this.ActiveFolderGroupBox.Controls.Add(this.FolderSelectButton);
|
||||
this.ActiveFolderGroupBox.Controls.Add(this.label2);
|
||||
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, 285);
|
||||
this.ActiveFolderGroupBox.TabIndex = 0;
|
||||
this.ActiveFolderGroupBox.TabStop = false;
|
||||
this.ActiveFolderGroupBox.Text = "Folder Options";
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(6, 20);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(145, 20);
|
||||
this.label2.TabIndex = 0;
|
||||
this.label2.Text = "Folder to Compare:";
|
||||
//
|
||||
// FolderSelectButton
|
||||
//
|
||||
this.FolderSelectButton.Location = new System.Drawing.Point(672, 14);
|
||||
this.FolderSelectButton.Name = "FolderSelectButton";
|
||||
this.FolderSelectButton.Size = new System.Drawing.Size(49, 32);
|
||||
this.FolderSelectButton.TabIndex = 2;
|
||||
this.FolderSelectButton.Text = "...";
|
||||
this.FolderSelectButton.UseVisualStyleBackColor = true;
|
||||
this.FolderSelectButton.Click += new System.EventHandler(this.FolderSelectButton_Click);
|
||||
//
|
||||
// label3
|
||||
//
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.Location = new System.Drawing.Point(10, 60);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(146, 20);
|
||||
this.label3.TabIndex = 2;
|
||||
this.label3.Text = "Select Root Folder:";
|
||||
//
|
||||
// SelectedFolderComboBox
|
||||
//
|
||||
this.SelectedFolderComboBox.FormattingEnabled = true;
|
||||
this.SelectedFolderComboBox.Location = new System.Drawing.Point(157, 16);
|
||||
this.SelectedFolderComboBox.Name = "SelectedFolderComboBox";
|
||||
this.SelectedFolderComboBox.Size = new System.Drawing.Size(509, 28);
|
||||
this.SelectedFolderComboBox.TabIndex = 3;
|
||||
//
|
||||
// RootFolderComboBox
|
||||
//
|
||||
this.RootFolderComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.RootFolderComboBox.FormattingEnabled = true;
|
||||
this.RootFolderComboBox.Location = new System.Drawing.Point(162, 57);
|
||||
this.RootFolderComboBox.Name = "RootFolderComboBox";
|
||||
this.RootFolderComboBox.Size = new System.Drawing.Size(197, 28);
|
||||
this.RootFolderComboBox.TabIndex = 3;
|
||||
//
|
||||
// FileViewer
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(1472, 906);
|
||||
this.Controls.Add(this.tableLayoutPanel1);
|
||||
this.Controls.Add(this.MainMenu);
|
||||
this.MainMenuStrip = this.MainMenu;
|
||||
this.Name = "FileViewer";
|
||||
this.Text = "File Viewer & Comparison";
|
||||
this.tableLayoutPanel1.ResumeLayout(false);
|
||||
this.PanelOne.ResumeLayout(false);
|
||||
this.PanelOne.PerformLayout();
|
||||
this.SelectedFolderPanel.ResumeLayout(false);
|
||||
this.ActiveFolderGroupBox.ResumeLayout(false);
|
||||
this.ActiveFolderGroupBox.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.MenuStrip MainMenu;
|
||||
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
|
||||
private System.Windows.Forms.TreeView PrimaryFilesTreeView;
|
||||
private System.Windows.Forms.Panel PanelOne;
|
||||
private System.Windows.Forms.ComboBox ProfileComboBox;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.TreeView SecondaryTreeView;
|
||||
private System.Windows.Forms.ComboBox RootFolderComboBox;
|
||||
private System.Windows.Forms.Label label3;
|
||||
private System.Windows.Forms.Panel SelectedFolderPanel;
|
||||
private System.Windows.Forms.GroupBox ActiveFolderGroupBox;
|
||||
private System.Windows.Forms.ComboBox SelectedFolderComboBox;
|
||||
private System.Windows.Forms.Button FolderSelectButton;
|
||||
private System.Windows.Forms.Label label2;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
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 FileViewer : Form
|
||||
{
|
||||
public FileViewer()
|
||||
{
|
||||
InitializeComponent();
|
||||
var db = new DB();
|
||||
|
||||
var profiles = db.GetProfiles();
|
||||
|
||||
if(profiles.Count == 0)
|
||||
{
|
||||
// insert
|
||||
var man = new ProfileManager();
|
||||
man.ShowDialog();
|
||||
}
|
||||
}
|
||||
|
||||
private void FolderSelectButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
var form = new ProfileManager();
|
||||
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="MainMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
</root>
|
||||
Generated
+28
-7
@@ -31,6 +31,8 @@
|
||||
this.MainMenu = new System.Windows.Forms.MenuStrip();
|
||||
this.FileMainMenu = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.MainLayoutPanel = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.ManageProfilesFileMainMenu = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.FileManagerFileMainMenu = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.MainMenu.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
@@ -42,14 +44,17 @@
|
||||
this.FileMainMenu});
|
||||
this.MainMenu.Location = new System.Drawing.Point(0, 0);
|
||||
this.MainMenu.Name = "MainMenu";
|
||||
this.MainMenu.Size = new System.Drawing.Size(800, 36);
|
||||
this.MainMenu.Size = new System.Drawing.Size(800, 33);
|
||||
this.MainMenu.TabIndex = 0;
|
||||
this.MainMenu.Text = "menuStrip1";
|
||||
//
|
||||
// FileMainMenu
|
||||
//
|
||||
this.FileMainMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.ManageProfilesFileMainMenu,
|
||||
this.FileManagerFileMainMenu});
|
||||
this.FileMainMenu.Name = "FileMainMenu";
|
||||
this.FileMainMenu.Size = new System.Drawing.Size(54, 32);
|
||||
this.FileMainMenu.Size = new System.Drawing.Size(54, 29);
|
||||
this.FileMainMenu.Text = "&File";
|
||||
//
|
||||
// MainLayoutPanel
|
||||
@@ -58,23 +63,37 @@
|
||||
this.MainLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
|
||||
this.MainLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
|
||||
this.MainLayoutPanel.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.MainLayoutPanel.Location = new System.Drawing.Point(0, 36);
|
||||
this.MainLayoutPanel.Location = new System.Drawing.Point(0, 33);
|
||||
this.MainLayoutPanel.Name = "MainLayoutPanel";
|
||||
this.MainLayoutPanel.RowCount = 2;
|
||||
this.MainLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
|
||||
this.MainLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
|
||||
this.MainLayoutPanel.Size = new System.Drawing.Size(800, 856);
|
||||
this.MainLayoutPanel.Size = new System.Drawing.Size(800, 791);
|
||||
this.MainLayoutPanel.TabIndex = 1;
|
||||
//
|
||||
// Form1
|
||||
// ManageProfilesFileMainMenu
|
||||
//
|
||||
this.ManageProfilesFileMainMenu.Name = "ManageProfilesFileMainMenu";
|
||||
this.ManageProfilesFileMainMenu.Size = new System.Drawing.Size(270, 34);
|
||||
this.ManageProfilesFileMainMenu.Text = "Manage &Profiles";
|
||||
this.ManageProfilesFileMainMenu.Click += new System.EventHandler(this.ManageProfilesFileMainMenu_Click);
|
||||
//
|
||||
// FileManagerFileMainMenu
|
||||
//
|
||||
this.FileManagerFileMainMenu.Name = "FileManagerFileMainMenu";
|
||||
this.FileManagerFileMainMenu.Size = new System.Drawing.Size(270, 34);
|
||||
this.FileManagerFileMainMenu.Text = "&File Manager";
|
||||
this.FileManagerFileMainMenu.Click += new System.EventHandler(this.FileManagerFileMainMenu_Click);
|
||||
//
|
||||
// MainForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(800, 892);
|
||||
this.ClientSize = new System.Drawing.Size(800, 824);
|
||||
this.Controls.Add(this.MainLayoutPanel);
|
||||
this.Controls.Add(this.MainMenu);
|
||||
this.MainMenuStrip = this.MainMenu;
|
||||
this.Name = "Form1";
|
||||
this.Name = "MainForm";
|
||||
this.Text = "Form1";
|
||||
this.MainMenu.ResumeLayout(false);
|
||||
this.MainMenu.PerformLayout();
|
||||
@@ -88,6 +107,8 @@
|
||||
private System.Windows.Forms.MenuStrip MainMenu;
|
||||
private System.Windows.Forms.ToolStripMenuItem FileMainMenu;
|
||||
private System.Windows.Forms.TableLayoutPanel MainLayoutPanel;
|
||||
private System.Windows.Forms.ToolStripMenuItem ManageProfilesFileMainMenu;
|
||||
private System.Windows.Forms.ToolStripMenuItem FileManagerFileMainMenu;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,5 +16,17 @@ namespace DataOrganizer
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void ManageProfilesFileMainMenu_Click(object sender, EventArgs e)
|
||||
{
|
||||
var form = new ProfileManager();
|
||||
form.ShowDialog();
|
||||
}
|
||||
|
||||
private void FileManagerFileMainMenu_Click(object sender, EventArgs e)
|
||||
{
|
||||
var form = new FileViewer();
|
||||
form.ShowDialog();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Generated
+252
@@ -0,0 +1,252 @@
|
||||
namespace DataOrganizer
|
||||
{
|
||||
partial class ProfileManager
|
||||
{
|
||||
/// <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.MainPanel = new System.Windows.Forms.Panel();
|
||||
this.ProfilesComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.ProfileInfoPanel = new System.Windows.Forms.Panel();
|
||||
this.ProfileInfoGroupBox = new System.Windows.Forms.GroupBox();
|
||||
this.MachineNameTextBox = new System.Windows.Forms.TextBox();
|
||||
this.label4 = new System.Windows.Forms.Label();
|
||||
this.ProfileNameTextBox = new System.Windows.Forms.TextBox();
|
||||
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.DeleteProfileButton = new System.Windows.Forms.Button();
|
||||
this.MainLayoutPanel.SuspendLayout();
|
||||
this.MainPanel.SuspendLayout();
|
||||
this.ProfileInfoPanel.SuspendLayout();
|
||||
this.ProfileInfoGroupBox.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// MainLayoutPanel
|
||||
//
|
||||
this.MainLayoutPanel.ColumnCount = 1;
|
||||
this.MainLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
|
||||
this.MainLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F));
|
||||
this.MainLayoutPanel.Controls.Add(this.MainPanel, 0, 0);
|
||||
this.MainLayoutPanel.Controls.Add(this.ProfileInfoPanel, 0, 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 = 2;
|
||||
this.MainLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 25F));
|
||||
this.MainLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 75F));
|
||||
this.MainLayoutPanel.Size = new System.Drawing.Size(718, 383);
|
||||
this.MainLayoutPanel.TabIndex = 0;
|
||||
//
|
||||
// MainPanel
|
||||
//
|
||||
this.MainPanel.Controls.Add(this.ProfilesComboBox);
|
||||
this.MainPanel.Controls.Add(this.label3);
|
||||
this.MainPanel.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.MainPanel.Location = new System.Drawing.Point(3, 3);
|
||||
this.MainPanel.Name = "MainPanel";
|
||||
this.MainPanel.Size = new System.Drawing.Size(712, 89);
|
||||
this.MainPanel.TabIndex = 0;
|
||||
//
|
||||
// ProfilesComboBox
|
||||
//
|
||||
this.ProfilesComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.ProfilesComboBox.FormattingEnabled = true;
|
||||
this.ProfilesComboBox.Location = new System.Drawing.Point(190, 24);
|
||||
this.ProfilesComboBox.Name = "ProfilesComboBox";
|
||||
this.ProfilesComboBox.Size = new System.Drawing.Size(311, 28);
|
||||
this.ProfilesComboBox.TabIndex = 0;
|
||||
//
|
||||
// label3
|
||||
//
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.Location = new System.Drawing.Point(19, 24);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(65, 20);
|
||||
this.label3.TabIndex = 7;
|
||||
this.label3.Text = "Profiles:";
|
||||
//
|
||||
// ProfileInfoPanel
|
||||
//
|
||||
this.ProfileInfoPanel.Controls.Add(this.ProfileInfoGroupBox);
|
||||
this.ProfileInfoPanel.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.ProfileInfoPanel.Location = new System.Drawing.Point(3, 98);
|
||||
this.ProfileInfoPanel.Name = "ProfileInfoPanel";
|
||||
this.ProfileInfoPanel.Size = new System.Drawing.Size(712, 282);
|
||||
this.ProfileInfoPanel.TabIndex = 1;
|
||||
//
|
||||
// ProfileInfoGroupBox
|
||||
//
|
||||
this.ProfileInfoGroupBox.Controls.Add(this.DeleteProfileButton);
|
||||
this.ProfileInfoGroupBox.Controls.Add(this.MachineNameTextBox);
|
||||
this.ProfileInfoGroupBox.Controls.Add(this.label4);
|
||||
this.ProfileInfoGroupBox.Controls.Add(this.ProfileNameTextBox);
|
||||
this.ProfileInfoGroupBox.Controls.Add(this.MachineNameLabel);
|
||||
this.ProfileInfoGroupBox.Controls.Add(this.AddOrUpdateProfileButton);
|
||||
this.ProfileInfoGroupBox.Controls.Add(this.label1);
|
||||
this.ProfileInfoGroupBox.Controls.Add(this.SelectNewContentLocationButton);
|
||||
this.ProfileInfoGroupBox.Controls.Add(this.label2);
|
||||
this.ProfileInfoGroupBox.Controls.Add(this.NewContentLocationTextBox);
|
||||
this.ProfileInfoGroupBox.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.ProfileInfoGroupBox.Location = new System.Drawing.Point(0, 0);
|
||||
this.ProfileInfoGroupBox.Name = "ProfileInfoGroupBox";
|
||||
this.ProfileInfoGroupBox.Size = new System.Drawing.Size(712, 282);
|
||||
this.ProfileInfoGroupBox.TabIndex = 0;
|
||||
this.ProfileInfoGroupBox.TabStop = false;
|
||||
this.ProfileInfoGroupBox.Text = "Profile Information";
|
||||
//
|
||||
// MachineNameTextBox
|
||||
//
|
||||
this.MachineNameTextBox.Location = new System.Drawing.Point(190, 127);
|
||||
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(17, 130);
|
||||
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(190, 41);
|
||||
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(17, 178);
|
||||
this.MachineNameLabel.Name = "MachineNameLabel";
|
||||
this.MachineNameLabel.Size = new System.Drawing.Size(472, 20);
|
||||
this.MachineNameLabel.TabIndex = 5;
|
||||
this.MachineNameLabel.Text = "This prfile will be automatically loaded when ran on the machine ....";
|
||||
//
|
||||
// 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(625, 233);
|
||||
this.AddOrUpdateProfileButton.Name = "AddOrUpdateProfileButton";
|
||||
this.AddOrUpdateProfileButton.Size = new System.Drawing.Size(81, 40);
|
||||
this.AddOrUpdateProfileButton.TabIndex = 5;
|
||||
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(17, 44);
|
||||
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(507, 82);
|
||||
this.SelectNewContentLocationButton.Name = "SelectNewContentLocationButton";
|
||||
this.SelectNewContentLocationButton.Size = new System.Drawing.Size(50, 30);
|
||||
this.SelectNewContentLocationButton.TabIndex = 3;
|
||||
this.SelectNewContentLocationButton.Text = "...";
|
||||
this.SelectNewContentLocationButton.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(17, 85);
|
||||
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(190, 82);
|
||||
this.NewContentLocationTextBox.Name = "NewContentLocationTextBox";
|
||||
this.NewContentLocationTextBox.Size = new System.Drawing.Size(311, 26);
|
||||
this.NewContentLocationTextBox.TabIndex = 2;
|
||||
//
|
||||
// DeleteProfileButton
|
||||
//
|
||||
this.DeleteProfileButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.DeleteProfileButton.Enabled = false;
|
||||
this.DeleteProfileButton.Location = new System.Drawing.Point(9, 233);
|
||||
this.DeleteProfileButton.Name = "DeleteProfileButton";
|
||||
this.DeleteProfileButton.Size = new System.Drawing.Size(75, 40);
|
||||
this.DeleteProfileButton.TabIndex = 8;
|
||||
this.DeleteProfileButton.Text = "Delete";
|
||||
this.DeleteProfileButton.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// ProfileManager
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(718, 383);
|
||||
this.Controls.Add(this.MainLayoutPanel);
|
||||
this.MaximizeBox = false;
|
||||
this.Name = "ProfileManager";
|
||||
this.Text = "ProfileManager";
|
||||
this.MainLayoutPanel.ResumeLayout(false);
|
||||
this.MainPanel.ResumeLayout(false);
|
||||
this.MainPanel.PerformLayout();
|
||||
this.ProfileInfoPanel.ResumeLayout(false);
|
||||
this.ProfileInfoGroupBox.ResumeLayout(false);
|
||||
this.ProfileInfoGroupBox.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.TableLayoutPanel MainLayoutPanel;
|
||||
private System.Windows.Forms.Panel MainPanel;
|
||||
private System.Windows.Forms.ComboBox ProfilesComboBox;
|
||||
private System.Windows.Forms.Label label3;
|
||||
private System.Windows.Forms.Panel ProfileInfoPanel;
|
||||
private System.Windows.Forms.GroupBox ProfileInfoGroupBox;
|
||||
private System.Windows.Forms.TextBox ProfileNameTextBox;
|
||||
private System.Windows.Forms.Label MachineNameLabel;
|
||||
private System.Windows.Forms.Button AddOrUpdateProfileButton;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.Button SelectNewContentLocationButton;
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.TextBox NewContentLocationTextBox;
|
||||
private System.Windows.Forms.TextBox MachineNameTextBox;
|
||||
private System.Windows.Forms.Label label4;
|
||||
private System.Windows.Forms.Button DeleteProfileButton;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,126 @@
|
||||
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 ProfileManager : Form
|
||||
{
|
||||
private string MachineNameLabelText { get; } = "The Machine Name property determines what\r\nprofile will be loaded automatically (Currently: '{0}').";
|
||||
private bool IsUpdating { get; set; }
|
||||
|
||||
public ProfileManager()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
ProfilesComboBox.SelectedIndexChanged += ProfilesComboBox_SelectedIndexChanged;
|
||||
ProfileNameTextBox.TextChanged += ToggleAddOrUpdateButton;
|
||||
NewContentLocationTextBox.TextChanged += ToggleAddOrUpdateButton;
|
||||
MachineNameTextBox.TextChanged += MachineNameTextBox_TextChanged;
|
||||
|
||||
UpdateProfileComboBox();
|
||||
}
|
||||
|
||||
private void MachineNameTextBox_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (MachineNameTextBox.Text.Length > 0)
|
||||
MachineNameLabel.Text = string.Format(MachineNameLabelText, MachineNameTextBox.Text);
|
||||
else
|
||||
MachineNameLabel.Text = string.Format(MachineNameLabelText, Environment.MachineName);
|
||||
}
|
||||
|
||||
private void ToggleAddOrUpdateButton(object sender, EventArgs e)
|
||||
{
|
||||
if (ProfileNameTextBox.Text != string.Empty && NewContentLocationTextBox.Text != string.Empty)
|
||||
AddOrUpdateProfileButton.Enabled = true;
|
||||
else
|
||||
AddOrUpdateProfileButton.Enabled = false;
|
||||
}
|
||||
|
||||
private void UpdateProfileComboBox()
|
||||
{
|
||||
var db = new DB();
|
||||
|
||||
var profiles = db.GetProfiles();
|
||||
ProfilesComboBox.Items.Clear();
|
||||
ProfilesComboBox.Tag = null;
|
||||
ProfilesComboBox.Items.Add("Add New Profile");
|
||||
ProfilesComboBox.SelectedIndex = 0;
|
||||
|
||||
if (profiles.Count == 0)
|
||||
{
|
||||
ProfilesComboBox.Enabled = false;
|
||||
return;
|
||||
}
|
||||
|
||||
ProfilesComboBox.Enabled = true;
|
||||
|
||||
foreach (var profile in profiles)
|
||||
{
|
||||
ProfilesComboBox.Items.Add(profile.Name);
|
||||
}
|
||||
|
||||
ProfilesComboBox.Tag = profiles;
|
||||
}
|
||||
|
||||
private void AddOrUpdateProfileButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
var machineName = Environment.MachineName;
|
||||
var db = new DB();
|
||||
|
||||
if(!string.IsNullOrWhiteSpace(MachineNameTextBox.Text))
|
||||
{
|
||||
machineName = MachineNameTextBox.Text;
|
||||
}
|
||||
|
||||
if (!IsUpdating)
|
||||
{
|
||||
db.InsertNewProfile(new DB.Profile { Name = ProfileNameTextBox.Text, DefaultNewContentFolder = NewContentLocationTextBox.Text, MachineName = machineName });
|
||||
|
||||
UpdateProfileComboBox();
|
||||
}
|
||||
else
|
||||
{
|
||||
var profile = ((List<DB.Profile>)ProfilesComboBox.Tag)[ProfilesComboBox.SelectedIndex - 1];
|
||||
profile.Name = ProfileNameTextBox.Text;
|
||||
profile.DefaultNewContentFolder = NewContentLocationTextBox.Text;
|
||||
profile.MachineName = MachineNameTextBox.Text;
|
||||
db.UpdateProfile(profile);
|
||||
}
|
||||
|
||||
UpdateProfileComboBox();
|
||||
}
|
||||
|
||||
private void ProfilesComboBox_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (ProfilesComboBox.SelectedIndex == 0)
|
||||
{
|
||||
ProfileNameTextBox.Text = string.Empty;
|
||||
NewContentLocationTextBox.Text = string.Empty;
|
||||
MachineNameTextBox.Text = string.Empty;
|
||||
AddOrUpdateProfileButton.Text = "Add";
|
||||
AddOrUpdateProfileButton.Enabled = false;
|
||||
MachineNameLabel.Text = string.Format(MachineNameLabelText, Environment.MachineName);
|
||||
IsUpdating = false;
|
||||
return;
|
||||
}
|
||||
|
||||
var profile = ((List<DB.Profile>)ProfilesComboBox.Tag)[ProfilesComboBox.SelectedIndex - 1];
|
||||
|
||||
ProfileNameTextBox.Text = profile.Name;
|
||||
NewContentLocationTextBox.Text = profile.DefaultNewContentFolder;
|
||||
MachineNameTextBox.Text = profile.MachineName;
|
||||
|
||||
MachineNameLabel.Text = string.Format(MachineNameLabelText, profile.MachineName);
|
||||
|
||||
AddOrUpdateProfileButton.Text = "Update";
|
||||
IsUpdating = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
<?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>
|
||||
</root>
|
||||
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Microsoft.Data.Sqlite" version="3.1.9" targetFramework="net472" />
|
||||
<package id="Microsoft.Data.Sqlite.Core" version="3.1.9" targetFramework="net472" />
|
||||
<package id="SQLitePCLRaw.bundle_e_sqlite3" version="2.0.2" targetFramework="net472" />
|
||||
<package id="SQLitePCLRaw.core" version="2.0.2" targetFramework="net472" />
|
||||
<package id="SQLitePCLRaw.lib.e_sqlite3" version="2.0.2" targetFramework="net472" />
|
||||
<package id="SQLitePCLRaw.provider.dynamic_cdecl" version="2.0.2" targetFramework="net472" />
|
||||
<package id="System.Buffers" version="4.4.0" targetFramework="net472" />
|
||||
<package id="System.Memory" version="4.5.3" targetFramework="net472" />
|
||||
<package id="System.Numerics.Vectors" version="4.4.0" targetFramework="net472" />
|
||||
<package id="System.Runtime.CompilerServices.Unsafe" version="4.5.2" targetFramework="net472" />
|
||||
</packages>
|
||||
Reference in New Issue
Block a user