2
0

Compare commits

..

3 Commits

View File

@ -8,12 +8,18 @@ public static class Tranga_Cli
{
public static void Main(string[] args)
{
Console.WriteLine("Output folder path [standard D:]:");
string? folderPath = Console.ReadLine();
while(folderPath is null )
folderPath = Console.ReadLine();
if (folderPath.Length < 1)
folderPath = "D:";
string folderPath = Directory.GetCurrentDirectory();
string settingsPath = Path.Join(Directory.GetCurrentDirectory(), "lastPath.setting");
if (File.Exists(settingsPath))
folderPath = File.ReadAllText(settingsPath);
Console.WriteLine($"Output folder path [{folderPath}]:");
string? tmpPath = Console.ReadLine();
while(tmpPath is null)
tmpPath = Console.ReadLine();
if(tmpPath.Length > 0)
folderPath = tmpPath;
File.WriteAllText(settingsPath, folderPath);
Console.Write("Mode (D: Interactive only, T: TaskManager):");
ConsoleKeyInfo mode = Console.ReadKey();
@ -106,12 +112,11 @@ public static class Tranga_Cli
int taskRunningCount = taskManager.GetAllTasks().Count(task => task.isBeingExecuted);
Console.Clear();
Console.WriteLine($"Download Folder: {folderPath} Tasks (Running/Total): {taskRunningCount}/{taskCount}");
Console.WriteLine("Select Option:");
Console.WriteLine("L: List tasks");
Console.WriteLine("C: Create Task");
Console.WriteLine("D: Delete Task");
Console.WriteLine("E: Execute Task now");
Console.WriteLine("Q: Exit with saving");
Console.WriteLine("Q: Exit");
ConsoleKey selection = Console.ReadKey().Key;
Console.WriteLine();
return selection;
@ -131,9 +136,15 @@ public static class Tranga_Cli
private static void ExecuteTask(TaskManager taskManager)
{
TrangaTask[] tasks = taskManager.GetAllTasks();
if (tasks.Length < 1)
{
Console.Clear();
Console.WriteLine("There are no available Tasks.");
return;
}
PrintTasks(tasks);
Console.WriteLine($"Select Task (0-{tasks.Length - 1}):");
Console.WriteLine($"Select Task (0-{tasks.Length}):");
string? selectedTask = Console.ReadLine();
while(selectedTask is null || selectedTask.Length < 1)
@ -146,9 +157,15 @@ public static class Tranga_Cli
private static void RemoveTask(TaskManager taskManager)
{
TrangaTask[] tasks = taskManager.GetAllTasks();
if (tasks.Length < 1)
{
Console.Clear();
Console.WriteLine("There are no available Tasks.");
return;
}
PrintTasks(tasks);
Console.WriteLine($"Select Task (0-{tasks.Length - 1}):");
Console.WriteLine($"Select Task (0-{tasks.Length}):");
string? selectedTask = Console.ReadLine();
while(selectedTask is null || selectedTask.Length < 1)
@ -167,7 +184,7 @@ public static class Tranga_Cli
Console.WriteLine("Available Tasks:");
foreach (string taskName in taskNames)
Console.WriteLine($"{tIndex++}: {taskName}");
Console.WriteLine($"Select Task (0-{taskNames.Length - 1}):");
Console.WriteLine($"Select Task (0-{taskNames.Length}):");
string? selectedTask = Console.ReadLine();
while(selectedTask is null || selectedTask.Length < 1)