| | 1 | | #pragma warning disable CS1591 |
| | 2 | |
|
| | 3 | | using System; |
| | 4 | | using Jellyfin.Database.Implementations.Enums; |
| | 5 | |
|
| | 6 | | namespace Jellyfin.Data |
| | 7 | | { |
| | 8 | | public static class DayOfWeekHelper |
| | 9 | | { |
| | 10 | | public static DayOfWeek[] GetDaysOfWeek(DynamicDayOfWeek day) |
| | 11 | | { |
| 0 | 12 | | return day switch |
| 0 | 13 | | { |
| 0 | 14 | | DynamicDayOfWeek.Everyday => new[] { DayOfWeek.Sunday, DayOfWeek.Monday, DayOfWeek.Tuesday, DayOfWeek.We |
| 0 | 15 | | DynamicDayOfWeek.Weekday => new[] { DayOfWeek.Monday, DayOfWeek.Tuesday, DayOfWeek.Wednesday, DayOfWeek. |
| 0 | 16 | | DynamicDayOfWeek.Weekend => new[] { DayOfWeek.Sunday, DayOfWeek.Saturday }, |
| 0 | 17 | | _ => new[] { (DayOfWeek)day } |
| 0 | 18 | | }; |
| | 19 | | } |
| | 20 | |
|
| | 21 | | public static bool Contains(this DynamicDayOfWeek dynamicDayOfWeek, DayOfWeek dayOfWeek) |
| | 22 | | { |
| 1 | 23 | | return dynamicDayOfWeek switch |
| 1 | 24 | | { |
| 1 | 25 | | DynamicDayOfWeek.Everyday => true, |
| 0 | 26 | | DynamicDayOfWeek.Weekday => dayOfWeek is >= DayOfWeek.Monday and <= DayOfWeek.Friday, |
| 0 | 27 | | DynamicDayOfWeek.Weekend => dayOfWeek is DayOfWeek.Saturday or DayOfWeek.Sunday, |
| 0 | 28 | | _ => (DayOfWeek)dynamicDayOfWeek == dayOfWeek |
| 1 | 29 | | }; |
| | 30 | | } |
| | 31 | | } |
| | 32 | | } |