diff --git a/Source/AaxDecrypter/AudiobookDownloadBase.cs b/Source/AaxDecrypter/AudiobookDownloadBase.cs index 04e901ed..21cb77d1 100644 --- a/Source/AaxDecrypter/AudiobookDownloadBase.cs +++ b/Source/AaxDecrypter/AudiobookDownloadBase.cs @@ -20,7 +20,7 @@ namespace AaxDecrypter public event EventHandler DecryptTimeRemaining; public event EventHandler FileCreated; - protected bool IsCanceled { get; set; } + public bool IsCanceled { get; set; } protected string OutputFileName { get; private set; } protected DownloadOptions DownloadOptions { get; } diff --git a/Source/FileLiberator/ConvertToMp3.cs b/Source/FileLiberator/ConvertToMp3.cs index 12d758c1..35f3411e 100644 --- a/Source/FileLiberator/ConvertToMp3.cs +++ b/Source/FileLiberator/ConvertToMp3.cs @@ -14,6 +14,7 @@ namespace FileLiberator { public class ConvertToMp3 : AudioDecodable { + public override string Name => "Convert to Mp3"; private Mp4File m4bBook; private long fileSize; diff --git a/Source/FileLiberator/DownloadDecryptBook.cs b/Source/FileLiberator/DownloadDecryptBook.cs index 0717ddc4..7a9136eb 100644 --- a/Source/FileLiberator/DownloadDecryptBook.cs +++ b/Source/FileLiberator/DownloadDecryptBook.cs @@ -15,6 +15,7 @@ namespace FileLiberator { public class DownloadDecryptBook : AudioDecodable { + public override string Name => "Download & Decrypt"; private AudiobookDownloadBase abDownloader; public override bool Validate(LibraryBook libraryBook) => !libraryBook.Book.Audio_Exists; @@ -65,7 +66,9 @@ namespace FileLiberator foreach (var tmpFile in entries.Where(f => f.FileType != FileType.AAXC)) FileUtility.SaferDelete(tmpFile.Path); - return new StatusHandler { "Decrypt failed" }; + return abDownloader?.IsCanceled == true ? + new StatusHandler { "Cancelled" } : + new StatusHandler { "Decrypt failed" }; } // moves new files from temp dir to final dest diff --git a/Source/FileLiberator/DownloadPdf.cs b/Source/FileLiberator/DownloadPdf.cs index bd4817e2..2ebd155a 100644 --- a/Source/FileLiberator/DownloadPdf.cs +++ b/Source/FileLiberator/DownloadPdf.cs @@ -14,6 +14,7 @@ namespace FileLiberator { public class DownloadPdf : Processable { + public override string Name => "Download Pdf"; public override bool Validate(LibraryBook libraryBook) => !string.IsNullOrWhiteSpace(getdownloadUrl(libraryBook)) && !libraryBook.Book.PDF_Exists; diff --git a/Source/FileLiberator/Processable.cs b/Source/FileLiberator/Processable.cs index da66f0f6..b8b984ff 100644 --- a/Source/FileLiberator/Processable.cs +++ b/Source/FileLiberator/Processable.cs @@ -11,6 +11,7 @@ namespace FileLiberator { public abstract class Processable : Streamable { + public abstract string Name { get; } public event EventHandler Begin; /// General string message to display. DON'T rely on this for success, failure, or control logic diff --git a/Source/LibationWinForms/BookLiberation/AutomatedBackupsForm.cs b/Source/LibationWinForms/BookLiberation/AutomatedBackupsForm.cs index 2a800e3d..a020ecb0 100644 --- a/Source/LibationWinForms/BookLiberation/AutomatedBackupsForm.cs +++ b/Source/LibationWinForms/BookLiberation/AutomatedBackupsForm.cs @@ -4,7 +4,11 @@ using Dinah.Core.Threading; namespace LibationWinForms.BookLiberation { - public partial class AutomatedBackupsForm : Form + public interface ILogForm + { + void WriteLine(string text); + } + public partial class AutomatedBackupsForm : Form, ILogForm { public bool KeepGoingChecked => keepGoingCb.Checked; diff --git a/Source/LibationWinForms/BookLiberation/ProcessorAutomationController.cs b/Source/LibationWinForms/BookLiberation/ProcessorAutomationController.cs index eb6ac3af..78c7d4c4 100644 --- a/Source/LibationWinForms/BookLiberation/ProcessorAutomationController.cs +++ b/Source/LibationWinForms/BookLiberation/ProcessorAutomationController.cs @@ -25,7 +25,8 @@ namespace LibationWinForms.BookLiberation LogError += (_, tuple) => Serilog.Log.Logger.Error(tuple.Item1, tuple.Item2 ?? "Automated backup: error"); } - public static LogMe RegisterForm(AutomatedBackupsForm form = null) + public static LogMe RegisterForm() => RegisterForm(null); + public static LogMe RegisterForm(T form) where T : ILogForm { var logMe = new LogMe(); diff --git a/Source/LibationWinForms/Dialogs/AccountsDialog.cs b/Source/LibationWinForms/Dialogs/AccountsDialog.cs index 14c67523..afcbbf79 100644 --- a/Source/LibationWinForms/Dialogs/AccountsDialog.cs +++ b/Source/LibationWinForms/Dialogs/AccountsDialog.cs @@ -15,9 +15,9 @@ namespace LibationWinForms.Dialogs private const string COL_AccountName = nameof(AccountName); private const string COL_Locale = nameof(Locale); - private Form1 _parent { get; } + private Form _parent { get; } - public AccountsDialog(Form1 parent) + public AccountsDialog(Form parent) { _parent = parent; diff --git a/Source/LibationWinForms/Dialogs/EditQuickFilters.cs b/Source/LibationWinForms/Dialogs/EditQuickFilters.cs index 3d6eab63..3e53d77a 100644 --- a/Source/LibationWinForms/Dialogs/EditQuickFilters.cs +++ b/Source/LibationWinForms/Dialogs/EditQuickFilters.cs @@ -15,9 +15,9 @@ namespace LibationWinForms.Dialogs private const string COL_MoveUp = nameof(MoveUp); private const string COL_MoveDown = nameof(MoveDown); - private Form1 _parent { get; } + private Form _parent { get; } - public EditQuickFilters(Form1 parent) + public EditQuickFilters(Form parent) { _parent = parent; diff --git a/Source/LibationWinForms/Dialogs/ScanAccountsDialog.cs b/Source/LibationWinForms/Dialogs/ScanAccountsDialog.cs index 0ebd283d..09a62f23 100644 --- a/Source/LibationWinForms/Dialogs/ScanAccountsDialog.cs +++ b/Source/LibationWinForms/Dialogs/ScanAccountsDialog.cs @@ -10,9 +10,9 @@ namespace LibationWinForms.Dialogs { public List CheckedAccounts { get; } = new List(); - private Form1 _parent { get; } + private Form _parent { get; } - public ScanAccountsDialog(Form1 parent) + public ScanAccountsDialog(Form parent) { _parent = parent;