Updated code structure to allow for easy modification.

This commit is contained in:
Ross Healy
2024-02-04 00:15:56 +00:00
parent 7b350a8c01
commit 62abaee988

View File

@@ -7,13 +7,6 @@ namespace lottery_co_uk_scraper
{ {
internal class Lotto internal class Lotto
{ {
private const string Match6 = "Match 6";
private const string Match5Bonus = "Match 5 plus Bonus";
private const string Match5 = "Match 5";
private const string Match4 = "Match 4";
private const string Match3 = "Match 3";
private const string Totals = "Totals";
public static async Task GetLottoNumbers(string url, HttpClient client) public static async Task GetLottoNumbers(string url, HttpClient client)
{ {
try try
@@ -96,12 +89,12 @@ namespace lottery_co_uk_scraper
if (table != null) if (table != null)
{ {
ProcessTableSection(table, Match6); ProcessTableSection(table, LotteryConstants.Match6);
ProcessTableSection(table, Match5Bonus); ProcessTableSection(table, LotteryConstants.Match5Bonus);
ProcessTableSection(table, Match5); ProcessTableSection(table, LotteryConstants.Match5);
ProcessTableSection(table, Match4); ProcessTableSection(table, LotteryConstants.Match4);
ProcessTableSection(table, Match3); ProcessTableSection(table, LotteryConstants.Match3);
ProcessTableSection(table, Totals); ProcessTableSection(table, LotteryConstants.Totals);
} }
} }
@@ -237,5 +230,15 @@ namespace lottery_co_uk_scraper
Console.WriteLine($"{label}: " + string.Join(", ", values)); Console.WriteLine($"{label}: " + string.Join(", ", values));
} }
} }
public static class LotteryConstants
{
public const string Match6 = "Match 6";
public const string Match5Bonus = "Match 5 plus Bonus";
public const string Match5 = "Match 5";
public const string Match4 = "Match 4";
public const string Match3 = "Match 3";
public const string Totals = "Totals";
}
} }
} }