diff --git a/Seq.App.EventTimeout/Classes/AbstractApiHolidays.cs b/Seq.App.EventTimeout/Classes/AbstractApiHolidays.cs index 170922b..2bc5921 100644 --- a/Seq.App.EventTimeout/Classes/AbstractApiHolidays.cs +++ b/Seq.App.EventTimeout/Classes/AbstractApiHolidays.cs @@ -8,7 +8,8 @@ namespace Seq.App.EventTimeout.Classes /// /// AbstractAPI Holidays API format /// - public abstract class AbstractApiHolidays + // ReSharper disable once ClassNeverInstantiated.Global + public class AbstractApiHolidays { /// /// AbstractAPI Holidays API format @@ -26,34 +27,35 @@ public abstract class AbstractApiHolidays /// /// // ReSharper disable InconsistentNaming - protected AbstractApiHolidays(string name, string name_local, string language, string description, + // ReSharper disable once ArrangeTypeMemberModifiers + public AbstractApiHolidays(string name, string name_local, string language, string description, string country, string location, string type, string date, string date_year, string date_month, string date_day, string week_day) { - this.name = name; - this.name_local = name_local; - this.language = language; - this.description = description; - this.location = location; - if (this.location.Contains(" - ")) - Locations = this.location - .Substring(this.location.IndexOf(" - ", StringComparison.Ordinal) + 3, - this.location.Length - this.location.IndexOf(" - ", StringComparison.Ordinal) - 3) + Name = name; + Name_Local = name_local; + Language = language; + Description = description; + Location = location; + if (Location.Contains(" - ")) + Locations = Location + .Substring(Location.IndexOf(" - ", StringComparison.Ordinal) + 3, + Location.Length - Location.IndexOf(" - ", StringComparison.Ordinal) - 3) .Split(new[] {','}, StringSplitOptions.RemoveEmptyEntries).Select(t => t.Trim()).ToList(); else - Locations = this.location.Split(new[] {','}, StringSplitOptions.RemoveEmptyEntries) + Locations = Location.Split(new[] {','}, StringSplitOptions.RemoveEmptyEntries) .Select(t => t.Trim()) .ToList(); - this.country = country; - this.type = type; - this.date = date; - this.date_year = date_year; - this.date_month = date_month; - this.date_day = date_day; - this.week_day = week_day; - LocalStart = DateTime.ParseExact(this.date, "M/d/yyyy", CultureInfo.InvariantCulture, DateTimeStyles.None); + Country = country; + Type = type; + Date = date; + DateYear = date_year; + DateMonth = date_month; + DateDay = date_day; + WeekDay = week_day; + LocalStart = DateTime.ParseExact(Date, "M/d/yyyy", CultureInfo.InvariantCulture, DateTimeStyles.None); UtcStart = LocalStart.ToUniversalTime(); UtcEnd = LocalStart.AddDays(1).ToUniversalTime(); } @@ -61,21 +63,21 @@ protected AbstractApiHolidays(string name, string name_local, string language, s // ReSharper disable MemberCanBePrivate.Global // ReSharper disable UnusedAutoPropertyAccessor.Local // ReSharper disable UnusedAutoPropertyAccessor.Global - public string name { get; } - public string name_local { get; } - public string language { get; } - public string description { get; } - public string country { get; } - public string location { get; } + public string Name { get; } + public string Name_Local { get; } + public string Language { get; } + public string Description { get; } + public string Country { get; } + public string Location { get; } public List Locations { get; } - public string type { get; } + public string Type { get; } public DateTime LocalStart { get; } public DateTime UtcStart { get; } public DateTime UtcEnd { get; } - public string date { get; } - public string date_year { get; } - public string date_month { get; } - public string date_day { get; } - public string week_day { get; } + public string Date { get; } + public string DateYear { get; } + public string DateMonth { get; } + public string DateDay { get; } + public string WeekDay { get; } } } \ No newline at end of file diff --git a/Seq.App.EventTimeout/Classes/Holidays.cs b/Seq.App.EventTimeout/Classes/Holidays.cs index b2d5f7a..31aaaa0 100644 --- a/Seq.App.EventTimeout/Classes/Holidays.cs +++ b/Seq.App.EventTimeout/Classes/Holidays.cs @@ -48,7 +48,7 @@ public static List ValidateHolidays(IEnumerable 0) // ReSharper disable once UnusedVariable foreach (var match in holidayMatch.Where(match => - holiday.type.IndexOf(match, StringComparison.OrdinalIgnoreCase) >= 0)) + holiday.Type.IndexOf(match, StringComparison.OrdinalIgnoreCase) >= 0)) hasType = true; if (localeMatch.Count > 0) @@ -58,7 +58,7 @@ public static List ValidateHolidays(IEnumerable= 0) + if (!includeBank && holiday.Name.IndexOf("Bank Holiday", StringComparison.OrdinalIgnoreCase) >= 0) isBank = true; if (!includeWeekends && (holiday.LocalStart.DayOfWeek == DayOfWeek.Sunday || diff --git a/Seq.App.EventTimeout/EventTimeoutReactor.cs b/Seq.App.EventTimeout/EventTimeoutReactor.cs index a92584a..69bf01a 100644 --- a/Seq.App.EventTimeout/EventTimeoutReactor.cs +++ b/Seq.App.EventTimeout/EventTimeoutReactor.cs @@ -816,8 +816,8 @@ private void RetrieveHolidays(DateTime localDate, DateTime utcDate) foreach (var holiday in result) LogEvent(LogEventLevel.Debug, "Holiday Name: {Name}, Local Name {LocalName}, Start {LocalStart}, Start UTC {Start}, End UTC {End}, Type {Type}, Location string {Location}, Locations parsed {Locations} ...", - holiday.name, holiday.name_local, holiday.LocalStart, holiday.UtcStart, holiday.UtcEnd, - holiday.type, holiday.location, holiday.Locations.ToArray()); + holiday.Name, holiday.Name_Local, holiday.LocalStart, holiday.UtcStart, holiday.UtcEnd, + holiday.Type, holiday.Location, holiday.Locations.ToArray()); } LogEvent(LogEventLevel.Debug, "Holidays retrieved and validated {holidayCount} ...", @@ -825,8 +825,8 @@ private void RetrieveHolidays(DateTime localDate, DateTime utcDate) foreach (var holiday in _holidays) LogEvent(LogEventLevel.Debug, "Holiday Name: {Name}, Local Name {LocalName}, Start {LocalStart}, Start UTC {Start}, End UTC {End}, Type {Type}, Location string {Location}, Locations parsed {Locations} ...", - holiday.name, holiday.name_local, holiday.LocalStart, holiday.UtcStart, holiday.UtcEnd, - holiday.type, holiday.location, holiday.Locations.ToArray()); + holiday.Name, holiday.Name_Local, holiday.LocalStart, holiday.UtcStart, holiday.UtcEnd, + holiday.Type, holiday.Location, holiday.Locations.ToArray()); _isUpdating = false; if (!_isShowtime) UtcRollover(utcDate, true); diff --git a/Seq.App.EventTimeout/Seq.App.EventTimeout.csproj b/Seq.App.EventTimeout/Seq.App.EventTimeout.csproj index c0718f3..ca07a92 100644 --- a/Seq.App.EventTimeout/Seq.App.EventTimeout.csproj +++ b/Seq.App.EventTimeout/Seq.App.EventTimeout.csproj @@ -8,7 +8,7 @@ $([System.DateTime]::UtcNow.ToString(mmff)) - 1.4.0 + 1.4.2 $(Version).1 $(Version).$(VersionSuffix) $(Version).0