feat: Adding eDaysOfWeek enum

This commit is contained in:
Drew Tingen
2020-11-02 11:56:10 -05:00
committed by Chris Cameron
parent f0bcb3bbc9
commit a13f1fd687
3 changed files with 47 additions and 0 deletions

View File

@@ -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

View File

@@ -91,6 +91,7 @@
<Compile Include="Comparers\UndefinedVersionEqualityComparer.cs" />
<Compile Include="eConsoleColor.cs" />
<Compile Include="DateTimeUtils.cs" />
<Compile Include="eDaysOfWeek.cs" />
<Compile Include="Email\EmailClient.cs" />
<Compile Include="Email\eMailErrorCode.cs" />
<Compile Include="Email\EmailStringCollection.cs" />

View File

@@ -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");
}
}
}
}