Minor mods for future UI changes

This commit is contained in:
Michael Bucari-Tovo 2022-05-11 18:36:48 -06:00
parent e0248c2d8e
commit 936a1d60a0
10 changed files with 21 additions and 10 deletions

View File

@ -20,7 +20,7 @@ namespace AaxDecrypter
public event EventHandler<TimeSpan> DecryptTimeRemaining; public event EventHandler<TimeSpan> DecryptTimeRemaining;
public event EventHandler<string> FileCreated; public event EventHandler<string> FileCreated;
protected bool IsCanceled { get; set; } public bool IsCanceled { get; set; }
protected string OutputFileName { get; private set; } protected string OutputFileName { get; private set; }
protected DownloadOptions DownloadOptions { get; } protected DownloadOptions DownloadOptions { get; }

View File

@ -14,6 +14,7 @@ namespace FileLiberator
{ {
public class ConvertToMp3 : AudioDecodable public class ConvertToMp3 : AudioDecodable
{ {
public override string Name => "Convert to Mp3";
private Mp4File m4bBook; private Mp4File m4bBook;
private long fileSize; private long fileSize;

View File

@ -15,6 +15,7 @@ namespace FileLiberator
{ {
public class DownloadDecryptBook : AudioDecodable public class DownloadDecryptBook : AudioDecodable
{ {
public override string Name => "Download & Decrypt";
private AudiobookDownloadBase abDownloader; private AudiobookDownloadBase abDownloader;
public override bool Validate(LibraryBook libraryBook) => !libraryBook.Book.Audio_Exists; 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)) foreach (var tmpFile in entries.Where(f => f.FileType != FileType.AAXC))
FileUtility.SaferDelete(tmpFile.Path); 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 // moves new files from temp dir to final dest

View File

@ -14,6 +14,7 @@ namespace FileLiberator
{ {
public class DownloadPdf : Processable public class DownloadPdf : Processable
{ {
public override string Name => "Download Pdf";
public override bool Validate(LibraryBook libraryBook) public override bool Validate(LibraryBook libraryBook)
=> !string.IsNullOrWhiteSpace(getdownloadUrl(libraryBook)) => !string.IsNullOrWhiteSpace(getdownloadUrl(libraryBook))
&& !libraryBook.Book.PDF_Exists; && !libraryBook.Book.PDF_Exists;

View File

@ -11,6 +11,7 @@ namespace FileLiberator
{ {
public abstract class Processable : Streamable public abstract class Processable : Streamable
{ {
public abstract string Name { get; }
public event EventHandler<LibraryBook> Begin; public event EventHandler<LibraryBook> Begin;
/// <summary>General string message to display. DON'T rely on this for success, failure, or control logic</summary> /// <summary>General string message to display. DON'T rely on this for success, failure, or control logic</summary>

View File

@ -4,7 +4,11 @@ using Dinah.Core.Threading;
namespace LibationWinForms.BookLiberation 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; public bool KeepGoingChecked => keepGoingCb.Checked;

View File

@ -25,7 +25,8 @@ namespace LibationWinForms.BookLiberation
LogError += (_, tuple) => Serilog.Log.Logger.Error(tuple.Item1, tuple.Item2 ?? "Automated backup: error"); 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<ILogForm>(null);
public static LogMe RegisterForm<T>(T form) where T : ILogForm
{ {
var logMe = new LogMe(); var logMe = new LogMe();

View File

@ -15,9 +15,9 @@ namespace LibationWinForms.Dialogs
private const string COL_AccountName = nameof(AccountName); private const string COL_AccountName = nameof(AccountName);
private const string COL_Locale = nameof(Locale); 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; _parent = parent;

View File

@ -15,9 +15,9 @@ namespace LibationWinForms.Dialogs
private const string COL_MoveUp = nameof(MoveUp); private const string COL_MoveUp = nameof(MoveUp);
private const string COL_MoveDown = nameof(MoveDown); 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; _parent = parent;

View File

@ -10,9 +10,9 @@ namespace LibationWinForms.Dialogs
{ {
public List<Account> CheckedAccounts { get; } = new List<Account>(); public List<Account> CheckedAccounts { get; } = new List<Account>();
private Form1 _parent { get; } private Form _parent { get; }
public ScanAccountsDialog(Form1 parent) public ScanAccountsDialog(Form parent)
{ {
_parent = parent; _parent = parent;