Fix warnings, improve performance (#1665)

* Fix warnings, improve performance

`QueryResult.Items` is now a `IReadOnlyList` so we don't need to
allocate a new `Array` when we have a `List` (and `Items` shouldn't need to
be mutable anyway)

* Update Providers .csproj to latest C#

* Remove extra newline from DtoService.cs

* Remove extra newline from UserLibraryService.cs
This commit is contained in:
Bond-009
2019-09-02 08:19:29 +02:00
committed by Anthony Lavado
parent cb393c215a
commit ee637e8fec
37 changed files with 308 additions and 218 deletions

View File

@@ -2871,16 +2871,16 @@ namespace MediaBrowser.Controller.Entities
/// Gets or sets the remote trailers.
/// </summary>
/// <value>The remote trailers.</value>
public MediaUrl[] RemoteTrailers { get; set; }
public IReadOnlyList<MediaUrl> RemoteTrailers { get; set; }
public IEnumerable<BaseItem> GetExtras()
{
return ExtraIds.Select(LibraryManager.GetItemById).Where(i => i != null).OrderBy(i => i.SortName);
}
public IEnumerable<BaseItem> GetExtras(ExtraType[] extraTypes)
public IEnumerable<BaseItem> GetExtras(IReadOnlyCollection<ExtraType> extraTypes)
{
return ExtraIds.Select(LibraryManager.GetItemById).Where(i => i != null && extraTypes.Contains(i.ExtraType.Value)).OrderBy(i => i.SortName);
return ExtraIds.Select(LibraryManager.GetItemById).Where(i => i != null && extraTypes.Contains(i.ExtraType.Value));
}
public IEnumerable<BaseItem> GetTrailers()
@@ -2908,7 +2908,7 @@ namespace MediaBrowser.Controller.Entities
}
// Possible types of extra videos
public static ExtraType[] DisplayExtraTypes = new[] { Model.Entities.ExtraType.BehindTheScenes, Model.Entities.ExtraType.Clip, Model.Entities.ExtraType.DeletedScene, Model.Entities.ExtraType.Interview, Model.Entities.ExtraType.Sample, Model.Entities.ExtraType.Scene };
public static readonly IReadOnlyCollection<ExtraType> DisplayExtraTypes = new[] { Model.Entities.ExtraType.BehindTheScenes, Model.Entities.ExtraType.Clip, Model.Entities.ExtraType.DeletedScene, Model.Entities.ExtraType.Interview, Model.Entities.ExtraType.Sample, Model.Entities.ExtraType.Scene };
public virtual bool SupportsExternalTransfer => false;
}