diff --git a/BackupHelper/BackupHelper.csproj b/BackupHelper/BackupHelper.csproj index 1bb8ad4..71a83d6 100644 --- a/BackupHelper/BackupHelper.csproj +++ b/BackupHelper/BackupHelper.csproj @@ -57,13 +57,13 @@ true - - ..\packages\FileControlUtility.1.0.1\lib\netstandard2.0\FileControlUtility.dll + + ..\packages\FileControlUtility.1.1.0\lib\netstandard2.0\FileControlUtility.dll - - ..\packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.113.3\lib\net46\System.Data.SQLite.dll + + ..\packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.115.5\lib\net46\System.Data.SQLite.dll @@ -85,11 +85,11 @@ FormCancelExecution.cs - + Form - - FormEditOption.cs + + FormEditOptions.cs Form @@ -128,11 +128,14 @@ GroupForm.cs - + + + FormEditOptions.cs + FormOptionsMenu.cs @@ -183,11 +186,11 @@ - + 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}. - + \ No newline at end of file diff --git a/BackupHelper/FileControlConsoleImpl.cs b/BackupHelper/FileControlConsoleImpl.cs index 2a441b1..b3e906a 100644 --- a/BackupHelper/FileControlConsoleImpl.cs +++ b/BackupHelper/FileControlConsoleImpl.cs @@ -1,5 +1,6 @@ using FileControlUtility; using System; +using System.IO; namespace BackupHelper { @@ -12,12 +13,13 @@ public FileControlConsoleImpl(bool showDialogs) this.showDialogs = showDialogs; } - public override void HandleCurrentFileExecution(string trimmedPathWithFileName) + protected override void HandleCurrentFileExecution(string trimmedPathWithFileName, FileInfo originFile, string destinyDir, TransferSettings settings) { - Console.WriteLine($"Transfering: {trimmedPathWithFileName}"); + //Console.WriteLine($"Transfering: {trimmedPathWithFileName}"); } - public override FileTransferErrorActionNonRepeatable HandleErrorDialogNonRepeatable(string errorMessage, Exception e, string originFile, string destinyFile) + protected override FileTransferErrorActionNonRepeatable HandleTransferErrorNonRepeatable(string errorMessage, Exception e, FileInfo originFile, + string destinyDir, TransferSettings settings) { if (!showDialogs) return FileTransferErrorActionNonRepeatable.JUMP; @@ -26,7 +28,8 @@ public override FileTransferErrorActionNonRepeatable HandleErrorDialogNonRepeata return (FileTransferErrorActionNonRepeatable)form.Result; } - public override FileTransferErrorActionRepeatable HandleErrorDialogRepeatable(string errorMessage, Exception e, string originFile, string destinyFile) + protected override FileTransferErrorActionRepeatable HandleTransferErrorRepeatable(string errorMessage, Exception e, FileInfo originFile, + string destinyDir, TransferSettings settings) { if (!showDialogs) return FileTransferErrorActionRepeatable.JUMP; @@ -35,7 +38,7 @@ public override FileTransferErrorActionRepeatable HandleErrorDialogRepeatable(st return (FileTransferErrorActionRepeatable)form.Result; } - public override void HandleLogMessage(string logMessage) + protected override void HandleLogMessage(string logMessage) { LogManager.WriteLine(logMessage); } diff --git a/BackupHelper/FileControlImpl.cs b/BackupHelper/FileControlImpl.cs index af25c64..ff2e6b7 100644 --- a/BackupHelper/FileControlImpl.cs +++ b/BackupHelper/FileControlImpl.cs @@ -1,5 +1,6 @@ using FileControlUtility; using System; +using System.IO; namespace BackupHelper { @@ -12,7 +13,7 @@ public FileControlImpl(FormOptionsMenu menu) Menu = menu; } - public override void HandleCurrentFileExecution(string trimmedPathWithFileName) + protected override void HandleCurrentFileExecution(string trimmedPathWithFileName, FileInfo originFile, string destinyDir, TransferSettings settings) { if (trimmedPathWithFileName.Length > 100) trimmedPathWithFileName = $"...{trimmedPathWithFileName.Substring(trimmedPathWithFileName.Length - 100)}"; @@ -20,21 +21,23 @@ public override void HandleCurrentFileExecution(string trimmedPathWithFileName) Menu.ShowCurrentFileExecution(trimmedPathWithFileName); } - public override FileTransferErrorActionNonRepeatable HandleErrorDialogNonRepeatable(string errorMessage, Exception e, string originFile, string destinyFile) + protected override FileTransferErrorActionNonRepeatable HandleTransferErrorNonRepeatable(string errorMessage, Exception e, FileInfo originFile, + string destinyDir, TransferSettings settings) { FormErrorDialog form = new FormErrorDialog(typeof(FileTransferErrorActionNonRepeatable), errorMessage); form.ShowDialog(); return (FileTransferErrorActionNonRepeatable)form.Result; } - public override FileTransferErrorActionRepeatable HandleErrorDialogRepeatable(string errorMessage, Exception e, string originFile, string destinyFile) + protected override FileTransferErrorActionRepeatable HandleTransferErrorRepeatable(string errorMessage, Exception e, FileInfo originFile, + string destinyDir, TransferSettings settings) { FormErrorDialog form = new FormErrorDialog(typeof(FileTransferErrorActionRepeatable), errorMessage); form.ShowDialog(); return (FileTransferErrorActionRepeatable)form.Result; } - public override void HandleLogMessage(string logMessage) + protected override void HandleLogMessage(string logMessage) { LogManager.WriteLine(logMessage); } diff --git a/BackupHelper/FormEditOption.Designer.cs b/BackupHelper/FormEditOptions.Designer.cs similarity index 70% rename from BackupHelper/FormEditOption.Designer.cs rename to BackupHelper/FormEditOptions.Designer.cs index 1f163a3..17076cc 100644 --- a/BackupHelper/FormEditOption.Designer.cs +++ b/BackupHelper/FormEditOptions.Designer.cs @@ -1,6 +1,6 @@ namespace BackupHelper { - partial class FormEditOption + partial class FormEditOptions { /// /// Required designer variable. @@ -29,6 +29,7 @@ protected override void Dispose(bool disposing) private void InitializeComponent() { this.components = new System.ComponentModel.Container(); + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormEditOptions)); this.checkBoxKeepOriginFiles = new System.Windows.Forms.CheckBox(); this.checkBoxMoveSubfolders = new System.Windows.Forms.CheckBox(); this.comboBoxMethod = new System.Windows.Forms.ComboBox(); @@ -57,15 +58,21 @@ private void InitializeComponent() this.labelCleanDestinyHelp = new System.Windows.Forms.Label(); this.labelDeleteUncommonFilesHelp = new System.Windows.Forms.Label(); this.toolTipHelp = new System.Windows.Forms.ToolTip(this.components); + this.labelReenumerateHelp = new System.Windows.Forms.Label(); + this.checkBoxReenumerate = new System.Windows.Forms.CheckBox(); + this.numericUpDownMaxKeptRenamedFileCount = new System.Windows.Forms.NumericUpDown(); + this.labelMaxKeptRenamedFileCount = new System.Windows.Forms.Label(); this.panelManageExtensions.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownMaxKeptRenamedFileCount)).BeginInit(); this.SuspendLayout(); // // checkBoxKeepOriginFiles // + this.checkBoxKeepOriginFiles.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.checkBoxKeepOriginFiles.AutoSize = true; this.checkBoxKeepOriginFiles.Checked = true; this.checkBoxKeepOriginFiles.CheckState = System.Windows.Forms.CheckState.Checked; - this.checkBoxKeepOriginFiles.Location = new System.Drawing.Point(237, 137); + this.checkBoxKeepOriginFiles.Location = new System.Drawing.Point(260, 137); this.checkBoxKeepOriginFiles.Name = "checkBoxKeepOriginFiles"; this.checkBoxKeepOriginFiles.Size = new System.Drawing.Size(172, 17); this.checkBoxKeepOriginFiles.TabIndex = 6; @@ -74,10 +81,11 @@ private void InitializeComponent() // // checkBoxMoveSubfolders // + this.checkBoxMoveSubfolders.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.checkBoxMoveSubfolders.AutoSize = true; this.checkBoxMoveSubfolders.Checked = true; this.checkBoxMoveSubfolders.CheckState = System.Windows.Forms.CheckState.Checked; - this.checkBoxMoveSubfolders.Location = new System.Drawing.Point(237, 119); + this.checkBoxMoveSubfolders.Location = new System.Drawing.Point(260, 119); this.checkBoxMoveSubfolders.Name = "checkBoxMoveSubfolders"; this.checkBoxMoveSubfolders.Size = new System.Drawing.Size(112, 17); this.checkBoxMoveSubfolders.TabIndex = 5; @@ -86,40 +94,40 @@ private void InitializeComponent() // // comboBoxMethod // - this.comboBoxMethod.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left))); + this.comboBoxMethod.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.comboBoxMethod.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed; this.comboBoxMethod.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.comboBoxMethod.FormattingEnabled = true; - this.comboBoxMethod.Location = new System.Drawing.Point(237, 222); + this.comboBoxMethod.Location = new System.Drawing.Point(260, 222); this.comboBoxMethod.Name = "comboBoxMethod"; - this.comboBoxMethod.Size = new System.Drawing.Size(301, 21); + this.comboBoxMethod.Size = new System.Drawing.Size(369, 21); this.comboBoxMethod.TabIndex = 9; this.comboBoxMethod.DrawItem += new System.Windows.Forms.DrawItemEventHandler(this.ComboBoxMethod_DrawItem); this.comboBoxMethod.SelectedIndexChanged += new System.EventHandler(this.ComboBoxMethod_SelectedIndexChanged); // // textBoxDestinyPath // - this.textBoxDestinyPath.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left))); + this.textBoxDestinyPath.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); this.textBoxDestinyPath.Location = new System.Drawing.Point(15, 76); this.textBoxDestinyPath.Name = "textBoxDestinyPath"; - this.textBoxDestinyPath.Size = new System.Drawing.Size(486, 20); + this.textBoxDestinyPath.Size = new System.Drawing.Size(577, 20); this.textBoxDestinyPath.TabIndex = 3; // // textBoxSourcePath // - this.textBoxSourcePath.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left))); + this.textBoxSourcePath.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); this.textBoxSourcePath.Location = new System.Drawing.Point(15, 29); this.textBoxSourcePath.Name = "textBoxSourcePath"; - this.textBoxSourcePath.Size = new System.Drawing.Size(486, 20); + this.textBoxSourcePath.Size = new System.Drawing.Size(577, 20); this.textBoxSourcePath.TabIndex = 1; // // labelMethod // + this.labelMethod.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.labelMethod.AutoSize = true; - this.labelMethod.Location = new System.Drawing.Point(234, 206); + this.labelMethod.Location = new System.Drawing.Point(257, 206); this.labelMethod.Name = "labelMethod"; this.labelMethod.Size = new System.Drawing.Size(225, 13); this.labelMethod.TabIndex = 14; @@ -145,10 +153,11 @@ private void InitializeComponent() // // buttonAddSource // + this.buttonAddSource.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.buttonAddSource.BackColor = System.Drawing.SystemColors.ControlLight; this.buttonAddSource.Cursor = System.Windows.Forms.Cursors.Cross; this.buttonAddSource.Font = new System.Drawing.Font("Microsoft Sans Serif", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.buttonAddSource.Location = new System.Drawing.Point(500, 26); + this.buttonAddSource.Location = new System.Drawing.Point(591, 26); this.buttonAddSource.Name = "buttonAddSource"; this.buttonAddSource.Size = new System.Drawing.Size(42, 25); this.buttonAddSource.TabIndex = 2; @@ -158,10 +167,11 @@ private void InitializeComponent() // // buttonAddDestiny // + this.buttonAddDestiny.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.buttonAddDestiny.BackColor = System.Drawing.SystemColors.ControlLight; this.buttonAddDestiny.Cursor = System.Windows.Forms.Cursors.Cross; this.buttonAddDestiny.Font = new System.Drawing.Font("Microsoft Sans Serif", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.buttonAddDestiny.Location = new System.Drawing.Point(500, 73); + this.buttonAddDestiny.Location = new System.Drawing.Point(591, 73); this.buttonAddDestiny.Name = "buttonAddDestiny"; this.buttonAddDestiny.Size = new System.Drawing.Size(42, 25); this.buttonAddDestiny.TabIndex = 4; @@ -171,11 +181,11 @@ private void InitializeComponent() // // buttonDoneEdit // - this.buttonDoneEdit.Anchor = System.Windows.Forms.AnchorStyles.Left; + this.buttonDoneEdit.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.buttonDoneEdit.FlatAppearance.BorderColor = System.Drawing.Color.Black; - this.buttonDoneEdit.Location = new System.Drawing.Point(237, 260); + this.buttonDoneEdit.Location = new System.Drawing.Point(527, 269); this.buttonDoneEdit.Name = "buttonDoneEdit"; - this.buttonDoneEdit.Size = new System.Drawing.Size(121, 36); + this.buttonDoneEdit.Size = new System.Drawing.Size(103, 36); this.buttonDoneEdit.TabIndex = 10; this.buttonDoneEdit.Text = "Done"; this.buttonDoneEdit.UseVisualStyleBackColor = true; @@ -183,8 +193,9 @@ private void InitializeComponent() // // checkBoxCleanDestinyDirectory // + this.checkBoxCleanDestinyDirectory.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.checkBoxCleanDestinyDirectory.AutoSize = true; - this.checkBoxCleanDestinyDirectory.Location = new System.Drawing.Point(237, 155); + this.checkBoxCleanDestinyDirectory.Location = new System.Drawing.Point(260, 155); this.checkBoxCleanDestinyDirectory.Name = "checkBoxCleanDestinyDirectory"; this.checkBoxCleanDestinyDirectory.Size = new System.Drawing.Size(151, 17); this.checkBoxCleanDestinyDirectory.TabIndex = 7; @@ -194,8 +205,9 @@ private void InitializeComponent() // // buttonSwitchPaths // + this.buttonSwitchPaths.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.buttonSwitchPaths.ForeColor = System.Drawing.SystemColors.ControlDarkDark; - this.buttonSwitchPaths.Location = new System.Drawing.Point(367, 52); + this.buttonSwitchPaths.Location = new System.Drawing.Point(458, 52); this.buttonSwitchPaths.Name = "buttonSwitchPaths"; this.buttonSwitchPaths.Size = new System.Drawing.Size(101, 21); this.buttonSwitchPaths.TabIndex = 3; @@ -205,9 +217,10 @@ private void InitializeComponent() // // checkBoxManageFileNamesAndExtensions // - this.checkBoxManageFileNamesAndExtensions.Anchor = System.Windows.Forms.AnchorStyles.None; + this.checkBoxManageFileNamesAndExtensions.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); this.checkBoxManageFileNamesAndExtensions.AutoSize = true; - this.checkBoxManageFileNamesAndExtensions.Location = new System.Drawing.Point(17, 5); + this.checkBoxManageFileNamesAndExtensions.Location = new System.Drawing.Point(13, 8); this.checkBoxManageFileNamesAndExtensions.Name = "checkBoxManageFileNamesAndExtensions"; this.checkBoxManageFileNamesAndExtensions.Size = new System.Drawing.Size(167, 17); this.checkBoxManageFileNamesAndExtensions.TabIndex = 11; @@ -217,7 +230,9 @@ private void InitializeComponent() // // listViewFileNamesAndExtensions // - this.listViewFileNamesAndExtensions.Anchor = System.Windows.Forms.AnchorStyles.Bottom; + this.listViewFileNamesAndExtensions.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); this.listViewFileNamesAndExtensions.BackColor = System.Drawing.SystemColors.Window; this.listViewFileNamesAndExtensions.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { this.columnHeaderFileOrExtension}); @@ -225,11 +240,11 @@ private void InitializeComponent() this.listViewFileNamesAndExtensions.ForeColor = System.Drawing.SystemColors.InactiveCaption; this.listViewFileNamesAndExtensions.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable; this.listViewFileNamesAndExtensions.HideSelection = false; - this.listViewFileNamesAndExtensions.Location = new System.Drawing.Point(16, 47); + this.listViewFileNamesAndExtensions.Location = new System.Drawing.Point(12, 53); this.listViewFileNamesAndExtensions.MultiSelect = false; this.listViewFileNamesAndExtensions.Name = "listViewFileNamesAndExtensions"; this.listViewFileNamesAndExtensions.ShowItemToolTips = true; - this.listViewFileNamesAndExtensions.Size = new System.Drawing.Size(169, 105); + this.listViewFileNamesAndExtensions.Size = new System.Drawing.Size(223, 120); this.listViewFileNamesAndExtensions.TabIndex = 9; this.listViewFileNamesAndExtensions.UseCompatibleStateImageBehavior = false; this.listViewFileNamesAndExtensions.View = System.Windows.Forms.View.Details; @@ -238,10 +253,13 @@ private void InitializeComponent() // columnHeaderFileOrExtension // this.columnHeaderFileOrExtension.Text = "File or extension"; - this.columnHeaderFileOrExtension.Width = 165; + this.columnHeaderFileOrExtension.Width = 205; // // panelManageExtensions // + this.panelManageExtensions.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); this.panelManageExtensions.Controls.Add(this.textBoxFileNameOrExtension); this.panelManageExtensions.Controls.Add(this.radioButtonIgnore); this.panelManageExtensions.Controls.Add(this.checkBoxManageFileNamesAndExtensions); @@ -249,27 +267,30 @@ private void InitializeComponent() this.panelManageExtensions.Controls.Add(this.buttonRemoveFileOrExtension); this.panelManageExtensions.Controls.Add(this.buttonAddFileOrExtension); this.panelManageExtensions.Controls.Add(this.listViewFileNamesAndExtensions); - this.panelManageExtensions.Location = new System.Drawing.Point(15, 112); + this.panelManageExtensions.Location = new System.Drawing.Point(6, 104); this.panelManageExtensions.Name = "panelManageExtensions"; - this.panelManageExtensions.Size = new System.Drawing.Size(202, 186); + this.panelManageExtensions.Size = new System.Drawing.Size(248, 207); this.panelManageExtensions.TabIndex = 28; // // textBoxFileNameOrExtension // - this.textBoxFileNameOrExtension.Anchor = System.Windows.Forms.AnchorStyles.Bottom; + this.textBoxFileNameOrExtension.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); this.textBoxFileNameOrExtension.Enabled = false; - this.textBoxFileNameOrExtension.Location = new System.Drawing.Point(16, 158); + this.textBoxFileNameOrExtension.Location = new System.Drawing.Point(12, 179); this.textBoxFileNameOrExtension.Name = "textBoxFileNameOrExtension"; - this.textBoxFileNameOrExtension.Size = new System.Drawing.Size(91, 20); + this.textBoxFileNameOrExtension.Size = new System.Drawing.Size(144, 20); this.textBoxFileNameOrExtension.TabIndex = 14; this.textBoxFileNameOrExtension.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.TextBoxExtension_KeyPress); // // radioButtonIgnore // - this.radioButtonIgnore.Anchor = System.Windows.Forms.AnchorStyles.Bottom; + this.radioButtonIgnore.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); this.radioButtonIgnore.AutoSize = true; this.radioButtonIgnore.Enabled = false; - this.radioButtonIgnore.Location = new System.Drawing.Point(109, 24); + this.radioButtonIgnore.Location = new System.Drawing.Point(105, 30); this.radioButtonIgnore.Name = "radioButtonIgnore"; this.radioButtonIgnore.Size = new System.Drawing.Size(55, 17); this.radioButtonIgnore.TabIndex = 13; @@ -278,11 +299,12 @@ private void InitializeComponent() // // radioButtonAllowOnly // - this.radioButtonAllowOnly.Anchor = System.Windows.Forms.AnchorStyles.Bottom; + this.radioButtonAllowOnly.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); this.radioButtonAllowOnly.AutoSize = true; this.radioButtonAllowOnly.Checked = true; this.radioButtonAllowOnly.Enabled = false; - this.radioButtonAllowOnly.Location = new System.Drawing.Point(31, 24); + this.radioButtonAllowOnly.Location = new System.Drawing.Point(27, 30); this.radioButtonAllowOnly.Name = "radioButtonAllowOnly"; this.radioButtonAllowOnly.Size = new System.Drawing.Size(74, 17); this.radioButtonAllowOnly.TabIndex = 12; @@ -292,9 +314,11 @@ private void InitializeComponent() // // buttonRemoveFileOrExtension // - this.buttonRemoveFileOrExtension.Anchor = System.Windows.Forms.AnchorStyles.Bottom; + this.buttonRemoveFileOrExtension.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); this.buttonRemoveFileOrExtension.Enabled = false; - this.buttonRemoveFileOrExtension.Location = new System.Drawing.Point(148, 157); + this.buttonRemoveFileOrExtension.Location = new System.Drawing.Point(197, 178); this.buttonRemoveFileOrExtension.Name = "buttonRemoveFileOrExtension"; this.buttonRemoveFileOrExtension.Size = new System.Drawing.Size(38, 22); this.buttonRemoveFileOrExtension.TabIndex = 16; @@ -304,9 +328,11 @@ private void InitializeComponent() // // buttonAddFileOrExtension // - this.buttonAddFileOrExtension.Anchor = System.Windows.Forms.AnchorStyles.Bottom; + this.buttonAddFileOrExtension.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); this.buttonAddFileOrExtension.Enabled = false; - this.buttonAddFileOrExtension.Location = new System.Drawing.Point(109, 157); + this.buttonAddFileOrExtension.Location = new System.Drawing.Point(158, 178); this.buttonAddFileOrExtension.Name = "buttonAddFileOrExtension"; this.buttonAddFileOrExtension.Size = new System.Drawing.Size(38, 22); this.buttonAddFileOrExtension.TabIndex = 15; @@ -316,9 +342,10 @@ private void InitializeComponent() // // checkBoxDeleteUncommonFiles // + this.checkBoxDeleteUncommonFiles.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.checkBoxDeleteUncommonFiles.AutoSize = true; this.checkBoxDeleteUncommonFiles.ForeColor = System.Drawing.SystemColors.ControlText; - this.checkBoxDeleteUncommonFiles.Location = new System.Drawing.Point(237, 173); + this.checkBoxDeleteUncommonFiles.Location = new System.Drawing.Point(260, 173); this.checkBoxDeleteUncommonFiles.Name = "checkBoxDeleteUncommonFiles"; this.checkBoxDeleteUncommonFiles.Size = new System.Drawing.Size(205, 17); this.checkBoxDeleteUncommonFiles.TabIndex = 8; @@ -328,55 +355,116 @@ private void InitializeComponent() // // labelKeepOriginFilesHelp // + this.labelKeepOriginFilesHelp.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.labelKeepOriginFilesHelp.AutoSize = true; this.labelKeepOriginFilesHelp.BackColor = System.Drawing.Color.Green; this.labelKeepOriginFilesHelp.Font = new System.Drawing.Font("Microsoft Sans Serif", 6.5F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.labelKeepOriginFilesHelp.ForeColor = System.Drawing.Color.White; - this.labelKeepOriginFilesHelp.Location = new System.Drawing.Point(406, 139); + this.labelKeepOriginFilesHelp.Location = new System.Drawing.Point(429, 139); this.labelKeepOriginFilesHelp.Name = "labelKeepOriginFilesHelp"; this.labelKeepOriginFilesHelp.Size = new System.Drawing.Size(11, 12); this.labelKeepOriginFilesHelp.TabIndex = 31; this.labelKeepOriginFilesHelp.Text = "?"; - this.toolTipHelp.SetToolTip(this.labelKeepOriginFilesHelp, "Origin files and directories will be copied instead of moved"); + this.toolTipHelp.SetToolTip(this.labelKeepOriginFilesHelp, "Origin files and directories will be copied instead of moved."); // // labelCleanDestinyHelp // + this.labelCleanDestinyHelp.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.labelCleanDestinyHelp.AutoSize = true; this.labelCleanDestinyHelp.BackColor = System.Drawing.Color.Green; this.labelCleanDestinyHelp.Font = new System.Drawing.Font("Microsoft Sans Serif", 6.5F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.labelCleanDestinyHelp.ForeColor = System.Drawing.Color.White; - this.labelCleanDestinyHelp.Location = new System.Drawing.Point(385, 157); + this.labelCleanDestinyHelp.Location = new System.Drawing.Point(408, 157); this.labelCleanDestinyHelp.Name = "labelCleanDestinyHelp"; this.labelCleanDestinyHelp.Size = new System.Drawing.Size(11, 12); this.labelCleanDestinyHelp.TabIndex = 32; this.labelCleanDestinyHelp.Text = "?"; - this.toolTipHelp.SetToolTip(this.labelCleanDestinyHelp, "All destiny files and directories will be deleted before transfering"); + this.toolTipHelp.SetToolTip(this.labelCleanDestinyHelp, "All destiny files and directories will be deleted before transfering."); // // labelDeleteUncommonFilesHelp // + this.labelDeleteUncommonFilesHelp.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.labelDeleteUncommonFilesHelp.AutoSize = true; this.labelDeleteUncommonFilesHelp.BackColor = System.Drawing.Color.Green; this.labelDeleteUncommonFilesHelp.Font = new System.Drawing.Font("Microsoft Sans Serif", 6.5F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.labelDeleteUncommonFilesHelp.ForeColor = System.Drawing.Color.White; - this.labelDeleteUncommonFilesHelp.Location = new System.Drawing.Point(439, 175); + this.labelDeleteUncommonFilesHelp.Location = new System.Drawing.Point(462, 175); this.labelDeleteUncommonFilesHelp.Name = "labelDeleteUncommonFilesHelp"; this.labelDeleteUncommonFilesHelp.Size = new System.Drawing.Size(11, 12); this.labelDeleteUncommonFilesHelp.TabIndex = 33; this.labelDeleteUncommonFilesHelp.Text = "?"; this.toolTipHelp.SetToolTip(this.labelDeleteUncommonFilesHelp, "Delete files and directories present in the destiny directory that aren\'t present" + - " in the origin directory"); + " in the origin directory."); // // toolTipHelp // - this.toolTipHelp.AutoPopDelay = 10000; + this.toolTipHelp.AutomaticDelay = 40000; + this.toolTipHelp.AutoPopDelay = 30000; this.toolTipHelp.InitialDelay = 500; this.toolTipHelp.ReshowDelay = 100; // - // FormEditOption + // labelReenumerateHelp + // + this.labelReenumerateHelp.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.labelReenumerateHelp.AutoSize = true; + this.labelReenumerateHelp.BackColor = System.Drawing.Color.Green; + this.labelReenumerateHelp.Font = new System.Drawing.Font("Microsoft Sans Serif", 6.5F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.labelReenumerateHelp.ForeColor = System.Drawing.Color.White; + this.labelReenumerateHelp.Location = new System.Drawing.Point(427, 264); + this.labelReenumerateHelp.Name = "labelReenumerateHelp"; + this.labelReenumerateHelp.Size = new System.Drawing.Size(11, 12); + this.labelReenumerateHelp.TabIndex = 37; + this.labelReenumerateHelp.Text = "?"; + this.toolTipHelp.SetToolTip(this.labelReenumerateHelp, resources.GetString("labelReenumerateHelp.ToolTip")); + // + // checkBoxReenumerate + // + this.checkBoxReenumerate.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.checkBoxReenumerate.AutoSize = true; + this.checkBoxReenumerate.Enabled = false; + this.checkBoxReenumerate.ForeColor = System.Drawing.SystemColors.ControlText; + this.checkBoxReenumerate.Location = new System.Drawing.Point(272, 262); + this.checkBoxReenumerate.Name = "checkBoxReenumerate"; + this.checkBoxReenumerate.Size = new System.Drawing.Size(158, 17); + this.checkBoxReenumerate.TabIndex = 34; + this.checkBoxReenumerate.Text = "Re-enumerate renamed files"; + this.checkBoxReenumerate.UseVisualStyleBackColor = true; + this.checkBoxReenumerate.CheckedChanged += new System.EventHandler(this.CheckBoxReenumerate_CheckedChanged); + // + // numericUpDownMaxKeptRenamedFileCount + // + this.numericUpDownMaxKeptRenamedFileCount.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.numericUpDownMaxKeptRenamedFileCount.Enabled = false; + this.numericUpDownMaxKeptRenamedFileCount.Location = new System.Drawing.Point(407, 283); + this.numericUpDownMaxKeptRenamedFileCount.Maximum = new decimal(new int[] { + 1000000, + 0, + 0, + 0}); + this.numericUpDownMaxKeptRenamedFileCount.Name = "numericUpDownMaxKeptRenamedFileCount"; + this.numericUpDownMaxKeptRenamedFileCount.Size = new System.Drawing.Size(75, 20); + this.numericUpDownMaxKeptRenamedFileCount.TabIndex = 35; + // + // labelMaxKeptRenamedFileCount + // + this.labelMaxKeptRenamedFileCount.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.labelMaxKeptRenamedFileCount.AutoSize = true; + this.labelMaxKeptRenamedFileCount.Enabled = false; + this.labelMaxKeptRenamedFileCount.Location = new System.Drawing.Point(269, 285); + this.labelMaxKeptRenamedFileCount.Name = "labelMaxKeptRenamedFileCount"; + this.labelMaxKeptRenamedFileCount.Size = new System.Drawing.Size(137, 13); + this.labelMaxKeptRenamedFileCount.TabIndex = 36; + this.labelMaxKeptRenamedFileCount.Text = "Max. enumerated files kept:"; + // + // FormEditOptions // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(559, 311); + this.ClientSize = new System.Drawing.Size(650, 320); + this.Controls.Add(this.labelReenumerateHelp); + this.Controls.Add(this.labelMaxKeptRenamedFileCount); + this.Controls.Add(this.numericUpDownMaxKeptRenamedFileCount); + this.Controls.Add(this.checkBoxReenumerate); this.Controls.Add(this.labelDeleteUncommonFilesHelp); this.Controls.Add(this.labelCleanDestinyHelp); this.Controls.Add(this.labelKeepOriginFilesHelp); @@ -397,11 +485,12 @@ private void InitializeComponent() this.Controls.Add(this.labelSourcePath); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; this.MaximizeBox = false; - this.Name = "FormEditOption"; + this.Name = "FormEditOptions"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; - this.Text = "Edit Option"; + this.Text = "Edit Options"; this.panelManageExtensions.ResumeLayout(false); this.panelManageExtensions.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownMaxKeptRenamedFileCount)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); @@ -437,5 +526,9 @@ private void InitializeComponent() private System.Windows.Forms.Label labelCleanDestinyHelp; private System.Windows.Forms.Label labelDeleteUncommonFilesHelp; private System.Windows.Forms.ToolTip toolTipHelp; + private System.Windows.Forms.CheckBox checkBoxReenumerate; + private System.Windows.Forms.NumericUpDown numericUpDownMaxKeptRenamedFileCount; + private System.Windows.Forms.Label labelMaxKeptRenamedFileCount; + private System.Windows.Forms.Label labelReenumerateHelp; } } \ No newline at end of file diff --git a/BackupHelper/FormEditOption.cs b/BackupHelper/FormEditOptions.cs similarity index 85% rename from BackupHelper/FormEditOption.cs rename to BackupHelper/FormEditOptions.cs index 612b8d9..06cd6bb 100644 --- a/BackupHelper/FormEditOption.cs +++ b/BackupHelper/FormEditOptions.cs @@ -14,13 +14,13 @@ public enum FormAction EDIT, CREATE } - public partial class FormEditOption : Form + public partial class FormEditOptions : Form { private readonly FormOptionsMenu OptionsMenu; - public Option Option; + public Options Option; private readonly FormAction FormAction = FormAction.CREATE; - public FormEditOption(FormOptionsMenu optionsMenu, Option option = null) + public FormEditOptions(FormOptionsMenu optionsMenu, Options option = null) { InitializeComponent(); @@ -34,17 +34,12 @@ public FormEditOption(FormOptionsMenu optionsMenu, Option option = null) } else { - Text = "Add option"; + Text = "New Options"; - FillCamps(new Option { + FillCamps(new Options { SourcePath = "C:\\origin...", DestinyPath = "C:\\destiny...", - FileNameConflictMethod = FileNameConflictMethod.DO_NOT_MOVE, - MoveSubFolders = true, - KeepOriginFiles = true, - CleanDestinyDirectory = false, - AllowIgnoreFileExt = false, - DeleteUncommonFiles = false + IncludeSubFolders = true }); } @@ -52,11 +47,11 @@ public FormEditOption(FormOptionsMenu optionsMenu, Option option = null) KeyPreview = true; } - private void FillCamps(Option option) + private void FillCamps(Options option) { try { - comboBoxMethod.Items.Insert((int)FileNameConflictMethod.DO_NOT_MOVE, option.GetTransferMethodDescription(FileNameConflictMethod.DO_NOT_MOVE)); + comboBoxMethod.Items.Insert((int)FileNameConflictMethod.SKIP, option.GetTransferMethodDescription(FileNameConflictMethod.SKIP)); comboBoxMethod.Items.Insert((int)FileNameConflictMethod.REPLACE_ALL, option.GetTransferMethodDescription(FileNameConflictMethod.REPLACE_ALL)); comboBoxMethod.Items.Insert((int)FileNameConflictMethod.REPLACE_DIFFERENT, option.GetTransferMethodDescription(FileNameConflictMethod.REPLACE_DIFFERENT)); comboBoxMethod.Items.Insert((int)FileNameConflictMethod.RENAME_DIFFERENT, option.GetTransferMethodDescription(FileNameConflictMethod.RENAME_DIFFERENT)); @@ -65,12 +60,14 @@ private void FillCamps(Option option) textBoxSourcePath.Text = option.SourcePath; textBoxDestinyPath.Text = option.DestinyPath; - checkBoxMoveSubfolders.Checked = option.MoveSubFolders; + checkBoxMoveSubfolders.Checked = option.IncludeSubFolders; checkBoxKeepOriginFiles.Checked = option.KeepOriginFiles; checkBoxCleanDestinyDirectory.Checked = option.CleanDestinyDirectory; checkBoxDeleteUncommonFiles.Checked = option.DeleteUncommonFiles; checkBoxManageFileNamesAndExtensions.Checked = option.AllowIgnoreFileExt; radioButtonIgnore.Checked = option.SpecifiedFileNamesOrExtensionsMode == SpecifiedFileNamesAndExtensionsMode.IGNORE; + checkBoxReenumerate.Checked = option.ReenumerateRenamedFiles; + numericUpDownMaxKeptRenamedFileCount.Value = option.MaxKeptRenamedFileCount; foreach (string txt in option.SpecifiedFileNamesAndExtensions) listViewFileNamesAndExtensions.Items.Add(new ListViewItem(txt)); @@ -94,8 +91,8 @@ private void SubmitChanges() { try { - Option editedOption = new Option(); - SaveCampsToObject(editedOption); + Options editedOption = new Options(); + SaveFieldsToObject(editedOption); if (!InputsAreValid(editedOption)) return; if (FormAction == FormAction.CREATE) @@ -106,7 +103,7 @@ private void SubmitChanges() OptionsMenu.Options.Add(editedOption); Program.UpdateLastTimeModified(editedOption.Profile); ListViewItem item = new ListViewItem(); - OptionsMenu.EditListViewItem(editedOption,item); + OptionsMenu.EditListViewItem(editedOption, item); OptionsMenu.listViewOptions.Items.Add(item); //OptionsMenu.ResizeForm(); } @@ -118,12 +115,14 @@ private void SubmitChanges() Option.DestinyPath == editedOption.DestinyPath && Option.FileNameConflictMethod == editedOption.FileNameConflictMethod && Option.SpecifiedFileNamesOrExtensionsMode == editedOption.SpecifiedFileNamesOrExtensionsMode && - Option.MoveSubFolders == editedOption.MoveSubFolders && + Option.IncludeSubFolders == editedOption.IncludeSubFolders && Option.KeepOriginFiles == editedOption.KeepOriginFiles && Option.CleanDestinyDirectory == editedOption.CleanDestinyDirectory && Option.DeleteUncommonFiles == editedOption.DeleteUncommonFiles && Option.AllowIgnoreFileExt == editedOption.AllowIgnoreFileExt && - ExtensionsAreTheSame(Option.SpecifiedFileNamesAndExtensions, editedOption.SpecifiedFileNamesAndExtensions) + ExtensionsAreTheSame(Option.SpecifiedFileNamesAndExtensions, editedOption.SpecifiedFileNamesAndExtensions) && + Option.ReenumerateRenamedFiles == editedOption.ReenumerateRenamedFiles && + Option.MaxKeptRenamedFileCount == editedOption.MaxKeptRenamedFileCount ) ) { @@ -131,12 +130,14 @@ private void SubmitChanges() Option.DestinyPath = editedOption.DestinyPath; Option.FileNameConflictMethod = editedOption.FileNameConflictMethod; Option.SpecifiedFileNamesOrExtensionsMode = editedOption.SpecifiedFileNamesOrExtensionsMode; - Option.MoveSubFolders = editedOption.MoveSubFolders; + Option.IncludeSubFolders = editedOption.IncludeSubFolders; Option.KeepOriginFiles = editedOption.KeepOriginFiles; Option.CleanDestinyDirectory = editedOption.CleanDestinyDirectory; Option.DeleteUncommonFiles = editedOption.DeleteUncommonFiles; Option.AllowIgnoreFileExt = editedOption.AllowIgnoreFileExt; Option.SpecifiedFileNamesAndExtensions = editedOption.SpecifiedFileNamesAndExtensions; + Option.ReenumerateRenamedFiles = editedOption.ReenumerateRenamedFiles; + Option.MaxKeptRenamedFileCount = editedOption.MaxKeptRenamedFileCount; DBAccess.UpdateOption(Option); Program.UpdateLastTimeModified(Option.Profile); @@ -152,7 +153,7 @@ private void SubmitChanges() } } - private bool InputsAreValid(Option editedOption) + private bool InputsAreValid(Options editedOption) { if(editedOption.SourcePath == "") { @@ -179,19 +180,21 @@ private bool ExtensionsAreTheSame(List fileExtensions1, List fil return true; } - private void SaveCampsToObject(Option editedOption) + private void SaveFieldsToObject(Options editedOption) { editedOption.SourcePath = textBoxSourcePath.Text; editedOption.DestinyPath = textBoxDestinyPath.Text; editedOption.FileNameConflictMethod = (FileNameConflictMethod)comboBoxMethod.SelectedIndex; editedOption.SpecifiedFileNamesOrExtensionsMode = radioButtonIgnore.Checked ? SpecifiedFileNamesAndExtensionsMode.IGNORE : SpecifiedFileNamesAndExtensionsMode.ALLOW_ONLY; - editedOption.MoveSubFolders = checkBoxMoveSubfolders.Checked; + editedOption.IncludeSubFolders = checkBoxMoveSubfolders.Checked; editedOption.KeepOriginFiles = checkBoxKeepOriginFiles.Checked; editedOption.CleanDestinyDirectory = checkBoxCleanDestinyDirectory.Checked; editedOption.DeleteUncommonFiles = checkBoxDeleteUncommonFiles.Checked; editedOption.AllowIgnoreFileExt = checkBoxManageFileNamesAndExtensions.Checked; editedOption.SpecifiedFileNamesAndExtensions = listViewFileNamesAndExtensions.Items.Cast().Select(i => i.Text).ToList(); + editedOption.ReenumerateRenamedFiles = checkBoxReenumerate.Checked; + editedOption.MaxKeptRenamedFileCount = (int)numericUpDownMaxKeptRenamedFileCount.Value; } //private List ListViewFileExtensionsToList() @@ -227,12 +230,15 @@ private void CheckBoxCleanDestinyDirectory_CheckedChanged(object sender, EventAr comboBoxMethod.Enabled = false; labelMethod.Enabled = false; checkBoxDeleteUncommonFiles.Enabled = false; + checkBoxReenumerate.Enabled = false; + checkBoxReenumerate.Checked = false; } else { comboBoxMethod.Enabled = true; labelMethod.Enabled = true; checkBoxDeleteUncommonFiles.Enabled = true; + checkBoxReenumerate.Enabled = true; } } @@ -240,7 +246,7 @@ private void CheckBoxDeleteUncommonFiles_CheckedChanged(object sender, EventArgs { if (checkBoxDeleteUncommonFiles.Checked) { - if(comboBoxMethod.SelectedIndex == 3) + if (comboBoxMethod.SelectedIndex == 3) comboBoxMethod.SelectedIndex = 0; } } @@ -261,8 +267,18 @@ private void ComboBoxMethod_DrawItem(object sender,DrawItemEventArgs args) private void ComboBoxMethod_SelectedIndexChanged(object sender, EventArgs args) { - if (checkBoxDeleteUncommonFiles.Checked && comboBoxMethod.SelectedIndex == 3) - comboBoxMethod.SelectedIndex = 0; + if (comboBoxMethod.SelectedIndex == 3) + { + if (checkBoxDeleteUncommonFiles.Checked) + comboBoxMethod.SelectedIndex = 0; + else + checkBoxReenumerate.Enabled = true; + } + else + { + checkBoxReenumerate.Checked = false; + checkBoxReenumerate.Enabled = false; + } } private void ButtonSwitchPaths_Click(object sender, EventArgs e) @@ -412,5 +428,11 @@ private void FormEditOption_KeyDown(object sender, KeyEventArgs args) Close(); } } + + private void CheckBoxReenumerate_CheckedChanged(object sender, EventArgs e) + { + labelMaxKeptRenamedFileCount.Enabled = checkBoxReenumerate.Checked; + numericUpDownMaxKeptRenamedFileCount.Enabled = checkBoxReenumerate.Checked; + } } } diff --git a/BackupHelper/FormEditOptions.resx b/BackupHelper/FormEditOptions.resx new file mode 100644 index 0000000..2bd7ee3 --- /dev/null +++ b/BackupHelper/FormEditOptions.resx @@ -0,0 +1,132 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + + 238, 17 + + + Update the numbers from all filenames in the destiny directory enumerated with the pattern <name> (<number>)<extension>, +for each file from which they have originated. The maximum quantity of enumerated files (including the original) can be informed, +meaning the enumerated files, selected from highest number in descending way, will be kept and re-enumerated and the excess will +be deleted. 0 means all files will be kept. + + \ No newline at end of file diff --git a/BackupHelper/FormEditProfile.cs b/BackupHelper/FormEditProfile.cs index 626f500..6260aa9 100644 --- a/BackupHelper/FormEditProfile.cs +++ b/BackupHelper/FormEditProfile.cs @@ -52,9 +52,15 @@ private void SaveProfile() return; } + if (textBoxProfileName.Text.Contains(";")) + { + MessageBox.Show("Name contains the reserved character \";\"."); + return; + } + if (TextContainsInvalidCharacters(textBoxProfileName.Text)) { - MessageBox.Show($"Name contains invalid characters."); + MessageBox.Show("Name contains invalid characters."); return; } diff --git a/BackupHelper/FormErrorDialog.cs b/BackupHelper/FormErrorDialog.cs index f39332c..fde8688 100644 --- a/BackupHelper/FormErrorDialog.cs +++ b/BackupHelper/FormErrorDialog.cs @@ -15,8 +15,8 @@ public FormErrorDialog(Type actionType, string message) textBoxErrorDialog.Text = message; textBoxErrorDialog.TabStop = false; ActionType = actionType; - if(actionType == typeof(FileTransferErrorActionNonRepeatable)) - this.buttonTryAgain.Enabled = false; + if (actionType == typeof(FileTransferErrorActionNonRepeatable)) + buttonTryAgain.Enabled = false; } private void ButtonErrorDialogIgnore_Click(object sender, EventArgs e) @@ -26,7 +26,7 @@ private void ButtonErrorDialogIgnore_Click(object sender, EventArgs e) if (ActionType == typeof(FileTransferErrorActionNonRepeatable)) Result = FileTransferErrorActionNonRepeatable.JUMP; - this.Close(); + Close(); } private void ButtonErrorDialogCancel_Click(object sender, EventArgs e) @@ -36,13 +36,13 @@ private void ButtonErrorDialogCancel_Click(object sender, EventArgs e) if (ActionType == typeof(FileTransferErrorActionNonRepeatable)) Result = FileTransferErrorActionNonRepeatable.CANCEL; - this.Close(); + Close(); } private void ButtonTryAgain_Click(object sender, EventArgs e) { Result = FileTransferErrorActionRepeatable.REPEAT; - this.Close(); + Close(); } } } diff --git a/BackupHelper/FormOptionsMenu.Designer.cs b/BackupHelper/FormOptionsMenu.Designer.cs index ae196c1..963e028 100644 --- a/BackupHelper/FormOptionsMenu.Designer.cs +++ b/BackupHelper/FormOptionsMenu.Designer.cs @@ -40,6 +40,7 @@ private void InitializeComponent() this.columnHeaderKeepOrigin = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.columnHeaderCleanDestinyDir = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.columnHeaderDeleteUncommonFiles = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.columnHeaderReorganizeFiles = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.contextMenuStripOptionsList = new System.Windows.Forms.ContextMenuStrip(this.components); this.cloneOptionToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.ToolStripMenuItemRemove = new System.Windows.Forms.ToolStripMenuItem(); @@ -60,7 +61,7 @@ private void InitializeComponent() // buttonAddOption // this.buttonAddOption.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.buttonAddOption.Location = new System.Drawing.Point(0, 224); + this.buttonAddOption.Location = new System.Drawing.Point(1, 224); this.buttonAddOption.Name = "buttonAddOption"; this.buttonAddOption.Size = new System.Drawing.Size(95, 30); this.buttonAddOption.TabIndex = 1; @@ -82,7 +83,8 @@ private void InitializeComponent() this.columnHeaderMoveSubfolders, this.columnHeaderKeepOrigin, this.columnHeaderCleanDestinyDir, - this.columnHeaderDeleteUncommonFiles}); + this.columnHeaderDeleteUncommonFiles, + this.columnHeaderReorganizeFiles}); this.listViewOptions.ContextMenuStrip = this.contextMenuStripOptionsList; this.listViewOptions.FullRowSelect = true; this.listViewOptions.GridLines = true; @@ -91,7 +93,7 @@ private void InitializeComponent() this.listViewOptions.Location = new System.Drawing.Point(0, 0); this.listViewOptions.Name = "listViewOptions"; this.listViewOptions.ShowItemToolTips = true; - this.listViewOptions.Size = new System.Drawing.Size(1072, 224); + this.listViewOptions.Size = new System.Drawing.Size(1163, 224); this.listViewOptions.TabIndex = 0; this.listViewOptions.UseCompatibleStateImageBehavior = false; this.listViewOptions.View = System.Windows.Forms.View.Details; @@ -115,22 +117,27 @@ private void InitializeComponent() // columnHeaderMoveSubfolders // this.columnHeaderMoveSubfolders.Text = "Move Subfolders"; - this.columnHeaderMoveSubfolders.Width = 75; + this.columnHeaderMoveSubfolders.Width = 80; // // columnHeaderKeepOrigin // this.columnHeaderKeepOrigin.Text = "Keep Origin Files"; - this.columnHeaderKeepOrigin.Width = 75; + this.columnHeaderKeepOrigin.Width = 80; // // columnHeaderCleanDestinyDir // this.columnHeaderCleanDestinyDir.Text = "Clean Dest. Dir."; - this.columnHeaderCleanDestinyDir.Width = 75; + this.columnHeaderCleanDestinyDir.Width = 80; // // columnHeaderDeleteUncommonFiles // this.columnHeaderDeleteUncommonFiles.Text = "Del. Uncommon Files"; - this.columnHeaderDeleteUncommonFiles.Width = 75; + this.columnHeaderDeleteUncommonFiles.Width = 80; + // + // columnHeaderReorganizeFiles + // + this.columnHeaderReorganizeFiles.Text = "Reorg. renamed files"; + this.columnHeaderReorganizeFiles.Width = 80; // // contextMenuStripOptionsList // @@ -193,7 +200,7 @@ private void InitializeComponent() this.buttonExecute.BackColor = System.Drawing.Color.White; this.buttonExecute.FlatAppearance.BorderColor = System.Drawing.Color.Red; this.buttonExecute.FlatAppearance.MouseDownBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(128))))); - this.buttonExecute.Location = new System.Drawing.Point(94, 224); + this.buttonExecute.Location = new System.Drawing.Point(95, 224); this.buttonExecute.Name = "buttonExecute"; this.buttonExecute.Size = new System.Drawing.Size(95, 30); this.buttonExecute.TabIndex = 4; @@ -206,10 +213,10 @@ private void InitializeComponent() this.progressBarOptions.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.progressBarOptions.Enabled = false; - this.progressBarOptions.Location = new System.Drawing.Point(0, 252); + this.progressBarOptions.Location = new System.Drawing.Point(0, 254); this.progressBarOptions.Maximum = 10000; this.progressBarOptions.Name = "progressBarOptions"; - this.progressBarOptions.Size = new System.Drawing.Size(1072, 12); + this.progressBarOptions.Size = new System.Drawing.Size(1163, 12); this.progressBarOptions.TabIndex = 4; // // buttonCancel @@ -219,7 +226,7 @@ private void InitializeComponent() this.buttonCancel.FlatAppearance.BorderColor = System.Drawing.Color.Red; this.buttonCancel.FlatAppearance.BorderSize = 2; this.buttonCancel.ForeColor = System.Drawing.Color.White; - this.buttonCancel.Location = new System.Drawing.Point(977, 224); + this.buttonCancel.Location = new System.Drawing.Point(1068, 224); this.buttonCancel.Name = "buttonCancel"; this.buttonCancel.Size = new System.Drawing.Size(95, 30); this.buttonCancel.TabIndex = 8; @@ -249,7 +256,7 @@ private void InitializeComponent() this.textBoxTransfering.Location = new System.Drawing.Point(85, 233); this.textBoxTransfering.Name = "textBoxTransfering"; this.textBoxTransfering.ReadOnly = true; - this.textBoxTransfering.Size = new System.Drawing.Size(873, 13); + this.textBoxTransfering.Size = new System.Drawing.Size(964, 13); this.textBoxTransfering.TabIndex = 7; this.textBoxTransfering.Visible = false; // @@ -257,7 +264,7 @@ private void InitializeComponent() // this.buttonShowResult.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.buttonShowResult.Enabled = false; - this.buttonShowResult.Location = new System.Drawing.Point(964, 224); + this.buttonShowResult.Location = new System.Drawing.Point(1054, 224); this.buttonShowResult.Name = "buttonShowResult"; this.buttonShowResult.Size = new System.Drawing.Size(108, 30); this.buttonShowResult.TabIndex = 8; @@ -271,7 +278,7 @@ private void InitializeComponent() this.checkBoxShowResult.AutoSize = true; this.checkBoxShowResult.Checked = true; this.checkBoxShowResult.CheckState = System.Windows.Forms.CheckState.Checked; - this.checkBoxShowResult.Location = new System.Drawing.Point(821, 232); + this.checkBoxShowResult.Location = new System.Drawing.Point(912, 232); this.checkBoxShowResult.Name = "checkBoxShowResult"; this.checkBoxShowResult.Size = new System.Drawing.Size(137, 17); this.checkBoxShowResult.TabIndex = 7; @@ -283,7 +290,7 @@ private void InitializeComponent() this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.SystemColors.Control; - this.ClientSize = new System.Drawing.Size(1072, 261); + this.ClientSize = new System.Drawing.Size(1163, 261); this.Controls.Add(this.checkBoxShowResult); this.Controls.Add(this.textBoxTransfering); this.Controls.Add(this.labelTransfering); @@ -329,5 +336,6 @@ private void InitializeComponent() private System.Windows.Forms.ToolStripMenuItem cloneOptionToolStripMenuItem; public ListView listViewOptions; private ToolStripMenuItem ToolStripMenuItemRemove; + private ColumnHeader columnHeaderReorganizeFiles; } } \ No newline at end of file diff --git a/BackupHelper/FormOptionsMenu.cs b/BackupHelper/FormOptionsMenu.cs index a739126..83313f9 100644 --- a/BackupHelper/FormOptionsMenu.cs +++ b/BackupHelper/FormOptionsMenu.cs @@ -11,21 +11,10 @@ namespace BackupHelper { - public enum ListViewOptionSubItemIndex - { - INDEX_SOURCE_PATH = 0, - INDEX_DESTINY_PATH = 1, - INDEX_METHOD = 2, - INDEX_MOVE_SUBFOLDER = 3, - INDEX_KEEP_ORIGIN_FILES = 4, - INDEX_CLEAN_DESTINY = 5, - INDEX_REMOVE_COMMON = 6 - } - public partial class FormOptionsMenu : Form { public readonly Profile Profile; - public List