diff options
Diffstat (limited to 'MediaBrowser.Controller/Dto/DtoOptions.cs')
| -rw-r--r-- | MediaBrowser.Controller/Dto/DtoOptions.cs | 47 |
1 files changed, 23 insertions, 24 deletions
diff --git a/MediaBrowser.Controller/Dto/DtoOptions.cs b/MediaBrowser.Controller/Dto/DtoOptions.cs index 356783750..ecc833154 100644 --- a/MediaBrowser.Controller/Dto/DtoOptions.cs +++ b/MediaBrowser.Controller/Dto/DtoOptions.cs @@ -1,3 +1,5 @@ +#nullable disable + #pragma warning disable CS1591 using System; @@ -16,37 +18,17 @@ namespace MediaBrowser.Controller.Dto ItemFields.RefreshState }; - public IReadOnlyList<ItemFields> Fields { get; set; } - - public IReadOnlyList<ImageType> ImageTypes { get; set; } - - public int ImageTypeLimit { get; set; } - - public bool EnableImages { get; set; } - - public bool AddProgramRecordingInfo { get; set; } - - public bool EnableUserData { get; set; } + private static readonly ImageType[] AllImageTypes = Enum.GetValues<ImageType>(); - public bool AddCurrentProgram { get; set; } + private static readonly ItemFields[] AllItemFields = Enum.GetValues<ItemFields>() + .Except(DefaultExcludedFields) + .ToArray(); public DtoOptions() : this(true) { } - private static readonly ImageType[] AllImageTypes = Enum.GetNames(typeof(ImageType)) - .Select(i => (ImageType)Enum.Parse(typeof(ImageType), i, true)) - .ToArray(); - - private static readonly ItemFields[] AllItemFields = Enum.GetNames(typeof(ItemFields)) - .Select(i => (ItemFields)Enum.Parse(typeof(ItemFields), i, true)) - .Except(DefaultExcludedFields) - .ToArray(); - - public bool ContainsField(ItemFields field) - => Fields.Contains(field); - public DtoOptions(bool allFields) { ImageTypeLimit = int.MaxValue; @@ -58,6 +40,23 @@ namespace MediaBrowser.Controller.Dto ImageTypes = AllImageTypes; } + public IReadOnlyList<ItemFields> Fields { get; set; } + + public IReadOnlyList<ImageType> ImageTypes { get; set; } + + public int ImageTypeLimit { get; set; } + + public bool EnableImages { get; set; } + + public bool AddProgramRecordingInfo { get; set; } + + public bool EnableUserData { get; set; } + + public bool AddCurrentProgram { get; set; } + + public bool ContainsField(ItemFields field) + => Fields.Contains(field); + public int GetImageLimit(ImageType type) { if (EnableImages && ImageTypes.Contains(type)) |
