Fixed removeTask for tasks without connector
This commit is contained in:
parent
f396640001
commit
f2bd5c5e85
@ -45,7 +45,7 @@ public class Komga
|
||||
|
||||
HashSet<KomgaLibrary> ret = new();
|
||||
|
||||
foreach (JsonNode jsonNode in result)
|
||||
foreach (JsonNode? jsonNode in result)
|
||||
{
|
||||
var jObject = (JsonObject?)jsonNode;
|
||||
string libraryId = jObject!["id"]!.GetValue<string>();
|
||||
|
@ -153,11 +153,16 @@ public class TaskManager
|
||||
/// <param name="task">TrangaTask.Task type</param>
|
||||
/// <param name="connectorName">Name of Connector that was used</param>
|
||||
/// <param name="publication">Publication that was used</param>
|
||||
public void RemoveTask(TrangaTask.Task task, string connectorName, Publication? publication)
|
||||
public void RemoveTask(TrangaTask.Task task, string? connectorName, Publication? publication)
|
||||
{
|
||||
_allTasks.RemoveWhere(trangaTask =>
|
||||
trangaTask.task == task && trangaTask.connectorName == connectorName &&
|
||||
trangaTask.publication?.downloadUrl == publication?.downloadUrl);
|
||||
if (task == TrangaTask.Task.UpdateKomgaLibrary)
|
||||
_allTasks.RemoveWhere(uTask => uTask.task == TrangaTask.Task.UpdateKomgaLibrary);
|
||||
else if (connectorName is null)
|
||||
throw new ArgumentException($"connectorName can not be null for Task {task}");
|
||||
else
|
||||
_allTasks.RemoveWhere(trangaTask =>
|
||||
trangaTask.task == task && trangaTask.connectorName == connectorName &&
|
||||
trangaTask.publication?.downloadUrl == publication?.downloadUrl);
|
||||
ExportData(Directory.GetCurrentDirectory());
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user