From 79dc44d707d655235b82c40fd66fc361663c7c6e Mon Sep 17 00:00:00 2001 From: glax Date: Mon, 22 May 2023 17:04:31 +0200 Subject: [PATCH] fixes 11 --- Tranga-CLI/Tranga_Cli.cs | 1 - Tranga/TaskManager.cs | 11 +++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Tranga-CLI/Tranga_Cli.cs b/Tranga-CLI/Tranga_Cli.cs index 305741f..480c9c7 100644 --- a/Tranga-CLI/Tranga_Cli.cs +++ b/Tranga-CLI/Tranga_Cli.cs @@ -244,7 +244,6 @@ public static class Tranga_Cli try { int selectedTaskIndex = Convert.ToInt32(selectedTask); - logger.WriteLine("Tranga_CLI", "Sending Task to TaskManager"); return tasks[selectedTaskIndex]; } catch (Exception e) diff --git a/Tranga/TaskManager.cs b/Tranga/TaskManager.cs index d324edc..56d89ce 100644 --- a/Tranga/TaskManager.cs +++ b/Tranga/TaskManager.cs @@ -188,16 +188,23 @@ public class TaskManager if (task == TrangaTask.Task.UpdateKomgaLibrary) { _allTasks.RemoveWhere(uTask => uTask.task == TrangaTask.Task.UpdateKomgaLibrary); - logger?.WriteLine(this.GetType().ToString(), $"Removed Task {task}"); + logger?.WriteLine(this.GetType().ToString(), $"Removed Task {task} from all Tasks."); } else if (connectorName is null) throw new ArgumentException($"connectorName can not be null for Task {task}"); else { + foreach (List taskQueue in this._taskQueue.Values) + if(taskQueue.RemoveAll(trangaTask => + trangaTask.task == task && trangaTask.connectorName == connectorName && + trangaTask.publication?.internalId == publication?.internalId) > 0) + logger?.WriteLine(this.GetType().ToString(), $"Removed Task {task} {publication?.sortName} {publication?.internalId} from Queue."); + else + logger?.WriteLine(this.GetType().ToString(), $"Task {task} {publication?.sortName} {publication?.internalId} was not in Queue."); if(_allTasks.RemoveWhere(trangaTask => trangaTask.task == task && trangaTask.connectorName == connectorName && trangaTask.publication?.internalId == publication?.internalId) > 0) - logger?.WriteLine(this.GetType().ToString(), $"Removed Task {task} {publication?.sortName} {publication?.internalId}."); + logger?.WriteLine(this.GetType().ToString(), $"Removed Task {task} {publication?.sortName} {publication?.internalId} from all Tasks."); else logger?.WriteLine(this.GetType().ToString(), $"No Task {task} {publication?.sortName} {publication?.internalId} could be found."); }