AddTask now takes ConnectorName instead of object
This commit is contained in:
parent
b0f6441599
commit
f0a4bc3e99
@ -48,7 +48,7 @@ public static class Tranga_Cli
|
|||||||
if(task != TrangaTask.Task.UpdatePublications)
|
if(task != TrangaTask.Task.UpdatePublications)
|
||||||
publication = SelectPublication(connector);
|
publication = SelectPublication(connector);
|
||||||
TimeSpan reoccurrence = SelectReoccurence();
|
TimeSpan reoccurrence = SelectReoccurence();
|
||||||
taskManager.AddTask(task, connector, publication, reoccurrence, "en");
|
taskManager.AddTask(task, connector.name, publication, reoccurrence, "en");
|
||||||
Console.WriteLine($"{task} - {connector.name} - {publication?.sortName}");
|
Console.WriteLine($"{task} - {connector.name} - {publication?.sortName}");
|
||||||
Console.WriteLine("Press any key.");
|
Console.WriteLine("Press any key.");
|
||||||
Console.ReadKey();
|
Console.ReadKey();
|
||||||
|
@ -34,9 +34,13 @@ public class TaskManager
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddTask(TrangaTask.Task task, Connector connector, Publication? publication, TimeSpan reoccurrence,
|
public void AddTask(TrangaTask.Task task, string connectorName, Publication? publication, TimeSpan reoccurrence,
|
||||||
string language = "")
|
string language = "")
|
||||||
{
|
{
|
||||||
|
Connector? connector = connectors.FirstOrDefault(c => c.name == connectorName);
|
||||||
|
if (connector is null)
|
||||||
|
throw new ArgumentException($"Connector {connectorName} is not a known connector.");
|
||||||
|
|
||||||
if (!_allTasks.Any(trangaTask => trangaTask.task != task && trangaTask.connectorName != connector.name &&
|
if (!_allTasks.Any(trangaTask => trangaTask.task != task && trangaTask.connectorName != connector.name &&
|
||||||
trangaTask.publication?.downloadUrl != publication?.downloadUrl))
|
trangaTask.publication?.downloadUrl != publication?.downloadUrl))
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user