diff --git a/Tranga/TaskManager.cs b/Tranga/TaskManager.cs
index bf028f4..ffb79ea 100644
--- a/Tranga/TaskManager.cs
+++ b/Tranga/TaskManager.cs
@@ -26,39 +26,9 @@ public class TaskManager
/// Path to the cover-image cache
///
///
- public TaskManager(string downloadFolderPath, string workingDirectory, string imageCachePath, HashSet libraryManagers, Logger? logger = null)
+ public TaskManager(string downloadFolderPath, string workingDirectory, string imageCachePath, HashSet libraryManagers, Logger? logger = null) : this(new TrangaSettings(downloadFolderPath, workingDirectory, libraryManagers), logger)
{
- this.logger = logger;
-
- this.settings = new TrangaSettings(downloadFolderPath, workingDirectory, libraryManagers);
- ExportDataAndSettings();
- this._connectors = new Connector[]
- {
- new MangaDex(downloadFolderPath, imageCachePath, logger),
- new Manganato(downloadFolderPath, imageCachePath, logger),
- new Mangasee(downloadFolderPath, imageCachePath, logger)
- };
-
- Thread taskChecker = new(TaskCheckerThread);
- taskChecker.Start();
- }
-
- public void UpdateSettings(string? downloadLocation, string? komgaUrl, string? komgaAuth, string? kavitaUrl, string? kavitaUsername, string? kavitaPassword)
- {
- if (komgaUrl is not null && komgaAuth is not null && komgaUrl.Length > 0 && komgaAuth.Length > 0)
- {
- settings.libraryManagers.RemoveWhere(lm => lm.GetType() == typeof(Komga));
- settings.libraryManagers.Add(new Komga(komgaUrl, komgaAuth, logger));
- }
- if (kavitaUrl is not null && kavitaUsername is not null && kavitaPassword is not null && kavitaUrl.Length > 0 && kavitaUsername.Length > 0 && kavitaPassword.Length > 0)
- {
- settings.libraryManagers.RemoveWhere(lm => lm.GetType() == typeof(Kavita));
- settings.libraryManagers.Add(new Kavita(kavitaUrl, kavitaUsername, kavitaPassword, logger));
- }
- if (downloadLocation is not null && downloadLocation.Length > 0)
- settings.downloadLocation = downloadLocation;
- ExportDataAndSettings();
}
public TaskManager(TrangaSettings settings, Logger? logger = null)
@@ -77,6 +47,23 @@ public class TaskManager
Thread taskChecker = new(TaskCheckerThread);
taskChecker.Start();
}
+
+ public void UpdateSettings(string? downloadLocation, string? komgaUrl, string? komgaAuth, string? kavitaUrl, string? kavitaUsername, string? kavitaPassword)
+ {
+ if (komgaUrl is not null && komgaAuth is not null && komgaUrl.Length > 0 && komgaAuth.Length > 0)
+ {
+ settings.libraryManagers.RemoveWhere(lm => lm.GetType() == typeof(Komga));
+ settings.libraryManagers.Add(new Komga(komgaUrl, komgaAuth, logger));
+ }
+ if (kavitaUrl is not null && kavitaUsername is not null && kavitaPassword is not null && kavitaUrl.Length > 0 && kavitaUsername.Length > 0 && kavitaPassword.Length > 0)
+ {
+ settings.libraryManagers.RemoveWhere(lm => lm.GetType() == typeof(Kavita));
+ settings.libraryManagers.Add(new Kavita(kavitaUrl, kavitaUsername, kavitaPassword, logger));
+ }
+ if (downloadLocation is not null && downloadLocation.Length > 0)
+ settings.downloadLocation = downloadLocation;
+ ExportDataAndSettings();
+ }
///
/// Runs continuously until shutdown.