diff --git a/.gitignore b/.gitignore index 4314b9d..8524d10 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ /packages +/test ## Ignore Visual Studio temporary files, build results, and ## files generated by popular Visual Studio add-ons. diff --git a/BackupHelper/BackupHelper.csproj b/BackupHelper/BackupHelper.csproj index 71a83d6..a7dc5fd 100644 --- a/BackupHelper/BackupHelper.csproj +++ b/BackupHelper/BackupHelper.csproj @@ -57,8 +57,8 @@ true - - ..\packages\FileControlUtility.1.1.0\lib\netstandard2.0\FileControlUtility.dll + + ..\packages\FileControlUtility.1.2.0\lib\netstandard2.0\FileControlUtility.dll diff --git a/BackupHelper/FileControlConsoleImpl.cs b/BackupHelper/FileControlConsoleImpl.cs index b3e906a..3fdd5b5 100644 --- a/BackupHelper/FileControlConsoleImpl.cs +++ b/BackupHelper/FileControlConsoleImpl.cs @@ -21,7 +21,7 @@ protected override void HandleCurrentFileExecution(string trimmedPathWithFileNam protected override FileTransferErrorActionNonRepeatable HandleTransferErrorNonRepeatable(string errorMessage, Exception e, FileInfo originFile, string destinyDir, TransferSettings settings) { - if (!showDialogs) return FileTransferErrorActionNonRepeatable.JUMP; + if (!showDialogs) return FileTransferErrorActionNonRepeatable.SKIP; FormErrorDialog form = new FormErrorDialog(typeof(FileTransferErrorActionNonRepeatable), errorMessage); form.ShowDialog(); @@ -31,7 +31,7 @@ protected override FileTransferErrorActionNonRepeatable HandleTransferErrorNonRe protected override FileTransferErrorActionRepeatable HandleTransferErrorRepeatable(string errorMessage, Exception e, FileInfo originFile, string destinyDir, TransferSettings settings) { - if (!showDialogs) return FileTransferErrorActionRepeatable.JUMP; + if (!showDialogs) return FileTransferErrorActionRepeatable.SKIP; FormErrorDialog form = new FormErrorDialog(typeof(FileTransferErrorActionRepeatable), errorMessage); form.ShowDialog(); diff --git a/BackupHelper/FormEditOptions.cs b/BackupHelper/FormEditOptions.cs index 06cd6bb..ee92fdc 100644 --- a/BackupHelper/FormEditOptions.cs +++ b/BackupHelper/FormEditOptions.cs @@ -19,8 +19,19 @@ public partial class FormEditOptions : Form private readonly FormOptionsMenu OptionsMenu; public Options Option; private readonly FormAction FormAction = FormAction.CREATE; + private static FormEditOptions Instance = null; - public FormEditOptions(FormOptionsMenu optionsMenu, Options option = null) + public static FormEditOptions GetInstance(FormOptionsMenu optionsMenu, Options option = null) + { + if (Instance != null && Instance.IsHandleCreated && option != Instance.Option) Instance.Close(); + + if (Instance == null || !Instance.IsHandleCreated) + Instance = new FormEditOptions(optionsMenu, option); + + return Instance; + } + + private FormEditOptions(FormOptionsMenu optionsMenu, Options option = null) { InitializeComponent(); @@ -65,7 +76,7 @@ private void FillCamps(Options option) checkBoxCleanDestinyDirectory.Checked = option.CleanDestinyDirectory; checkBoxDeleteUncommonFiles.Checked = option.DeleteUncommonFiles; checkBoxManageFileNamesAndExtensions.Checked = option.AllowIgnoreFileExt; - radioButtonIgnore.Checked = option.SpecifiedFileNamesOrExtensionsMode == SpecifiedFileNamesAndExtensionsMode.IGNORE; + radioButtonIgnore.Checked = option.SpecifiedFileNamesOrExtensionsMode == SpecifiedEntriesMode.IGNORE; checkBoxReenumerate.Checked = option.ReenumerateRenamedFiles; numericUpDownMaxKeptRenamedFileCount.Value = option.MaxKeptRenamedFileCount; @@ -185,8 +196,8 @@ 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.SpecifiedFileNamesOrExtensionsMode = radioButtonIgnore.Checked ? SpecifiedEntriesMode.IGNORE : + SpecifiedEntriesMode.ALLOW_ONLY; editedOption.IncludeSubFolders = checkBoxMoveSubfolders.Checked; editedOption.KeepOriginFiles = checkBoxKeepOriginFiles.Checked; editedOption.CleanDestinyDirectory = checkBoxCleanDestinyDirectory.Checked; diff --git a/BackupHelper/FormErrorDialog.cs b/BackupHelper/FormErrorDialog.cs index fde8688..3ffd392 100644 --- a/BackupHelper/FormErrorDialog.cs +++ b/BackupHelper/FormErrorDialog.cs @@ -22,9 +22,9 @@ public FormErrorDialog(Type actionType, string message) private void ButtonErrorDialogIgnore_Click(object sender, EventArgs e) { if (ActionType == typeof(FileTransferErrorActionRepeatable)) - Result = FileTransferErrorActionRepeatable.JUMP; + Result = FileTransferErrorActionRepeatable.SKIP; if (ActionType == typeof(FileTransferErrorActionNonRepeatable)) - Result = FileTransferErrorActionNonRepeatable.JUMP; + Result = FileTransferErrorActionNonRepeatable.SKIP; Close(); } diff --git a/BackupHelper/FormOptionsMenu.cs b/BackupHelper/FormOptionsMenu.cs index 83313f9..c93accb 100644 --- a/BackupHelper/FormOptionsMenu.cs +++ b/BackupHelper/FormOptionsMenu.cs @@ -214,8 +214,12 @@ private void ButtonAddOption_Click(object sender, EventArgs args) { try { - FormEditOptions form = new FormEditOptions(this); - form.Show(); + FormEditOptions form = FormEditOptions.GetInstance(this); + + if (form.Visible) + form.WindowState = FormWindowState.Normal; + else + form.Show(this); } catch (Exception e) { @@ -227,10 +231,14 @@ private void EditSelectedOption() { try { - ListViewItem item = listViewOptions.SelectedItems[0]; - Options option = Options.Find(o => o.Id == (int)item.Tag); - FormEditOptions edit = new FormEditOptions(this, option); - edit.Show(this); + Options option = Options.Find(o => o.Id == (int)listViewOptions.SelectedItems[0].Tag); + + FormEditOptions form = FormEditOptions.GetInstance(this, option); + + if (form.Visible) + form.WindowState = FormWindowState.Normal; + else + form.Show(this); } catch (ArgumentOutOfRangeException) { diff --git a/BackupHelper/Program.cs b/BackupHelper/Program.cs index 5e38b84..a37ec61 100644 --- a/BackupHelper/Program.cs +++ b/BackupHelper/Program.cs @@ -111,12 +111,12 @@ static void Main(string[] args) } UpdateLastTimeExecuted(profile); - fileControl.ManageFiles(DBAccess.ListProfileOptions(profile).ToList()); + fileControl.ManageFiles(profile.Options.ToList()); } catch (Exception e) { LogManager.WriteLine($"Error: {e.Message} while executing \"{profile.Name}\"."); - dialogMessage = $"Error: {e.Message} while executing \"{profile.Name}\". Proceed to the next profile?"; + dialogMessage = $"Error: \"{e.Message}\" while executing \"{profile.Name}\". Proceed to the next profile?"; if (showDialogs && MessageBox.Show(dialogMessage, "", MessageBoxButtons.OKCancel) == DialogResult.Cancel) { LogManager.WriteLine("Transfer canceled by user."); diff --git a/BackupHelper/Properties/AssemblyInfo.cs b/BackupHelper/Properties/AssemblyInfo.cs index fa189f2..cb4d389 100644 --- a/BackupHelper/Properties/AssemblyInfo.cs +++ b/BackupHelper/Properties/AssemblyInfo.cs @@ -7,6 +7,6 @@ [assembly: AssemblyProduct("BackupHelper")] [assembly: AssemblyCopyright("Copyright © Nain 2021")] [assembly: AssemblyTrademark("Nain")] -[assembly: AssemblyVersion("1.4.0")] -[assembly: AssemblyFileVersion("1.4.0")] +[assembly: AssemblyVersion("1.4.1")] +[assembly: AssemblyFileVersion("1.4.1")] [assembly: NeutralResourcesLanguage("en-US")] diff --git a/BackupHelper/SQLiteAccess.cs b/BackupHelper/SQLiteAccess.cs index e252046..a2e4e67 100644 --- a/BackupHelper/SQLiteAccess.cs +++ b/BackupHelper/SQLiteAccess.cs @@ -273,7 +273,7 @@ public static List ListProfileOptions(Profile prof) DeleteUncommonFiles = reader1.GetBoolean(reader1.GetOrdinal("opt_delete_uncommon_files")), AllowIgnoreFileExt = reader1.GetBoolean(reader1.GetOrdinal("opt_allowignore_file_ext")), FileNameConflictMethod = (FileNameConflictMethod)reader1.GetInt32(reader1.GetOrdinal("opt_filename_conflict_method")), - SpecifiedFileNamesOrExtensionsMode = (SpecifiedFileNamesAndExtensionsMode)reader1.GetInt32(reader1.GetOrdinal("opt_spec_filenames_and_exts_mode")), + SpecifiedFileNamesOrExtensionsMode = (SpecifiedEntriesMode)reader1.GetInt32(reader1.GetOrdinal("opt_spec_filenames_and_exts_mode")), ReenumerateRenamedFiles = reader1.GetBoolean(reader1.GetOrdinal("opt_reenumerate_renamed_files")), MaxKeptRenamedFileCount = reader1.GetInt32(reader1.GetOrdinal("opt_max_kept_renamed_file_count")) }; diff --git a/BackupHelper/packages.config b/BackupHelper/packages.config index 7374060..c6bb341 100644 --- a/BackupHelper/packages.config +++ b/BackupHelper/packages.config @@ -1,6 +1,6 @@  - + \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 36539d2..e44e6cd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,16 @@ +## 1.4.1 + +Fixed/altered: +- Parameter execution for options with paths containing environment variables - fix +- Single open edit option window - fix + ## 1.4.0 Database not compatible with previous version New features: -- Options to re-enumerate and limit the quantity of files enumerated with the pattern () (rename different files) - adapted to FileControlUtility v1.1.0 library +- Options to re-enumerate and limit the quantity of files enumerated with the pattern "<name> (<number>)<extension>" (rename different files) - adapted to + FileControlUtility v1.1.0 library Fixes/changes: - Display log text on cmd window when executing profiles through parameters - fix