diff --git a/CHANGELOG.md b/CHANGELOG.md index 452ea45..2c05085 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Added property to IcdEnvironment to determine whether SSL communication is enabled - Added IcdTimeZoneInfo, a very light implementation of System.TimeZoneInfo for the .NET Compact Framework - Added ThreadedWorkerQueue - a threadsafe way to enqueue items and have a worker thread process them one at a time + - Added eDaysOfWeek flags enum ### Changed - Repeater changed to use configured callbacks instead of a dumb event diff --git a/ICD.Common.Utils/ICD.Common.Utils_SimplSharp.csproj b/ICD.Common.Utils/ICD.Common.Utils_SimplSharp.csproj index 462ff4e..1fb14f3 100644 --- a/ICD.Common.Utils/ICD.Common.Utils_SimplSharp.csproj +++ b/ICD.Common.Utils/ICD.Common.Utils_SimplSharp.csproj @@ -91,6 +91,7 @@ + diff --git a/ICD.Common.Utils/eDaysOfWeek.cs b/ICD.Common.Utils/eDaysOfWeek.cs new file mode 100644 index 0000000..47f3d23 --- /dev/null +++ b/ICD.Common.Utils/eDaysOfWeek.cs @@ -0,0 +1,45 @@ +using System; + +namespace ICD.Common.Utils +{ + [Flags] + public enum eDaysOfWeek + { + None = 0, + Sunday = 1, + Monday = 2, + Tuesday = 4, + Wednesday = 8, + Thursday = 16, + Friday = 32, + Saturday = 64, + WeekDays = Monday | Tuesday | Wednesday | Thursday | Friday, + WeekEnds = Saturday | Sunday + } + + public static class DaysOfWeekExtensions + { + public static eDaysOfWeek ToDaysOfWeek(this DayOfWeek extends) + { + switch (extends) + { + case DayOfWeek.Sunday: + return eDaysOfWeek.Sunday; + case DayOfWeek.Monday: + return eDaysOfWeek.Monday; + case DayOfWeek.Tuesday: + return eDaysOfWeek.Tuesday; + case DayOfWeek.Wednesday: + return eDaysOfWeek.Wednesday; + case DayOfWeek.Thursday: + return eDaysOfWeek.Thursday; + case DayOfWeek.Friday: + return eDaysOfWeek.Friday; + case DayOfWeek.Saturday: + return eDaysOfWeek.Saturday; + default: + throw new ArgumentOutOfRangeException("extends"); + } + } + } +}