From 30d91b9ee177a41475e99fc46d05caa38ed925d3 Mon Sep 17 00:00:00 2001 From: glax Date: Fri, 19 May 2023 17:47:49 +0200 Subject: [PATCH] Added real reoccurrence selection to cli --- Tranga-CLI/Tranga_Cli.cs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Tranga-CLI/Tranga_Cli.cs b/Tranga-CLI/Tranga_Cli.cs index e6feb80..08990eb 100644 --- a/Tranga-CLI/Tranga_Cli.cs +++ b/Tranga-CLI/Tranga_Cli.cs @@ -1,4 +1,5 @@ -using Tranga; +using System.Globalization; +using Tranga; using Tranga.Connectors; namespace Tranga_CLI; @@ -47,7 +48,7 @@ public static class Tranga_Cli Publication? publication = null; if(task != TrangaTask.Task.UpdatePublications) publication = SelectPublication(connector); - TimeSpan reoccurrence = SelectReoccurence(); + TimeSpan reoccurrence = SelectReoccurrence(); taskManager.AddTask(task, connector.name, publication, reoccurrence, "en"); Console.WriteLine($"{task} - {connector.name} - {publication?.sortName}"); Console.WriteLine("Press any key."); @@ -104,7 +105,7 @@ public static class Tranga_Cli int tIndex = 0; Console.WriteLine("Tasks:"); foreach(TrangaTask trangaTask in tasks) - Console.WriteLine($"{tIndex++}: {trangaTask.task} - {trangaTask.publication?.sortName} - {trangaTask.connectorName}"); + Console.WriteLine($"{tIndex++}: {trangaTask.task} - {trangaTask.reoccurrence} - {trangaTask.publication?.sortName} - {trangaTask.connectorName}"); return tasks.Length; } @@ -143,9 +144,10 @@ public static class Tranga_Cli return Enum.Parse(selectedTaskName); } - private static TimeSpan SelectReoccurence() + private static TimeSpan SelectReoccurrence() { - return TimeSpan.FromSeconds(30); //TODO + Console.WriteLine("Select reoccurrence Timer (Format hh:mm:ss):"); + return TimeSpan.Parse(Console.ReadLine()!, new CultureInfo("en-US")); } private static void DownloadNow(string folderPath)