mirror of
https://github.com/C9Glax/tranga-website.git
synced 2025-06-12 23:07:54 +02:00
Moved libraryManagers, notificationManagers and logger to commonObjects class.
This commit is contained in:
@ -32,10 +32,10 @@ public class DownloadChapterTask : TrangaTask
|
||||
HttpStatusCode downloadSuccess = connector.DownloadChapter(this.publication, this.chapter, this, cancellationToken);
|
||||
if ((int)downloadSuccess >= 200 && (int)downloadSuccess < 300)
|
||||
{
|
||||
foreach(NotificationManager nm in taskManager.settings.notificationManagers)
|
||||
foreach(NotificationManager nm in taskManager.commonObjects.notificationManagers)
|
||||
nm.SendNotification("Chapter downloaded", $"{this.publication.sortName} {this.chapter.chapterNumber} {this.chapter.name}");
|
||||
|
||||
foreach (LibraryManager lm in taskManager.settings.libraryManagers)
|
||||
foreach (LibraryManager lm in taskManager.commonObjects.libraryManagers)
|
||||
lm.UpdateLibrary();
|
||||
}
|
||||
return downloadSuccess;
|
||||
|
@ -66,7 +66,7 @@ public abstract class TrangaTask
|
||||
/// <param name="cancellationToken"></param>
|
||||
public void Execute(TaskManager taskManager, CancellationToken? cancellationToken = null)
|
||||
{
|
||||
taskManager.settings.logger?.WriteLine(this.GetType().ToString(), $"Executing Task {this}");
|
||||
taskManager.commonObjects.logger?.WriteLine(this.GetType().ToString(), $"Executing Task {this}");
|
||||
this.state = ExecutionState.Running;
|
||||
this.executionStarted = DateTime.Now;
|
||||
this.lastChange = DateTime.Now;
|
||||
@ -89,7 +89,7 @@ public abstract class TrangaTask
|
||||
if (this is DownloadChapterTask)
|
||||
taskManager.DeleteTask(this);
|
||||
|
||||
taskManager.settings.logger?.WriteLine(this.GetType().ToString(), $"Finished Executing Task {this}");
|
||||
taskManager.commonObjects.logger?.WriteLine(this.GetType().ToString(), $"Finished Executing Task {this}");
|
||||
}
|
||||
|
||||
public void AddChildTask(TrangaTask childTask)
|
||||
|
Reference in New Issue
Block a user