diff --git a/LibationLauncher/LibationLauncher.csproj b/LibationLauncher/LibationLauncher.csproj
index 577fdaa2..9d263c16 100644
--- a/LibationLauncher/LibationLauncher.csproj
+++ b/LibationLauncher/LibationLauncher.csproj
@@ -13,7 +13,7 @@
win-x64
- 5.4.9.252
+ 5.4.9.253
diff --git a/LibationLauncher/Program.cs b/LibationLauncher/Program.cs
index 0786e414..1cfbda22 100644
--- a/LibationLauncher/Program.cs
+++ b/LibationLauncher/Program.cs
@@ -63,7 +63,6 @@ namespace LibationLauncher
#if !DEBUG
checkForUpdate(config);
#endif
-
Application.Run(new Form1());
}
diff --git a/LibationWinForms/BookLiberation/ProcessorAutomationController.cs b/LibationWinForms/BookLiberation/ProcessorAutomationController.cs
index e397378f..3704289b 100644
--- a/LibationWinForms/BookLiberation/ProcessorAutomationController.cs
+++ b/LibationWinForms/BookLiberation/ProcessorAutomationController.cs
@@ -71,7 +71,6 @@ namespace LibationWinForms.BookLiberation
var backupBook = CreateBackupBook(completedAction, logMe);
await new BackupLoop(logMe, backupBook, automatedBackupsForm).RunBackupAsync();
-
}
public static async Task ConvertAllBooksAsync()
@@ -86,6 +85,33 @@ namespace LibationWinForms.BookLiberation
await new BackupLoop(logMe, convertBook, automatedBackupsForm).RunBackupAsync();
}
+ public static async Task BackupAllPdfsAsync(EventHandler completedAction = null)
+ {
+ Serilog.Log.Logger.Information("Begin " + nameof(BackupAllPdfsAsync));
+
+ var automatedBackupsForm = new AutomatedBackupsForm();
+ LogMe logMe = LogMe.RegisterForm(automatedBackupsForm);
+
+ var downloadPdf = CreateStreamProcessable(completedAction, logMe);
+
+ await new BackupLoop(logMe, downloadPdf, automatedBackupsForm).RunBackupAsync();
+ }
+
+ public static void DownloadFile(string url, string destination, bool showDownloadCompletedDialog = false)
+ {
+ void onDownloadFileStreamingCompleted(object o, string s)
+ {
+ if (showDownloadCompletedDialog)
+ MessageBox.Show("File downloaded to:\r\n\r\n" + s);
+ }
+
+ DownloadFile downloadFile = CreateStreamable(onDownloadFileStreamingCompleted);
+
+ new System.Threading.Thread(() => downloadFile.PerformDownloadFileAsync(url, destination).GetAwaiter().GetResult())
+ { IsBackground = true }
+ .Start();
+ }
+
private static IProcessable CreateBackupBook(EventHandler completedAction, LogMe logMe)
{
var downloadPdf = CreateStreamProcessable(null, logMe);
@@ -102,39 +128,11 @@ namespace LibationWinForms.BookLiberation
return downloadDecryptBook;
}
- public static async Task BackupAllPdfsAsync(EventHandler completedAction = null)
- {
- Serilog.Log.Logger.Information("Begin " + nameof(BackupAllPdfsAsync));
-
- var automatedBackupsForm = new AutomatedBackupsForm();
- LogMe logMe = LogMe.RegisterForm(automatedBackupsForm);
-
- var downloadPdf = CreateStreamProcessable(completedAction, logMe);
-
- await new BackupLoop(logMe, downloadPdf, automatedBackupsForm).RunBackupAsync();
- }
-
- public static void DownloadFile(string url, string destination, bool showDownloadCompletedDialog = false)
- {
- void OnCompleted(object o, string s)
- {
- if (showDownloadCompletedDialog)
- MessageBox.Show("File downloaded to:\r\n\r\n" + s);
- }
-
- (DownloadFile downloadFile, DownloadForm downloadForm) = CreateStreamable(OnCompleted);
-
- new System.Threading.Thread(() =>downloadFile.PerformDownloadFileAsync(url, destination).GetAwaiter().GetResult())
- { IsBackground = true }
- .Start();
-
- }
-
///
/// Create a new and links it to a new .
///
/// The derrived type to create.
- /// The derrived form to create on and and be Shown on
+ /// The derrived Form to create on and and be Shown on
/// An additional event handler to handle
/// A new of type
private static TStrProc CreateStreamProcessable(EventHandler completedAction = null, LogMe logMe = null)
@@ -146,7 +144,6 @@ namespace LibationWinForms.BookLiberation
strProc.Begin += (sender, libraryBook) =>
{
var processForm = new TForm();
- Action logAction = logMe is null ? (s) => { } : logMe.Info;
processForm.SetProcessable(strProc, logMe);
processForm.OnBegin(sender, libraryBook);
};
@@ -161,21 +158,21 @@ namespace LibationWinForms.BookLiberation
/// Creates a new and links it to a new
///
/// The derrived type to create.
- /// The derrived form to create, which will be Shown on .
+ /// The derrived Form to create, which will be Shown on .
/// An additional event handler to handle
- private static (TStrProc, TForm) CreateStreamable(EventHandler completedAction = null)
+ private static TStrProc CreateStreamable(EventHandler completedAction = null)
where TForm : StreamBaseForm, new()
where TStrProc : IStreamable, new()
{
- var strProc = new TStrProc();
+ var streamable = new TStrProc();
var streamForm = new TForm();
- streamForm.SetStreamable(strProc);
+ streamForm.SetStreamable(streamable);
if (completedAction != null)
- strProc.StreamingCompleted += completedAction;
+ streamable.StreamingCompleted += completedAction;
- return (strProc, streamForm);
+ return streamable;
}
}