From 8997f52505086d207415041bff30f3ea5ad8f505 Mon Sep 17 00:00:00 2001 From: Robert McRackan Date: Sun, 18 Jul 2021 17:48:15 -0400 Subject: [PATCH] replace dir selection controls in both settings dialogs with new ctrl.s --- FileManager/AudibleFileStorage.cs | 4 +- FileManager/Configuration.cs | 20 -- LibationLauncher/LibationLauncher.csproj | 2 +- LibationLauncher/Program.cs | 19 +- .../Dialogs/LibationFilesDialog.Designer.cs | 22 +- .../Dialogs/LibationFilesDialog.cs | 8 +- .../Dialogs/SettingsDialog.Designer.cs | 208 ++++-------------- LibationWinForms/Dialogs/SettingsDialog.cs | 68 ++---- LibationWinForms/Dialogs/SettingsDialog.resx | 63 ------ .../Dialogs/TEMP_TestNewControls.Designer.cs | 81 ------- .../Dialogs/TEMP_TestNewControls.cs | 89 -------- .../Dialogs/TEMP_TestNewControls.resx | 60 ----- 12 files changed, 95 insertions(+), 549 deletions(-) delete mode 100644 LibationWinForms/Dialogs/TEMP_TestNewControls.Designer.cs delete mode 100644 LibationWinForms/Dialogs/TEMP_TestNewControls.cs delete mode 100644 LibationWinForms/Dialogs/TEMP_TestNewControls.resx diff --git a/FileManager/AudibleFileStorage.cs b/FileManager/AudibleFileStorage.cs index 0d15e94c..a6689abf 100644 --- a/FileManager/AudibleFileStorage.cs +++ b/FileManager/AudibleFileStorage.cs @@ -28,9 +28,9 @@ namespace FileManager public static AudibleFileStorage AAXC { get; } = new AaxcFileStorage(); public static AudibleFileStorage PDF { get; } = new PdfFileStorage(); - public static string DownloadsInProgress => Directory.CreateDirectory(Path.Combine(Configuration.Instance.DownloadsInProgressEnum, "DownloadsInProgress")).FullName; + public static string DownloadsInProgress => Directory.CreateDirectory(Path.Combine(Configuration.Instance.InProgress, "DownloadsInProgress")).FullName; - public static string DecryptInProgress => Directory.CreateDirectory(Path.Combine(Configuration.Instance.DecryptInProgressEnum, "DecryptInProgress")).FullName; + public static string DecryptInProgress => Directory.CreateDirectory(Path.Combine(Configuration.Instance.InProgress, "DecryptInProgress")).FullName; public static string BooksDirectory { diff --git a/FileManager/Configuration.cs b/FileManager/Configuration.cs index 2e40ecb3..3e90184d 100644 --- a/FileManager/Configuration.cs +++ b/FileManager/Configuration.cs @@ -51,10 +51,6 @@ namespace FileManager } #region known directories - public const string WIN_TEMP_LABEL = "WinTemp"; - public const string LIBATION_FILES_LABEL = "LibationFiles"; - public const string USER_PROFILE_LABEL = "UserProfile"; - public static string AppDir_Relative => @".\LibationFiles"; public static string AppDir_Absolute => Path.GetFullPath(Path.Combine(Path.GetDirectoryName(Exe.FileLocationOnDisk), LIBATION_FILES_KEY)); public static string MyDocs => Path.GetFullPath(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "LibationFiles")); @@ -119,21 +115,6 @@ namespace FileManager set => persistentDictionary.Set(nameof(InProgress), value); } - [Description("Temporary location of files while they're in process of being downloaded.\r\nWhen download is complete, the final file will be in [LibationFiles]\\DownloadsFinal")] - public string DownloadsInProgressEnum - { - get => persistentDictionary.GetString(nameof(DownloadsInProgressEnum)); - set => persistentDictionary.Set(nameof(DownloadsInProgressEnum), value); - } - - // temp/working dir(s) should be outside of dropbox - [Description("Temporary location of files while they're in process of being decrypted.\r\nWhen decryption is complete, the final file will be in Books location")] - public string DecryptInProgressEnum - { - get => persistentDictionary.GetString(nameof(DecryptInProgressEnum)); - set => persistentDictionary.Set(nameof(DecryptInProgressEnum), value); - } - [Description("Allow Libation for fix up audiobook metadata?")] public bool AllowLibationFixup { @@ -147,7 +128,6 @@ namespace FileManager private Configuration() { } private const string APPSETTINGS_JSON = "appsettings.json"; - // this is the key in appsettings. The string happens to match the metadirectory name but separate concern. keep separate private const string LIBATION_FILES_KEY = "LibationFiles"; [Description("Location for storage of program-created files")] diff --git a/LibationLauncher/LibationLauncher.csproj b/LibationLauncher/LibationLauncher.csproj index f25092f8..19f62114 100644 --- a/LibationLauncher/LibationLauncher.csproj +++ b/LibationLauncher/LibationLauncher.csproj @@ -13,7 +13,7 @@ win-x64 - 5.1.10.1 + 5.1.10.10 diff --git a/LibationLauncher/Program.cs b/LibationLauncher/Program.cs index d6670493..9182a7c9 100644 --- a/LibationLauncher/Program.cs +++ b/LibationLauncher/Program.cs @@ -47,8 +47,7 @@ namespace LibationLauncher { static bool configSetupIsComplete(Configuration config) => config.FilesExist - && !string.IsNullOrWhiteSpace(config.DownloadsInProgressEnum) - && !string.IsNullOrWhiteSpace(config.DecryptInProgressEnum); + && !string.IsNullOrWhiteSpace(config.InProgress); var config = Configuration.Instance; if (configSetupIsComplete(config)) @@ -59,8 +58,7 @@ namespace LibationLauncher var setupDialog = new SetupDialog(); setupDialog.NoQuestionsBtn_Click += (_, __) => { - config.DownloadsInProgressEnum ??= Configuration.WIN_TEMP_LABEL; - config.DecryptInProgressEnum ??= Configuration.WIN_TEMP_LABEL; + config.InProgress ??= Configuration.WinTemp; config.Books ??= Configuration.AppDir_Relative; config.AllowLibationFixup = true; }; @@ -266,13 +264,14 @@ namespace LibationLauncher { var settingsKey = "DownloadsInProgressEnum"; if (UNSAFE_MigrationHelper.Settings_TryGet(settingsKey, out var value)) - UNSAFE_MigrationHelper.Settings_Update(settingsKey, translatePath(value)); + { + UNSAFE_MigrationHelper.Settings_Delete(settingsKey); + UNSAFE_MigrationHelper.Settings_Insert("InProgress", translatePath(value)); + } } { - var settingsKey = "DecryptInProgressEnum"; - if (UNSAFE_MigrationHelper.Settings_TryGet(settingsKey, out var value)) - UNSAFE_MigrationHelper.Settings_Update(settingsKey, translatePath(value)); + UNSAFE_MigrationHelper.Settings_Delete("DecryptInProgressEnum"); } { // appsettings.json @@ -460,11 +459,11 @@ namespace LibationLauncher config.LibationFiles, AudibleFileStorage.BooksDirectory, - config.DownloadsInProgressEnum, + config.InProgress, + DownloadsInProgressDir = AudibleFileStorage.DownloadsInProgress, DownloadsInProgressFiles = Directory.EnumerateFiles(AudibleFileStorage.DownloadsInProgress).Count(), - config.DecryptInProgressEnum, DecryptInProgressDir = AudibleFileStorage.DecryptInProgress, DecryptInProgressFiles = Directory.EnumerateFiles(AudibleFileStorage.DecryptInProgress).Count(), }); diff --git a/LibationWinForms/Dialogs/LibationFilesDialog.Designer.cs b/LibationWinForms/Dialogs/LibationFilesDialog.Designer.cs index 64a0b8fb..91204087 100644 --- a/LibationWinForms/Dialogs/LibationFilesDialog.Designer.cs +++ b/LibationWinForms/Dialogs/LibationFilesDialog.Designer.cs @@ -31,7 +31,7 @@ this.libationFilesDescLbl = new System.Windows.Forms.Label(); this.cancelBtn = new System.Windows.Forms.Button(); this.saveBtn = new System.Windows.Forms.Button(); - this.directoryOrCustomSelectControl = new LibationWinForms.Dialogs.DirectoryOrCustomSelectControl(); + this.libationFilesSelectControl = new LibationWinForms.Dialogs.DirectoryOrCustomSelectControl(); this.SuspendLayout(); // // libationFilesDescLbl @@ -52,7 +52,7 @@ this.cancelBtn.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); this.cancelBtn.Name = "cancelBtn"; this.cancelBtn.Size = new System.Drawing.Size(88, 27); - this.cancelBtn.TabIndex = 10; + this.cancelBtn.TabIndex = 3; this.cancelBtn.Text = "Cancel"; this.cancelBtn.UseVisualStyleBackColor = true; this.cancelBtn.Click += new System.EventHandler(this.cancelBtn_Click); @@ -64,26 +64,26 @@ this.saveBtn.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); this.saveBtn.Name = "saveBtn"; this.saveBtn.Size = new System.Drawing.Size(88, 27); - this.saveBtn.TabIndex = 9; + this.saveBtn.TabIndex = 2; this.saveBtn.Text = "Save"; this.saveBtn.UseVisualStyleBackColor = true; this.saveBtn.Click += new System.EventHandler(this.saveBtn_Click); // - // directoryOrCustomSelectControl + // libationFilesSelectControl // - this.directoryOrCustomSelectControl.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + this.libationFilesSelectControl.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.directoryOrCustomSelectControl.Location = new System.Drawing.Point(14, 28); - this.directoryOrCustomSelectControl.Name = "directoryOrCustomSelectControl"; - this.directoryOrCustomSelectControl.Size = new System.Drawing.Size(909, 81); - this.directoryOrCustomSelectControl.TabIndex = 11; + this.libationFilesSelectControl.Location = new System.Drawing.Point(14, 28); + this.libationFilesSelectControl.Name = "libationFilesSelectControl"; + this.libationFilesSelectControl.Size = new System.Drawing.Size(909, 81); + this.libationFilesSelectControl.TabIndex = 1; // // LibationFilesDialog // this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(933, 158); - this.Controls.Add(this.directoryOrCustomSelectControl); + this.Controls.Add(this.libationFilesSelectControl); this.Controls.Add(this.cancelBtn); this.Controls.Add(this.saveBtn); this.Controls.Add(this.libationFilesDescLbl); @@ -103,6 +103,6 @@ private System.Windows.Forms.Label libationFilesDescLbl; private System.Windows.Forms.Button cancelBtn; private System.Windows.Forms.Button saveBtn; - private DirectoryOrCustomSelectControl directoryOrCustomSelectControl; + private DirectoryOrCustomSelectControl libationFilesSelectControl; } } \ No newline at end of file diff --git a/LibationWinForms/Dialogs/LibationFilesDialog.cs b/LibationWinForms/Dialogs/LibationFilesDialog.cs index 4fa7757c..012eba06 100644 --- a/LibationWinForms/Dialogs/LibationFilesDialog.cs +++ b/LibationWinForms/Dialogs/LibationFilesDialog.cs @@ -18,19 +18,19 @@ namespace LibationWinForms.Dialogs libationFilesDescLbl.Text = desc(nameof(config.LibationFiles)); - directoryOrCustomSelectControl.SetSearchTitle("Libation Files"); - directoryOrCustomSelectControl.SetDirectoryItems(new() + libationFilesSelectControl.SetSearchTitle("Libation Files"); + libationFilesSelectControl.SetDirectoryItems(new() { Configuration.KnownDirectories.UserProfile, Configuration.KnownDirectories.AppDir, Configuration.KnownDirectories.MyDocs }, Configuration.KnownDirectories.UserProfile); - directoryOrCustomSelectControl.SelectDirectory(config.LibationFiles); + libationFilesSelectControl.SelectDirectory(config.LibationFiles); } private void saveBtn_Click(object sender, EventArgs e) { - var libationDir = directoryOrCustomSelectControl.SelectedDirectory; + var libationDir = libationFilesSelectControl.SelectedDirectory; if (!config.TrySetLibationFiles(libationDir)) { MessageBox.Show("Not saving change to Libation Files location. This folder does not exist:\r\n" + libationDir); diff --git a/LibationWinForms/Dialogs/SettingsDialog.Designer.cs b/LibationWinForms/Dialogs/SettingsDialog.Designer.cs index 1ad478c2..8a7dbe2c 100644 --- a/LibationWinForms/Dialogs/SettingsDialog.Designer.cs +++ b/LibationWinForms/Dialogs/SettingsDialog.Designer.cs @@ -29,173 +29,55 @@ private void InitializeComponent() { this.booksLocationLbl = new System.Windows.Forms.Label(); - this.booksLocationTb = new System.Windows.Forms.TextBox(); - this.booksLocationSearchBtn = new System.Windows.Forms.Button(); this.booksLocationDescLbl = new System.Windows.Forms.Label(); - this.downloadsInProgressGb = new System.Windows.Forms.GroupBox(); - this.downloadsInProgressLibationFilesRb = new System.Windows.Forms.RadioButton(); - this.downloadsInProgressWinTempRb = new System.Windows.Forms.RadioButton(); - this.downloadsInProgressDescLbl = new System.Windows.Forms.Label(); - this.decryptInProgressGb = new System.Windows.Forms.GroupBox(); - this.decryptInProgressLibationFilesRb = new System.Windows.Forms.RadioButton(); - this.decryptInProgressWinTempRb = new System.Windows.Forms.RadioButton(); - this.decryptInProgressDescLbl = new System.Windows.Forms.Label(); + this.inProgressDescLbl = new System.Windows.Forms.Label(); this.saveBtn = new System.Windows.Forms.Button(); this.cancelBtn = new System.Windows.Forms.Button(); this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.inProgressSelectControl = new LibationWinForms.Dialogs.DirectorySelectControl(); this.allowLibationFixupCbox = new System.Windows.Forms.CheckBox(); - this.downloadsInProgressGb.SuspendLayout(); - this.decryptInProgressGb.SuspendLayout(); + this.booksSelectControl = new LibationWinForms.Dialogs.DirectoryOrCustomSelectControl(); this.groupBox1.SuspendLayout(); this.SuspendLayout(); // // booksLocationLbl // this.booksLocationLbl.AutoSize = true; - this.booksLocationLbl.Location = new System.Drawing.Point(14, 20); + this.booksLocationLbl.Location = new System.Drawing.Point(13, 15); this.booksLocationLbl.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.booksLocationLbl.Name = "booksLocationLbl"; this.booksLocationLbl.Size = new System.Drawing.Size(85, 15); this.booksLocationLbl.TabIndex = 0; this.booksLocationLbl.Text = "Books location"; // - // booksLocationTb - // - this.booksLocationTb.Location = new System.Drawing.Point(111, 16); - this.booksLocationTb.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); - this.booksLocationTb.Name = "booksLocationTb"; - this.booksLocationTb.Size = new System.Drawing.Size(760, 23); - this.booksLocationTb.TabIndex = 1; - // - // booksLocationSearchBtn - // - this.booksLocationSearchBtn.Location = new System.Drawing.Point(878, 14); - this.booksLocationSearchBtn.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); - this.booksLocationSearchBtn.Name = "booksLocationSearchBtn"; - this.booksLocationSearchBtn.Size = new System.Drawing.Size(41, 27); - this.booksLocationSearchBtn.TabIndex = 2; - this.booksLocationSearchBtn.Text = "..."; - this.booksLocationSearchBtn.UseVisualStyleBackColor = true; - this.booksLocationSearchBtn.Click += new System.EventHandler(this.booksLocationSearchBtn_Click); - // // booksLocationDescLbl // this.booksLocationDescLbl.AutoSize = true; - this.booksLocationDescLbl.Location = new System.Drawing.Point(107, 43); + this.booksLocationDescLbl.Location = new System.Drawing.Point(106, 96); this.booksLocationDescLbl.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.booksLocationDescLbl.Name = "booksLocationDescLbl"; this.booksLocationDescLbl.Size = new System.Drawing.Size(39, 15); - this.booksLocationDescLbl.TabIndex = 3; + this.booksLocationDescLbl.TabIndex = 2; this.booksLocationDescLbl.Text = "[desc]"; // - // downloadsInProgressGb + // inProgressDescLbl // - this.downloadsInProgressGb.Controls.Add(this.downloadsInProgressLibationFilesRb); - this.downloadsInProgressGb.Controls.Add(this.downloadsInProgressWinTempRb); - this.downloadsInProgressGb.Controls.Add(this.downloadsInProgressDescLbl); - this.downloadsInProgressGb.Location = new System.Drawing.Point(10, 49); - this.downloadsInProgressGb.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); - this.downloadsInProgressGb.Name = "downloadsInProgressGb"; - this.downloadsInProgressGb.Padding = new System.Windows.Forms.Padding(4, 3, 4, 3); - this.downloadsInProgressGb.Size = new System.Drawing.Size(884, 135); - this.downloadsInProgressGb.TabIndex = 4; - this.downloadsInProgressGb.TabStop = false; - this.downloadsInProgressGb.Text = "Downloads in progress"; - // - // downloadsInProgressLibationFilesRb - // - this.downloadsInProgressLibationFilesRb.AutoSize = true; - this.downloadsInProgressLibationFilesRb.CheckAlign = System.Drawing.ContentAlignment.TopLeft; - this.downloadsInProgressLibationFilesRb.Location = new System.Drawing.Point(10, 93); - this.downloadsInProgressLibationFilesRb.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); - this.downloadsInProgressLibationFilesRb.Name = "downloadsInProgressLibationFilesRb"; - this.downloadsInProgressLibationFilesRb.Size = new System.Drawing.Size(215, 34); - this.downloadsInProgressLibationFilesRb.TabIndex = 2; - this.downloadsInProgressLibationFilesRb.TabStop = true; - this.downloadsInProgressLibationFilesRb.Text = "[desc]\r\n[libationFiles\\DownloadsInProgress]"; - this.downloadsInProgressLibationFilesRb.UseVisualStyleBackColor = true; - // - // downloadsInProgressWinTempRb - // - this.downloadsInProgressWinTempRb.AutoSize = true; - this.downloadsInProgressWinTempRb.CheckAlign = System.Drawing.ContentAlignment.TopLeft; - this.downloadsInProgressWinTempRb.Location = new System.Drawing.Point(10, 52); - this.downloadsInProgressWinTempRb.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); - this.downloadsInProgressWinTempRb.Name = "downloadsInProgressWinTempRb"; - this.downloadsInProgressWinTempRb.Size = new System.Drawing.Size(200, 34); - this.downloadsInProgressWinTempRb.TabIndex = 1; - this.downloadsInProgressWinTempRb.TabStop = true; - this.downloadsInProgressWinTempRb.Text = "[desc]\r\n[winTemp\\DownloadsInProgress]"; - this.downloadsInProgressWinTempRb.UseVisualStyleBackColor = true; - // - // downloadsInProgressDescLbl - // - this.downloadsInProgressDescLbl.AutoSize = true; - this.downloadsInProgressDescLbl.Location = new System.Drawing.Point(7, 18); - this.downloadsInProgressDescLbl.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.downloadsInProgressDescLbl.Name = "downloadsInProgressDescLbl"; - this.downloadsInProgressDescLbl.Size = new System.Drawing.Size(43, 30); - this.downloadsInProgressDescLbl.TabIndex = 0; - this.downloadsInProgressDescLbl.Text = "[desc]\r\n[line 2]"; - // - // decryptInProgressGb - // - this.decryptInProgressGb.Controls.Add(this.decryptInProgressLibationFilesRb); - this.decryptInProgressGb.Controls.Add(this.decryptInProgressWinTempRb); - this.decryptInProgressGb.Controls.Add(this.decryptInProgressDescLbl); - this.decryptInProgressGb.Location = new System.Drawing.Point(10, 193); - this.decryptInProgressGb.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); - this.decryptInProgressGb.Name = "decryptInProgressGb"; - this.decryptInProgressGb.Padding = new System.Windows.Forms.Padding(4, 3, 4, 3); - this.decryptInProgressGb.Size = new System.Drawing.Size(884, 135); - this.decryptInProgressGb.TabIndex = 5; - this.decryptInProgressGb.TabStop = false; - this.decryptInProgressGb.Text = "Decrypt in progress"; - // - // decryptInProgressLibationFilesRb - // - this.decryptInProgressLibationFilesRb.AutoSize = true; - this.decryptInProgressLibationFilesRb.CheckAlign = System.Drawing.ContentAlignment.TopLeft; - this.decryptInProgressLibationFilesRb.Location = new System.Drawing.Point(7, 93); - this.decryptInProgressLibationFilesRb.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); - this.decryptInProgressLibationFilesRb.Name = "decryptInProgressLibationFilesRb"; - this.decryptInProgressLibationFilesRb.Size = new System.Drawing.Size(197, 34); - this.decryptInProgressLibationFilesRb.TabIndex = 2; - this.decryptInProgressLibationFilesRb.TabStop = true; - this.decryptInProgressLibationFilesRb.Text = "[desc]\r\n[libationFiles\\DecryptInProgress]"; - this.decryptInProgressLibationFilesRb.UseVisualStyleBackColor = true; - // - // decryptInProgressWinTempRb - // - this.decryptInProgressWinTempRb.AutoSize = true; - this.decryptInProgressWinTempRb.CheckAlign = System.Drawing.ContentAlignment.TopLeft; - this.decryptInProgressWinTempRb.Location = new System.Drawing.Point(7, 52); - this.decryptInProgressWinTempRb.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); - this.decryptInProgressWinTempRb.Name = "decryptInProgressWinTempRb"; - this.decryptInProgressWinTempRb.Size = new System.Drawing.Size(182, 34); - this.decryptInProgressWinTempRb.TabIndex = 1; - this.decryptInProgressWinTempRb.TabStop = true; - this.decryptInProgressWinTempRb.Text = "[desc]\r\n[winTemp\\DecryptInProgress]"; - this.decryptInProgressWinTempRb.UseVisualStyleBackColor = true; - // - // decryptInProgressDescLbl - // - this.decryptInProgressDescLbl.AutoSize = true; - this.decryptInProgressDescLbl.Location = new System.Drawing.Point(7, 18); - this.decryptInProgressDescLbl.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.decryptInProgressDescLbl.Name = "decryptInProgressDescLbl"; - this.decryptInProgressDescLbl.Size = new System.Drawing.Size(43, 30); - this.decryptInProgressDescLbl.TabIndex = 0; - this.decryptInProgressDescLbl.Text = "[desc]\r\n[line 2]"; + this.inProgressDescLbl.AutoSize = true; + this.inProgressDescLbl.Location = new System.Drawing.Point(10, 46); + this.inProgressDescLbl.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.inProgressDescLbl.Name = "inProgressDescLbl"; + this.inProgressDescLbl.Size = new System.Drawing.Size(43, 45); + this.inProgressDescLbl.TabIndex = 1; + this.inProgressDescLbl.Text = "[desc]\r\n[line 2]\r\n[line 3]"; // // saveBtn // this.saveBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.saveBtn.Location = new System.Drawing.Point(714, 401); + this.saveBtn.Location = new System.Drawing.Point(714, 275); this.saveBtn.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); this.saveBtn.Name = "saveBtn"; this.saveBtn.Size = new System.Drawing.Size(88, 27); - this.saveBtn.TabIndex = 7; + this.saveBtn.TabIndex = 4; this.saveBtn.Text = "Save"; this.saveBtn.UseVisualStyleBackColor = true; this.saveBtn.Click += new System.EventHandler(this.saveBtn_Click); @@ -204,52 +86,69 @@ // this.cancelBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.cancelBtn.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this.cancelBtn.Location = new System.Drawing.Point(832, 401); + this.cancelBtn.Location = new System.Drawing.Point(832, 275); this.cancelBtn.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); this.cancelBtn.Name = "cancelBtn"; this.cancelBtn.Size = new System.Drawing.Size(88, 27); - this.cancelBtn.TabIndex = 8; + this.cancelBtn.TabIndex = 5; this.cancelBtn.Text = "Cancel"; this.cancelBtn.UseVisualStyleBackColor = true; this.cancelBtn.Click += new System.EventHandler(this.cancelBtn_Click); // // groupBox1 // + this.groupBox1.Controls.Add(this.inProgressSelectControl); this.groupBox1.Controls.Add(this.allowLibationFixupCbox); - this.groupBox1.Controls.Add(this.downloadsInProgressGb); - this.groupBox1.Controls.Add(this.decryptInProgressGb); - this.groupBox1.Location = new System.Drawing.Point(18, 61); + this.groupBox1.Controls.Add(this.inProgressDescLbl); + this.groupBox1.Location = new System.Drawing.Point(19, 114); this.groupBox1.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); this.groupBox1.Name = "groupBox1"; this.groupBox1.Padding = new System.Windows.Forms.Padding(4, 3, 4, 3); - this.groupBox1.Size = new System.Drawing.Size(902, 334); - this.groupBox1.TabIndex = 6; + this.groupBox1.Size = new System.Drawing.Size(902, 145); + this.groupBox1.TabIndex = 3; this.groupBox1.TabStop = false; this.groupBox1.Text = "Advanced settings for control freaks"; // + // inProgressSelectControl + // + this.inProgressSelectControl.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.inProgressSelectControl.Location = new System.Drawing.Point(10, 94); + this.inProgressSelectControl.Name = "inProgressSelectControl"; + this.inProgressSelectControl.Size = new System.Drawing.Size(885, 46); + this.inProgressSelectControl.TabIndex = 2; + // // allowLibationFixupCbox // this.allowLibationFixupCbox.AutoSize = true; this.allowLibationFixupCbox.Location = new System.Drawing.Point(10, 24); this.allowLibationFixupCbox.Name = "allowLibationFixupCbox"; this.allowLibationFixupCbox.Size = new System.Drawing.Size(262, 19); - this.allowLibationFixupCbox.TabIndex = 6; + this.allowLibationFixupCbox.TabIndex = 0; this.allowLibationFixupCbox.Text = "Allow Libation to fix up audiobook metadata"; this.allowLibationFixupCbox.UseVisualStyleBackColor = true; // + // booksSelectControl + // + this.booksSelectControl.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.booksSelectControl.Location = new System.Drawing.Point(106, 12); + this.booksSelectControl.Name = "booksSelectControl"; + this.booksSelectControl.Size = new System.Drawing.Size(815, 81); + this.booksSelectControl.TabIndex = 1; + // // SettingsDialog // this.AcceptButton = this.saveBtn; this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.CancelButton = this.cancelBtn; - this.ClientSize = new System.Drawing.Size(933, 442); + this.ClientSize = new System.Drawing.Size(933, 316); + this.Controls.Add(this.booksSelectControl); this.Controls.Add(this.groupBox1); this.Controls.Add(this.cancelBtn); this.Controls.Add(this.saveBtn); this.Controls.Add(this.booksLocationDescLbl); - this.Controls.Add(this.booksLocationSearchBtn); - this.Controls.Add(this.booksLocationTb); this.Controls.Add(this.booksLocationLbl); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; this.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); @@ -257,10 +156,6 @@ this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.Text = "Edit Settings"; this.Load += new System.EventHandler(this.SettingsDialog_Load); - this.downloadsInProgressGb.ResumeLayout(false); - this.downloadsInProgressGb.PerformLayout(); - this.decryptInProgressGb.ResumeLayout(false); - this.decryptInProgressGb.PerformLayout(); this.groupBox1.ResumeLayout(false); this.groupBox1.PerformLayout(); this.ResumeLayout(false); @@ -270,20 +165,13 @@ #endregion private System.Windows.Forms.Label booksLocationLbl; - private System.Windows.Forms.TextBox booksLocationTb; - private System.Windows.Forms.Button booksLocationSearchBtn; private System.Windows.Forms.Label booksLocationDescLbl; - private System.Windows.Forms.GroupBox downloadsInProgressGb; - private System.Windows.Forms.Label downloadsInProgressDescLbl; - private System.Windows.Forms.RadioButton downloadsInProgressWinTempRb; - private System.Windows.Forms.RadioButton downloadsInProgressLibationFilesRb; - private System.Windows.Forms.GroupBox decryptInProgressGb; - private System.Windows.Forms.Label decryptInProgressDescLbl; - private System.Windows.Forms.RadioButton decryptInProgressLibationFilesRb; - private System.Windows.Forms.RadioButton decryptInProgressWinTempRb; + private System.Windows.Forms.Label inProgressDescLbl; private System.Windows.Forms.Button saveBtn; private System.Windows.Forms.Button cancelBtn; private System.Windows.Forms.GroupBox groupBox1; private System.Windows.Forms.CheckBox allowLibationFixupCbox; - } + private DirectoryOrCustomSelectControl booksSelectControl; + private DirectorySelectControl inProgressSelectControl; + } } \ No newline at end of file diff --git a/LibationWinForms/Dialogs/SettingsDialog.cs b/LibationWinForms/Dialogs/SettingsDialog.cs index 149a220f..2479ef91 100644 --- a/LibationWinForms/Dialogs/SettingsDialog.cs +++ b/LibationWinForms/Dialogs/SettingsDialog.cs @@ -1,7 +1,6 @@ using System; using System.IO; using System.Windows.Forms; -using Dinah.Core; using FileManager; namespace LibationWinForms.Dialogs @@ -19,64 +18,37 @@ namespace LibationWinForms.Dialogs return; this.booksLocationDescLbl.Text = desc(nameof(config.Books)); - this.downloadsInProgressDescLbl.Text = desc(nameof(config.DownloadsInProgressEnum)); - this.decryptInProgressDescLbl.Text = desc(nameof(config.DecryptInProgressEnum)); + this.inProgressDescLbl.Text = desc(nameof(config.InProgress)); - var winTempText = "In your Windows temporary folder\r\n"; - this.downloadsInProgressWinTempRb.Text = $"{winTempText}{Path.Combine(Configuration.WinTemp, "DownloadsInProgress")}"; - this.decryptInProgressWinTempRb.Text = $"{winTempText}{Path.Combine(Configuration.WinTemp, "DecryptInProgress")}"; - - var libFileText = "In your Libation Files (ie: program-created files)\r\n"; - this.downloadsInProgressLibationFilesRb.Text = $"{libFileText}{Path.Combine(config.LibationFiles, "DownloadsInProgress")}"; - this.decryptInProgressLibationFilesRb.Text = $"{libFileText}{Path.Combine(config.LibationFiles, "DecryptInProgress")}"; - - this.booksLocationTb.Text - = !string.IsNullOrWhiteSpace(config.Books) - ? config.Books - : Path.GetDirectoryName(Exe.FileLocationOnDisk); + booksSelectControl.SetSearchTitle("books location"); + booksSelectControl.SetDirectoryItems(new() + { + Configuration.KnownDirectories.UserProfile, + Configuration.KnownDirectories.AppDir, + Configuration.KnownDirectories.MyDocs + }, Configuration.KnownDirectories.UserProfile); + booksSelectControl.SelectDirectory(config.Books); allowLibationFixupCbox.Checked = config.AllowLibationFixup; - switch (config.DownloadsInProgressEnum) + inProgressSelectControl.SetDirectoryItems(new() { - case Configuration.LIBATION_FILES_LABEL: - downloadsInProgressLibationFilesRb.Checked = true; - break; - case Configuration.WIN_TEMP_LABEL: - default: - downloadsInProgressWinTempRb.Checked = true; - break; - } - - switch (config.DecryptInProgressEnum) - { - case Configuration.LIBATION_FILES_LABEL: - decryptInProgressLibationFilesRb.Checked = true; - break; - case Configuration.WIN_TEMP_LABEL: - default: - decryptInProgressWinTempRb.Checked = true; - break; - } - } - - private void booksLocationSearchBtn_Click(object sender, EventArgs e) => selectFolder("Search for books location", this.booksLocationTb); - - private static void selectFolder(string desc, TextBox textbox) - { - using var dialog = new FolderBrowserDialog { Description = desc, SelectedPath = "" }; - dialog.ShowDialog(); - if (!string.IsNullOrWhiteSpace(dialog.SelectedPath)) - textbox.Text = dialog.SelectedPath; + Configuration.KnownDirectories.WinTemp, + Configuration.KnownDirectories.UserProfile, + Configuration.KnownDirectories.AppDir, + Configuration.KnownDirectories.MyDocs, + Configuration.KnownDirectories.LibationFiles + }, Configuration.KnownDirectories.WinTemp); + inProgressSelectControl.SelectDirectory(config.InProgress); } private void saveBtn_Click(object sender, EventArgs e) { config.AllowLibationFixup = allowLibationFixupCbox.Checked; - config.DownloadsInProgressEnum = downloadsInProgressLibationFilesRb.Checked ? Configuration.LIBATION_FILES_LABEL : Configuration.WIN_TEMP_LABEL; - config.DecryptInProgressEnum = decryptInProgressLibationFilesRb.Checked ? Configuration.LIBATION_FILES_LABEL : Configuration.WIN_TEMP_LABEL; - var newBooks = this.booksLocationTb.Text; + config.InProgress = inProgressSelectControl.SelectedDirectory; + + var newBooks = booksSelectControl.SelectedDirectory; if (!Directory.Exists(newBooks)) { MessageBox.Show($"Not saving change to Books location. This folder does not exist:\r\n{newBooks}"); diff --git a/LibationWinForms/Dialogs/SettingsDialog.resx b/LibationWinForms/Dialogs/SettingsDialog.resx index 4f016953..f298a7be 100644 --- a/LibationWinForms/Dialogs/SettingsDialog.resx +++ b/LibationWinForms/Dialogs/SettingsDialog.resx @@ -57,67 +57,4 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - \ No newline at end of file diff --git a/LibationWinForms/Dialogs/TEMP_TestNewControls.Designer.cs b/LibationWinForms/Dialogs/TEMP_TestNewControls.Designer.cs deleted file mode 100644 index e66458d4..00000000 --- a/LibationWinForms/Dialogs/TEMP_TestNewControls.Designer.cs +++ /dev/null @@ -1,81 +0,0 @@ - -namespace LibationWinForms.Dialogs -{ - partial class TEMP_TestNewControls - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.button1 = new System.Windows.Forms.Button(); - this.directorySelectControl1 = new LibationWinForms.Dialogs.DirectorySelectControl(); - this.directoryOrCustomSelectControl1 = new LibationWinForms.Dialogs.DirectoryOrCustomSelectControl(); - this.SuspendLayout(); - // - // button1 - // - this.button1.Location = new System.Drawing.Point(438, 375); - this.button1.Name = "button1"; - this.button1.Size = new System.Drawing.Size(75, 23); - this.button1.TabIndex = 2; - this.button1.Text = "button1"; - this.button1.UseVisualStyleBackColor = true; - this.button1.Click += new System.EventHandler(this.button1_Click); - // - // directorySelectControl1 - // - this.directorySelectControl1.Location = new System.Drawing.Point(30, 54); - this.directorySelectControl1.Name = "directorySelectControl1"; - this.directorySelectControl1.Size = new System.Drawing.Size(758, 46); - this.directorySelectControl1.TabIndex = 4; - // - // directoryOrCustomSelectControl1 - // - this.directoryOrCustomSelectControl1.Location = new System.Drawing.Point(128, 199); - this.directoryOrCustomSelectControl1.Name = "directoryOrCustomSelectControl1"; - this.directoryOrCustomSelectControl1.Size = new System.Drawing.Size(660, 81); - this.directoryOrCustomSelectControl1.TabIndex = 5; - // - // TEMP_TestNewControls - // - this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(800, 450); - this.Controls.Add(this.directoryOrCustomSelectControl1); - this.Controls.Add(this.directorySelectControl1); - this.Controls.Add(this.button1); - this.Name = "TEMP_TestNewControls"; - this.Text = "TEMP_TestNewControls"; - this.Load += new System.EventHandler(this.TEMP_TestNewControls_Load); - this.ResumeLayout(false); - - } - - #endregion - private System.Windows.Forms.Button button1; - private DirectorySelectControl directorySelectControl1; - private DirectoryOrCustomSelectControl directoryOrCustomSelectControl1; - } -} \ No newline at end of file diff --git a/LibationWinForms/Dialogs/TEMP_TestNewControls.cs b/LibationWinForms/Dialogs/TEMP_TestNewControls.cs deleted file mode 100644 index 3acf65e2..00000000 --- a/LibationWinForms/Dialogs/TEMP_TestNewControls.cs +++ /dev/null @@ -1,89 +0,0 @@ -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 LibationWinForms.Dialogs -{ - public partial class TEMP_TestNewControls : Form - { - public TEMP_TestNewControls() - { - InitializeComponent(); - } - - private void TEMP_TestNewControls_Load(object sender, EventArgs e) - { - - if (this.DesignMode) - return; - - - - { - var dirCtrl = this.directorySelectControl1; - dirCtrl.SetDirectoryItems(new() - { - FileManager.Configuration.KnownDirectories.AppDir, - FileManager.Configuration.KnownDirectories.MyDocs, - FileManager.Configuration.KnownDirectories.LibationFiles, - FileManager.Configuration.KnownDirectories.MyDocs, - FileManager.Configuration.KnownDirectories.None, - FileManager.Configuration.KnownDirectories.WinTemp, - FileManager.Configuration.KnownDirectories.UserProfile - } - , - FileManager.Configuration.KnownDirectories.MyDocs - ); - } - - - - { - var dirOrCustCtrl = this.directoryOrCustomSelectControl1; - dirOrCustCtrl.SetSearchTitle("Libation Files"); - dirOrCustCtrl.SetDirectoryItems(new() - { - FileManager.Configuration.KnownDirectories.AppDir, - FileManager.Configuration.KnownDirectories.MyDocs, - FileManager.Configuration.KnownDirectories.LibationFiles, - FileManager.Configuration.KnownDirectories.MyDocs, - FileManager.Configuration.KnownDirectories.None, - FileManager.Configuration.KnownDirectories.WinTemp, - FileManager.Configuration.KnownDirectories.UserProfile - } - , - FileManager.Configuration.KnownDirectories.MyDocs - ); - } - - - - } - - private void button1_Click(object sender, EventArgs e) - { - - - - var dirCtrl = this.directorySelectControl1; - var x = dirCtrl.SelectedDirectory; - dirCtrl.SelectDirectory(FileManager.Configuration.KnownDirectories.UserProfile); - - - - - var dirOrCustCtrl = this.directoryOrCustomSelectControl1; - var y = dirOrCustCtrl.SelectedDirectory; - dirOrCustCtrl.SelectDirectory(FileManager.Configuration.KnownDirectories.UserProfile); - - - - } - } -} \ No newline at end of file diff --git a/LibationWinForms/Dialogs/TEMP_TestNewControls.resx b/LibationWinForms/Dialogs/TEMP_TestNewControls.resx deleted file mode 100644 index f298a7be..00000000 --- a/LibationWinForms/Dialogs/TEMP_TestNewControls.resx +++ /dev/null @@ -1,60 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 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 - - \ No newline at end of file