diff options
| author | Bond_009 <bond.009@outlook.com> | 2020-04-23 11:29:19 +0200 |
|---|---|---|
| committer | Bond_009 <bond.009@outlook.com> | 2020-04-23 11:29:19 +0200 |
| commit | 118f30059c11cf43d9780c8e0328423e35b44b76 (patch) | |
| tree | 3dae865e35e3cd026e188706b5eec739cb33bf7b /MediaBrowser.Api/UserLibrary/BaseItemsRequest.cs | |
| parent | 10afa4509db6fc7e3c2e7dd6ccc8997dfe3b10f9 (diff) | |
| parent | 97e383d108a4adb7e57c13d67f1d36bd1b5ce7b5 (diff) | |
Merge branch 'master' into nullable4
Diffstat (limited to 'MediaBrowser.Api/UserLibrary/BaseItemsRequest.cs')
| -rw-r--r-- | MediaBrowser.Api/UserLibrary/BaseItemsRequest.cs | 33 |
1 files changed, 14 insertions, 19 deletions
diff --git a/MediaBrowser.Api/UserLibrary/BaseItemsRequest.cs b/MediaBrowser.Api/UserLibrary/BaseItemsRequest.cs index a26f59573..7561b5c89 100644 --- a/MediaBrowser.Api/UserLibrary/BaseItemsRequest.cs +++ b/MediaBrowser.Api/UserLibrary/BaseItemsRequest.cs @@ -396,12 +396,10 @@ namespace MediaBrowser.Api.UserLibrary public VideoType[] GetVideoTypes() { - if (string.IsNullOrEmpty(VideoTypes)) - { - return Array.Empty<VideoType>(); - } - - return VideoTypes.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Select(v => (VideoType)Enum.Parse(typeof(VideoType), v, true)).ToArray(); + return string.IsNullOrEmpty(VideoTypes) + ? Array.Empty<VideoType>() + : VideoTypes.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries) + .Select(v => Enum.Parse<VideoType>(v, true)).ToArray(); } /// <summary> @@ -412,12 +410,10 @@ namespace MediaBrowser.Api.UserLibrary { var val = Filters; - if (string.IsNullOrEmpty(val)) - { - return new ItemFilter[] { }; - } - - return val.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Select(v => (ItemFilter)Enum.Parse(typeof(ItemFilter), v, true)).ToArray(); + return string.IsNullOrEmpty(val) + ? Array.Empty<ItemFilter>() + : val.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries) + .Select(v => Enum.Parse<ItemFilter>(v, true)).ToArray(); } /// <summary> @@ -428,12 +424,9 @@ namespace MediaBrowser.Api.UserLibrary { var val = ImageTypes; - if (string.IsNullOrEmpty(val)) - { - return new ImageType[] { }; - } - - return val.Split(',').Select(v => (ImageType)Enum.Parse(typeof(ImageType), v, true)).ToArray(); + return string.IsNullOrEmpty(val) + ? Array.Empty<ImageType>() + : val.Split(',').Select(v => Enum.Parse<ImageType>(v, true)).ToArray(); } /// <summary> @@ -469,7 +462,9 @@ namespace MediaBrowser.Api.UserLibrary var sortOrderIndex = sortOrders.Length > i ? i : 0; var sortOrderValue = sortOrders.Length > sortOrderIndex ? sortOrders[sortOrderIndex] : null; - var sortOrder = string.Equals(sortOrderValue, "Descending", StringComparison.OrdinalIgnoreCase) ? MediaBrowser.Model.Entities.SortOrder.Descending : MediaBrowser.Model.Entities.SortOrder.Ascending; + var sortOrder = string.Equals(sortOrderValue, "Descending", StringComparison.OrdinalIgnoreCase) + ? MediaBrowser.Model.Entities.SortOrder.Descending + : MediaBrowser.Model.Entities.SortOrder.Ascending; result[i] = new ValueTuple<string, SortOrder>(vals[i], sortOrder); } |
