mirror of
https://github.com/tonytins/staggerpost.git
synced 2025-03-25 02:39:12 +00:00
- Cleaned up Program.cs by moving a lot of functions to their own classes - Renamed topics to community - Choosing a community is no longer optional with the switch to JSON - Added csharpier tool and reformttered all code
42 lines
1.1 KiB
C#
42 lines
1.1 KiB
C#
// I hereby waive this project under the public domain - see UNLICENSE for details.
|
|
|
|
/// <summary>
|
|
/// Displays the scheduled article times in a formatted manner and provides
|
|
/// options to export the schedule or restart the scheduling process.
|
|
/// </summary>
|
|
void PrintTimes()
|
|
{
|
|
var storeSchedule = new List<String>();
|
|
var scheduledTimes = Generator.GenerateTimes();
|
|
|
|
// Clear the screen on restart
|
|
Console.Clear();
|
|
|
|
Console.WriteLine("=== Publish Times ===");
|
|
foreach (var time in scheduledTimes)
|
|
{
|
|
var articleTime = $"{Generator.ConvertTo12Hour(time)}";
|
|
// Correct format string to display time in 12-hour format with AM/PM
|
|
Console.WriteLine(articleTime);
|
|
// Store the schedule to memory for option export
|
|
storeSchedule.Add(articleTime);
|
|
}
|
|
|
|
// Give the user an option to export the schedule
|
|
if (Interactive.UserChoice("Retry?"))
|
|
PrintTimes();
|
|
|
|
// Give the user an option to export the schedule
|
|
Export.ToJSON(storeSchedule, "config.toml");
|
|
|
|
if (Interactive.UserChoice("Generate A New Batch?"))
|
|
PrintTimes();
|
|
else
|
|
{
|
|
Console.Clear();
|
|
Environment.Exit(Environment.ExitCode);
|
|
}
|
|
}
|
|
|
|
// Start the loop
|
|
PrintTimes();
|