Documentation-style comments

This commit is contained in:
Tony Bark 2025-03-12 15:23:11 -04:00
parent 85b2cda8e2
commit aebe0c7040
2 changed files with 30 additions and 1 deletions

View file

@ -1,8 +1,23 @@
namespace PublishTimes; namespace PublishTimes;
/// <summary>
/// Represents the configuration settings for exporting a schedule,
/// including file name, directory path, and available topics.
/// </summary>
public class Config public class Config
{ {
/// <summary>
/// Gets or sets the name of the schedule file.
/// </summary>
public string? File { get; set; } public string? File { get; set; }
/// <summary>
/// Gets or sets the directory path where the schedule file is stored.
/// </summary>
public string? Path { get; set; } public string? Path { get; set; }
/// <summary>
/// Gets or sets the list of available topics from the configuration file.
/// </summary>
public TomlArray? Topics { get; set; } public TomlArray? Topics { get; set; }
} }

View file

@ -34,6 +34,11 @@ for (int i = 0; i < numberOfArticles; i++)
startTime = nextTime; // Update start time for the next article startTime = nextTime; // Update start time for the next article
} }
/// <summary>
/// Converts a TimeSpan into a 12-hour AM/PM formatted time string.
/// </summary>
/// <param name="time">The TimeSpan representing the time of day.</param>
/// <returns>A formatted string representing the time in AM/PM format.</returns>
string TimeSpanToAMPM(TimeSpan time) string TimeSpanToAMPM(TimeSpan time)
{ {
var minutes = time.TotalMinutes; var minutes = time.TotalMinutes;
@ -46,7 +51,11 @@ string TimeSpanToAMPM(TimeSpan time)
return $"{hours12}:{time.Minutes:D2} {period}"; return $"{hours12}:{time.Minutes:D2} {period}";
} }
/// <summary>
/// Exports the scheduled articles to a file, allowing the user to modify
/// the directory, filename, and list of topics based on
/// a configuration file if available.
/// </summary>
void ExportSchedule() void ExportSchedule()
{ {
var cfgPath = Path.Combine(appDir, cfgFile); var cfgPath = Path.Combine(appDir, cfgFile);
@ -105,6 +114,10 @@ void ExportSchedule()
} }
/// <summary>
/// Displays the scheduled article times in a formatted manner and provides
/// options to export the schedule or restart the scheduling process.
/// </summary>
void PrintSchedule() void PrintSchedule()
{ {
if (isRestart) if (isRestart)
@ -138,4 +151,5 @@ void PrintSchedule()
} }
} }
// Start the loop
PrintSchedule(); PrintSchedule();