2
0

Compare commits

..

No commits in common. "2b18dc9d4ff2f7b841933aeb752617d2fd93cc8c" and "3c1865de31c9c114cd195ee230e885c55bd54298" have entirely different histories.

3 changed files with 5 additions and 12 deletions

View File

@ -55,8 +55,8 @@ public static class Tranga_Cli
if(task != TrangaTask.Task.UpdatePublications)
publication = SelectPublication(connector);
TimeSpan reoccurrence = SelectReoccurrence();
TrangaTask newTask = taskManager.AddTask(task, connector.name, publication, reoccurrence, "en");
Console.WriteLine(newTask);
taskManager.AddTask(task, connector.name, publication, reoccurrence, "en");
Console.WriteLine($"{task} - {reoccurrence} - {publication?.sortName} - {connector.name}");
Console.WriteLine("Press any key.");
Console.ReadKey();
menu = 0;
@ -160,7 +160,7 @@ public static class Tranga_Cli
int tIndex = 0;
Console.WriteLine($"Tasks (Running/Total): {taskRunningCount}/{taskCount}");
foreach(TrangaTask trangaTask in tasks)
Console.WriteLine($"{tIndex++:000}: {trangaTask.ToString()}");
Console.WriteLine($"{tIndex++}: {trangaTask.task} - {trangaTask.reoccurrence} - {trangaTask.publication?.sortName} - {trangaTask.connectorName} - {trangaTask.lastExecuted} - {(trangaTask.isBeingExecuted ? "Running" : "Waiting")}");
}
private static void ExecuteTaskNow(TaskManager taskManager)

View File

@ -67,7 +67,7 @@ public class TaskManager
/// <param name="reoccurrence">Time-Interval between Executions</param>
/// <param name="language">language, should Task require parameter. Can be empty</param>
/// <exception cref="ArgumentException">Is thrown when connectorName is not a available Connector</exception>
public TrangaTask AddTask(TrangaTask.Task task, string connectorName, Publication? publication, TimeSpan reoccurrence,
public void AddTask(TrangaTask.Task task, string connectorName, Publication? publication, TimeSpan reoccurrence,
string language = "")
{
//Get appropriate Connector from available Connectors for TrangaTask
@ -75,17 +75,15 @@ public class TaskManager
if (connector is null)
throw new ArgumentException($"Connector {connectorName} is not a known connector.");
TrangaTask newTask = new TrangaTask(connector.name, task, publication, reoccurrence, language);
//Check if same task already exists
if (!_allTasks.Any(trangaTask => trangaTask.task != task && trangaTask.connectorName != connector.name &&
trangaTask.publication?.downloadUrl != publication?.downloadUrl))
{
if(task != TrangaTask.Task.UpdatePublications)
_chapterCollection.Add((Publication)publication!, new List<Chapter>());
_allTasks.Add(newTask);
_allTasks.Add(new TrangaTask(connector.name, task, publication, reoccurrence, language));
ExportTasks(Directory.GetCurrentDirectory());
}
return newTask;
}
/// <summary>

View File

@ -42,9 +42,4 @@ public class TrangaTask
UpdateChapters,
DownloadNewChapters
}
public override string ToString()
{
return $"{task}\t{lastExecuted}\t{reoccurrence}\t{(isBeingExecuted ? "running" : "waiting")}\t{connectorName}\t{publication?.sortName}";
}
}