mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-12-26 10:44:50 +03:00
Reduce warnings in MediaBrowser.Controller (#6006)
Co-authored-by: Patrick Barron <18354464+barronpm@users.noreply.github.com>
This commit is contained in:
@@ -18,6 +18,28 @@ namespace MediaBrowser.Controller.Dto
|
||||
ItemFields.RefreshState
|
||||
};
|
||||
|
||||
private static readonly ImageType[] AllImageTypes = Enum.GetValues<ImageType>();
|
||||
|
||||
private static readonly ItemFields[] AllItemFields = Enum.GetValues<ItemFields>()
|
||||
.Except(DefaultExcludedFields)
|
||||
.ToArray();
|
||||
|
||||
public DtoOptions()
|
||||
: this(true)
|
||||
{
|
||||
}
|
||||
|
||||
public DtoOptions(bool allFields)
|
||||
{
|
||||
ImageTypeLimit = int.MaxValue;
|
||||
EnableImages = true;
|
||||
EnableUserData = true;
|
||||
AddCurrentProgram = true;
|
||||
|
||||
Fields = allFields ? AllItemFields : Array.Empty<ItemFields>();
|
||||
ImageTypes = AllImageTypes;
|
||||
}
|
||||
|
||||
public IReadOnlyList<ItemFields> Fields { get; set; }
|
||||
|
||||
public IReadOnlyList<ImageType> ImageTypes { get; set; }
|
||||
@@ -32,34 +54,9 @@ namespace MediaBrowser.Controller.Dto
|
||||
|
||||
public bool AddCurrentProgram { get; set; }
|
||||
|
||||
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;
|
||||
EnableImages = true;
|
||||
EnableUserData = true;
|
||||
AddCurrentProgram = true;
|
||||
|
||||
Fields = allFields ? AllItemFields : Array.Empty<ItemFields>();
|
||||
ImageTypes = AllImageTypes;
|
||||
}
|
||||
|
||||
public int GetImageLimit(ImageType type)
|
||||
{
|
||||
if (EnableImages && ImageTypes.Contains(type))
|
||||
|
||||
Reference in New Issue
Block a user