From bb018c4adc7916fafb7dac2db9a902be8d20e75d Mon Sep 17 00:00:00 2001 From: Bond-009 Date: Wed, 17 Apr 2024 18:44:50 +0200 Subject: Enable nullable for LibraryManager (#11191) --- MediaBrowser.Controller/Library/ILibraryManager.cs | 37 +++++++++++----------- 1 file changed, 18 insertions(+), 19 deletions(-) (limited to 'MediaBrowser.Controller/Library/ILibraryManager.cs') diff --git a/MediaBrowser.Controller/Library/ILibraryManager.cs b/MediaBrowser.Controller/Library/ILibraryManager.cs index f0680f101..37703ceee 100644 --- a/MediaBrowser.Controller/Library/ILibraryManager.cs +++ b/MediaBrowser.Controller/Library/ILibraryManager.cs @@ -1,5 +1,3 @@ -#nullable disable - #pragma warning disable CA1002, CS1591 using System; @@ -33,17 +31,17 @@ namespace MediaBrowser.Controller.Library /// /// Occurs when [item added]. /// - event EventHandler ItemAdded; + event EventHandler? ItemAdded; /// /// Occurs when [item updated]. /// - event EventHandler ItemUpdated; + event EventHandler? ItemUpdated; /// /// Occurs when [item removed]. /// - event EventHandler ItemRemoved; + event EventHandler? ItemRemoved; /// /// Gets the root folder. @@ -60,10 +58,10 @@ namespace MediaBrowser.Controller.Library /// The parent. /// An instance of . /// BaseItem. - BaseItem ResolvePath( + BaseItem? ResolvePath( FileSystemMetadata fileInfo, - Folder parent = null, - IDirectoryService directoryService = null); + Folder? parent = null, + IDirectoryService? directoryService = null); /// /// Resolves a set of files into a list of BaseItem. @@ -86,7 +84,7 @@ namespace MediaBrowser.Controller.Library /// /// The name of the person. /// Task{Person}. - Person GetPerson(string name); + Person? GetPerson(string name); /// /// Finds the by path. @@ -94,7 +92,7 @@ namespace MediaBrowser.Controller.Library /// The path. /// true is the path is a directory; otherwise false. /// BaseItem. - BaseItem FindByPath(string path, bool? isFolder); + BaseItem? FindByPath(string path, bool? isFolder); /// /// Gets the artist. @@ -166,7 +164,8 @@ namespace MediaBrowser.Controller.Library /// /// The id. /// BaseItem. - BaseItem GetItemById(Guid id); + /// is null. + BaseItem? GetItemById(Guid id); /// /// Gets the item by id, as T. @@ -174,7 +173,7 @@ namespace MediaBrowser.Controller.Library /// The item id. /// The type of item. /// The item. - T GetItemById(Guid id) + T? GetItemById(Guid id) where T : BaseItem; /// @@ -184,7 +183,7 @@ namespace MediaBrowser.Controller.Library /// The user id to validate against. /// The type of item. /// The item if found. - public T GetItemById(Guid id, Guid userId) + public T? GetItemById(Guid id, Guid userId) where T : BaseItem; /// @@ -194,7 +193,7 @@ namespace MediaBrowser.Controller.Library /// The user to validate against. /// The type of item. /// The item if found. - public T GetItemById(Guid id, User user) + public T? GetItemById(Guid id, User? user) where T : BaseItem; /// @@ -228,9 +227,9 @@ namespace MediaBrowser.Controller.Library /// The sort by. /// The sort order. /// IEnumerable{BaseItem}. - IEnumerable Sort(IEnumerable items, User user, IEnumerable sortBy, SortOrder sortOrder); + IEnumerable Sort(IEnumerable items, User? user, IEnumerable sortBy, SortOrder sortOrder); - IEnumerable Sort(IEnumerable items, User user, IEnumerable<(ItemSortBy OrderBy, SortOrder SortOrder)> orderBy); + IEnumerable Sort(IEnumerable items, User? user, IEnumerable<(ItemSortBy OrderBy, SortOrder SortOrder)> orderBy); /// /// Gets the user root folder. @@ -243,7 +242,7 @@ namespace MediaBrowser.Controller.Library /// /// Item to create. /// Parent of new item. - void CreateItem(BaseItem item, BaseItem parent); + void CreateItem(BaseItem item, BaseItem? parent); /// /// Creates the items. @@ -251,7 +250,7 @@ namespace MediaBrowser.Controller.Library /// Items to create. /// Parent of new items. /// CancellationToken to use for operation. - void CreateItems(IReadOnlyList items, BaseItem parent, CancellationToken cancellationToken); + void CreateItems(IReadOnlyList items, BaseItem? parent, CancellationToken cancellationToken); /// /// Updates the item. @@ -529,7 +528,7 @@ namespace MediaBrowser.Controller.Library /// QueryResult<BaseItem>. QueryResult QueryItems(InternalItemsQuery query); - string GetPathAfterNetworkSubstitution(string path, BaseItem ownerItem = null); + string GetPathAfterNetworkSubstitution(string path, BaseItem? ownerItem = null); /// /// Converts the image to local. -- cgit v1.2.3