From b65f9567e0b186eb14eac7e06e42c4cc7bcf8796 Mon Sep 17 00:00:00 2001 From: Michael Bucari-Tovo Date: Mon, 28 Jun 2021 12:55:56 -0600 Subject: [PATCH] Added user option to download chapter titles from Audible. --- .../DownloadDecryptBook.cs | 22 +- FileManager/Configuration.cs | 8 +- LibationLauncher/Program.cs | 8 + .../Dialogs/SettingsDialog.Designer.cs | 445 ++++++++++-------- LibationWinForms/Dialogs/SettingsDialog.cs | 3 + LibationWinForms/Dialogs/SettingsDialog.resx | 134 +++--- 6 files changed, 346 insertions(+), 274 deletions(-) diff --git a/FileLiberator/AaxcDownloadDecrypt/DownloadDecryptBook.cs b/FileLiberator/AaxcDownloadDecrypt/DownloadDecryptBook.cs index 926a6e53..09e9cc65 100644 --- a/FileLiberator/AaxcDownloadDecrypt/DownloadDecryptBook.cs +++ b/FileLiberator/AaxcDownloadDecrypt/DownloadDecryptBook.cs @@ -70,16 +70,26 @@ namespace FileLiberator.AaxcDownloadDecrypt var dlLic = await api.GetDownloadLicenseAsync(libraryBook.Book.AudibleProductId); - var contentMetadata = await api.GetLibraryBookMetadataAsync(libraryBook.Book.AudibleProductId); + var aaxcDecryptDlLic = new DownloadLicense(dlLic.DownloadUrl, dlLic.AudibleKey, dlLic.AudibleIV, Resources.UserAgent); - var aaxcDecryptDlLic = new AaxDecrypter.DownloadLicense(dlLic.DownloadUrl, dlLic.AudibleKey, dlLic.AudibleIV, Resources.UserAgent); + var destinationDirectory = Path.GetDirectoryName(destinationDir); - var aaxcDecryptChapters = new AaxDecrypter.ChapterInfo(); + AaxcDownloadConverter newDownloader; + if (Configuration.Instance.DownloadChapters) + { + var contentMetadata = await api.GetLibraryBookMetadataAsync(libraryBook.Book.AudibleProductId); - foreach (var chap in contentMetadata?.ChapterInfo?.Chapters) - aaxcDecryptChapters.AddChapter(new Chapter(chap.Title, chap.StartOffsetMs, chap.LengthMs)); + var aaxcDecryptChapters = new ChapterInfo(); - var newDownloader = await AaxcDownloadConverter.CreateAsync(Path.GetDirectoryName(destinationDir), aaxcDecryptDlLic, aaxcDecryptChapters); + foreach (var chap in contentMetadata?.ChapterInfo?.Chapters) + aaxcDecryptChapters.AddChapter(new Chapter(chap.Title, chap.StartOffsetMs, chap.LengthMs)); + + newDownloader = await AaxcDownloadConverter.CreateAsync(destinationDirectory, aaxcDecryptDlLic, aaxcDecryptChapters); + } + else + { + newDownloader = await AaxcDownloadConverter.CreateAsync(destinationDirectory, aaxcDecryptDlLic); + } newDownloader.AppName = "Libation"; diff --git a/FileManager/Configuration.cs b/FileManager/Configuration.cs index 951d007d..2f72616e 100644 --- a/FileManager/Configuration.cs +++ b/FileManager/Configuration.cs @@ -82,7 +82,13 @@ namespace FileManager get => persistentDictionary.GetString(nameof(DecryptInProgressEnum)); set => persistentDictionary.Set(nameof(DecryptInProgressEnum), value); } - + + [Description("Download chapter titles from Audible?")] + public bool DownloadChapters + { + get => persistentDictionary.Get(nameof(DownloadChapters)); + set => persistentDictionary.Set(nameof(DownloadChapters), value); + } // note: any potential file manager static ctors can't compensate if storage dir is changed at run time via settings. this is partly bad architecture. but the side effect is desirable. if changing LibationFiles location: restart app // singleton stuff diff --git a/LibationLauncher/Program.cs b/LibationLauncher/Program.cs index bc001ad6..ea9d6f09 100644 --- a/LibationLauncher/Program.cs +++ b/LibationLauncher/Program.cs @@ -60,6 +60,7 @@ namespace LibationLauncher config.DownloadsInProgressEnum ??= "WinTemp"; config.DecryptInProgressEnum ??= "WinTemp"; config.Books ??= Configuration.AppDir; + config.DownloadChapters = true; }; // setupDialog.BasicBtn_Click += (_, __) => // no action needed setupDialog.AdvancedBtn_Click += (_, __) => isAdvanced = true; @@ -232,6 +233,13 @@ namespace LibationLauncher #region migrate_to_v5_0_0 re-gegister device if device info not in settings private static void migrate_to_v5_0_0() { + var persistentDictionary = new PersistentDictionary(Configuration.Instance.SettingsFilePath); + + if (persistentDictionary.GetString("DownloadChapters") is null) + { + persistentDictionary.Set("DownloadChapters", true); + } + if (!File.Exists(AudibleApiStorage.AccountsSettingsFile)) return; diff --git a/LibationWinForms/Dialogs/SettingsDialog.Designer.cs b/LibationWinForms/Dialogs/SettingsDialog.Designer.cs index dbab722f..76d1791b 100644 --- a/LibationWinForms/Dialogs/SettingsDialog.Designer.cs +++ b/LibationWinForms/Dialogs/SettingsDialog.Designer.cs @@ -28,211 +28,243 @@ /// 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.saveBtn = new System.Windows.Forms.Button(); - this.cancelBtn = new System.Windows.Forms.Button(); - this.groupBox1 = new System.Windows.Forms.GroupBox(); - this.downloadsInProgressGb.SuspendLayout(); - this.decryptInProgressGb.SuspendLayout(); - this.groupBox1.SuspendLayout(); - this.SuspendLayout(); - // - // booksLocationLbl - // - this.booksLocationLbl.AutoSize = true; - this.booksLocationLbl.Location = new System.Drawing.Point(12, 17); - this.booksLocationLbl.Name = "booksLocationLbl"; - this.booksLocationLbl.Size = new System.Drawing.Size(77, 13); - this.booksLocationLbl.TabIndex = 0; - this.booksLocationLbl.Text = "Books location"; - // - // booksLocationTb - // - this.booksLocationTb.Location = new System.Drawing.Point(95, 14); - this.booksLocationTb.Name = "booksLocationTb"; - this.booksLocationTb.Size = new System.Drawing.Size(652, 20); - this.booksLocationTb.TabIndex = 1; - // - // booksLocationSearchBtn - // - this.booksLocationSearchBtn.Location = new System.Drawing.Point(753, 12); - this.booksLocationSearchBtn.Name = "booksLocationSearchBtn"; - this.booksLocationSearchBtn.Size = new System.Drawing.Size(35, 23); - 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(92, 37); - this.booksLocationDescLbl.Name = "booksLocationDescLbl"; - this.booksLocationDescLbl.Size = new System.Drawing.Size(36, 13); - this.booksLocationDescLbl.TabIndex = 3; - this.booksLocationDescLbl.Text = "[desc]"; - // - // downloadsInProgressGb - // - 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(15, 19); - this.downloadsInProgressGb.Name = "downloadsInProgressGb"; - this.downloadsInProgressGb.Size = new System.Drawing.Size(758, 117); - 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(9, 81); - this.downloadsInProgressLibationFilesRb.Name = "downloadsInProgressLibationFilesRb"; - this.downloadsInProgressLibationFilesRb.Size = new System.Drawing.Size(193, 30); - 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(9, 45); - this.downloadsInProgressWinTempRb.Name = "downloadsInProgressWinTempRb"; - this.downloadsInProgressWinTempRb.Size = new System.Drawing.Size(182, 30); - 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(6, 16); - this.downloadsInProgressDescLbl.Name = "downloadsInProgressDescLbl"; - this.downloadsInProgressDescLbl.Size = new System.Drawing.Size(38, 26); - 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(9, 144); - this.decryptInProgressGb.Name = "decryptInProgressGb"; - this.decryptInProgressGb.Size = new System.Drawing.Size(758, 117); - 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(6, 81); - this.decryptInProgressLibationFilesRb.Name = "decryptInProgressLibationFilesRb"; - this.decryptInProgressLibationFilesRb.Size = new System.Drawing.Size(177, 30); - 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(6, 45); - this.decryptInProgressWinTempRb.Name = "decryptInProgressWinTempRb"; - this.decryptInProgressWinTempRb.Size = new System.Drawing.Size(166, 30); - 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(6, 16); - this.decryptInProgressDescLbl.Name = "decryptInProgressDescLbl"; - this.decryptInProgressDescLbl.Size = new System.Drawing.Size(38, 26); - this.decryptInProgressDescLbl.TabIndex = 0; - this.decryptInProgressDescLbl.Text = "[desc]\r\n[line 2]"; - // - // 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(612, 328); - this.saveBtn.Name = "saveBtn"; - this.saveBtn.Size = new System.Drawing.Size(75, 23); - this.saveBtn.TabIndex = 7; - this.saveBtn.Text = "Save"; - this.saveBtn.UseVisualStyleBackColor = true; - this.saveBtn.Click += new System.EventHandler(this.saveBtn_Click); - // - // cancelBtn - // - 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(713, 328); - this.cancelBtn.Name = "cancelBtn"; - this.cancelBtn.Size = new System.Drawing.Size(75, 23); - this.cancelBtn.TabIndex = 8; - this.cancelBtn.Text = "Cancel"; - this.cancelBtn.UseVisualStyleBackColor = true; - this.cancelBtn.Click += new System.EventHandler(this.cancelBtn_Click); - // - // groupBox1 - // - this.groupBox1.Controls.Add(this.downloadsInProgressGb); - this.groupBox1.Controls.Add(this.decryptInProgressGb); - this.groupBox1.Location = new System.Drawing.Point(15, 53); - this.groupBox1.Name = "groupBox1"; - this.groupBox1.Size = new System.Drawing.Size(773, 269); - this.groupBox1.TabIndex = 6; - this.groupBox1.TabStop = false; - this.groupBox1.Text = "Advanced settings for control freaks"; - // - // SettingsDialog - // - this.AcceptButton = this.saveBtn; - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.CancelButton = this.cancelBtn; - this.ClientSize = new System.Drawing.Size(800, 363); - 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.Name = "SettingsDialog"; - 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.ResumeLayout(false); - this.PerformLayout(); + 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.saveBtn = new System.Windows.Forms.Button(); + this.cancelBtn = new System.Windows.Forms.Button(); + this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.downloadChaptersCbox = new System.Windows.Forms.CheckBox(); + this.downloadsInProgressGb.SuspendLayout(); + this.decryptInProgressGb.SuspendLayout(); + this.groupBox1.SuspendLayout(); + this.SuspendLayout(); + // + // booksLocationLbl + // + this.booksLocationLbl.AutoSize = true; + this.booksLocationLbl.Location = new System.Drawing.Point(14, 20); + 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.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.Text = "[desc]"; + // + // downloadsInProgressGb + // + 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]"; + // + // 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.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.Text = "Save"; + this.saveBtn.UseVisualStyleBackColor = true; + this.saveBtn.Click += new System.EventHandler(this.saveBtn_Click); + // + // cancelBtn + // + 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.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.Text = "Cancel"; + this.cancelBtn.UseVisualStyleBackColor = true; + this.cancelBtn.Click += new System.EventHandler(this.cancelBtn_Click); + // + // groupBox1 + // + this.groupBox1.Controls.Add(this.downloadChaptersCbox); + this.groupBox1.Controls.Add(this.downloadsInProgressGb); + this.groupBox1.Controls.Add(this.decryptInProgressGb); + this.groupBox1.Location = new System.Drawing.Point(18, 61); + 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.TabStop = false; + this.groupBox1.Text = "Advanced settings for control freaks"; + // + // downloadChaptersCbox + // + this.downloadChaptersCbox.AutoSize = true; + this.downloadChaptersCbox.Location = new System.Drawing.Point(10, 24); + this.downloadChaptersCbox.Name = "downloadChaptersCbox"; + this.downloadChaptersCbox.Size = new System.Drawing.Size(224, 19); + this.downloadChaptersCbox.TabIndex = 6; + this.downloadChaptersCbox.Text = "Download chapter titles from Audible"; + this.downloadChaptersCbox.UseVisualStyleBackColor = true; + // + // 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.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); + this.Name = "SettingsDialog"; + 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); + this.PerformLayout(); } @@ -252,5 +284,6 @@ private System.Windows.Forms.Button saveBtn; private System.Windows.Forms.Button cancelBtn; private System.Windows.Forms.GroupBox groupBox1; - } + private System.Windows.Forms.CheckBox downloadChaptersCbox; + } } \ No newline at end of file diff --git a/LibationWinForms/Dialogs/SettingsDialog.cs b/LibationWinForms/Dialogs/SettingsDialog.cs index 16dd1fe7..35bbb582 100644 --- a/LibationWinForms/Dialogs/SettingsDialog.cs +++ b/LibationWinForms/Dialogs/SettingsDialog.cs @@ -36,6 +36,8 @@ namespace LibationWinForms.Dialogs ? config.Books : Path.GetDirectoryName(Exe.FileLocationOnDisk); + downloadChaptersCbox.Checked = config.DownloadChapters; + switch (config.DownloadsInProgressEnum) { case "LibationFiles": @@ -71,6 +73,7 @@ namespace LibationWinForms.Dialogs private void saveBtn_Click(object sender, EventArgs e) { + config.DownloadChapters = downloadChaptersCbox.Checked; config.DownloadsInProgressEnum = downloadsInProgressLibationFilesRb.Checked ? "LibationFiles" : "WinTemp"; config.DecryptInProgressEnum = decryptInProgressLibationFilesRb.Checked ? "LibationFiles" : "WinTemp"; diff --git a/LibationWinForms/Dialogs/SettingsDialog.resx b/LibationWinForms/Dialogs/SettingsDialog.resx index 1af7de15..b9d23b7e 100644 --- a/LibationWinForms/Dialogs/SettingsDialog.resx +++ b/LibationWinForms/Dialogs/SettingsDialog.resx @@ -1,64 +1,4 @@ - - - + @@ -117,4 +57,76 @@ 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 + + + True + + + True + + + True + \ No newline at end of file