jellyfin/Jellyfin.Data/DayOfWeekHelper.cs

68 lines
1.9 KiB
C#
Raw Normal View History

#pragma warning disable CS1591
using System;
2018-12-27 23:27:57 +00:00
using System.Collections.Generic;
2020-05-13 02:10:35 +00:00
using Jellyfin.Data.Enums;
2018-12-27 23:27:57 +00:00
2020-05-13 02:10:35 +00:00
namespace Jellyfin.Data
2018-12-27 23:27:57 +00:00
{
public static class DayOfWeekHelper
{
public static List<DayOfWeek> GetDaysOfWeek(DynamicDayOfWeek day)
{
var days = new List<DayOfWeek>(7);
2018-12-27 23:27:57 +00:00
if (day == DynamicDayOfWeek.Sunday
|| day == DynamicDayOfWeek.Weekend
|| day == DynamicDayOfWeek.Everyday)
2018-12-27 23:27:57 +00:00
{
days.Add(DayOfWeek.Sunday);
2018-12-27 23:27:57 +00:00
}
if (day == DynamicDayOfWeek.Monday
|| day == DynamicDayOfWeek.Weekday
|| day == DynamicDayOfWeek.Everyday)
2018-12-27 23:27:57 +00:00
{
days.Add(DayOfWeek.Monday);
2018-12-27 23:27:57 +00:00
}
if (day == DynamicDayOfWeek.Tuesday
|| day == DynamicDayOfWeek.Weekday
|| day == DynamicDayOfWeek.Everyday)
2018-12-27 23:27:57 +00:00
{
days.Add(DayOfWeek.Tuesday);
2018-12-27 23:27:57 +00:00
}
if (day == DynamicDayOfWeek.Wednesday
|| day == DynamicDayOfWeek.Weekday
|| day == DynamicDayOfWeek.Everyday)
2018-12-27 23:27:57 +00:00
{
days.Add(DayOfWeek.Wednesday);
2018-12-27 23:27:57 +00:00
}
if (day == DynamicDayOfWeek.Thursday
|| day == DynamicDayOfWeek.Weekday
|| day == DynamicDayOfWeek.Everyday)
2018-12-27 23:27:57 +00:00
{
days.Add(DayOfWeek.Thursday);
2018-12-27 23:27:57 +00:00
}
if (day == DynamicDayOfWeek.Friday
|| day == DynamicDayOfWeek.Weekday
|| day == DynamicDayOfWeek.Everyday)
2018-12-27 23:27:57 +00:00
{
days.Add(DayOfWeek.Friday);
2018-12-27 23:27:57 +00:00
}
if (day == DynamicDayOfWeek.Saturday
|| day == DynamicDayOfWeek.Weekend
|| day == DynamicDayOfWeek.Everyday)
2018-12-27 23:27:57 +00:00
{
days.Add(DayOfWeek.Saturday);
2018-12-27 23:27:57 +00:00
}
return days;
2018-12-27 23:27:57 +00:00
}
}
}