The Free Software Media System - Server Backend & API
Replace != null with is not null
Bond_00952194f56b5f0
diff --git a/Emby.Dlna/ContentDirectory/ContentDirectoryService.cs b/Emby.Dlna/ContentDirectory/ContentDirectoryService.csindex 319a9f5500..389e971a66 100644--- a/Emby.Dlna/ContentDirectory/ContentDirectoryService.cs+++ b/Emby.Dlna/ContentDirectory/ContentDirectoryService.cs@@ -141,7 +141,7 @@ namespace Emby.Dlna.ContentDirectory{var user = _userManager.GetUserById(Guid.Parse(profile.UserId));- if (user != null)+ if (user is not null){return user;}@@ -153,7 +153,7 @@ namespace Emby.Dlna.ContentDirectory{var user = _userManager.GetUserById(Guid.Parse(userId));- if (user != null)+ if (user is not null){return user;}diff --git a/Emby.Dlna/ContentDirectory/ControlHandler.cs b/Emby.Dlna/ContentDirectory/ControlHandler.csindex fc69960fd6..abd594a3a1 100644--- a/Emby.Dlna/ContentDirectory/ControlHandler.cs+++ b/Emby.Dlna/ContentDirectory/ControlHandler.cs@@ -1048,7 +1048,7 @@ namespace Emby.Dlna.ContentDirectoryParentId = parent?.Id ?? Guid.Empty,GroupItems = true},- query.DtoOptions).Select(i => i.Item1 ?? i.Item2.FirstOrDefault()).Where(i => i != null).ToArray();+ query.DtoOptions).Select(i => i.Item1 ?? i.Item2.FirstOrDefault()).Where(i => i is not null).ToArray();return ToResult(query.StartIndex, items);}diff --git a/Emby.Dlna/Didl/DidlBuilder.cs b/Emby.Dlna/Didl/DidlBuilder.csindex e2e3b2d8b6..e9041186f4 100644--- a/Emby.Dlna/Didl/DidlBuilder.cs+++ b/Emby.Dlna/Didl/DidlBuilder.cs@@ -153,7 +153,7 @@ namespace Emby.Dlna.Didlwriter.WriteAttributeString("restricted", "1");writer.WriteAttributeString("id", clientId);- if (context != null)+ if (context is not null){writer.WriteAttributeString("parentID", GetClientId(context, contextStubType));}@@ -652,7 +652,7 @@ namespace Emby.Dlna.Didl{writer.WriteAttributeString("id", clientId);- if (context != null)+ if (context is not null){writer.WriteAttributeString("parentID", GetClientId(context, null));}@@ -701,7 +701,7 @@ namespace Emby.Dlna.Didl}var userdata = _userDataManager.GetUserData(user, item);- var playbackPositionTicks = (streamInfo != null && streamInfo.StartPositionTicks > 0) ? streamInfo.StartPositionTicks : userdata.PlaybackPositionTicks;+ var playbackPositionTicks = (streamInfo is not null && streamInfo.StartPositionTicks > 0) ? streamInfo.StartPositionTicks : userdata.PlaybackPositionTicks;if (playbackPositionTicks > 0){@@ -916,7 +916,7 @@ namespace Emby.Dlna.Didl}}- if (hasAlbumArtists != null)+ if (hasAlbumArtists is not null){foreach (var albumArtist in hasAlbumArtists.AlbumArtists){@@ -1093,7 +1093,7 @@ namespace Emby.Dlna.Didlif (item is Audio audioItem){var album = audioItem.AlbumEntity;- return album != null && album.HasImage(ImageType.Primary)+ return album is not null && album.HasImage(ImageType.Primary)? GetImageInfo(album, ImageType.Primary): null;}@@ -1106,7 +1106,7 @@ namespace Emby.Dlna.Didl// For other item types check parents, but be aware that image retrieved from a parent may be not suitable for this media item.var parentWithImage = GetFirstParentWithImageBelowUserRoot(item);- if (parentWithImage != null)+ if (parentWithImage is not null){return GetImageInfo(parentWithImage, ImageType.Primary);}diff --git a/Emby.Dlna/DlnaManager.cs b/Emby.Dlna/DlnaManager.csindex 31b999f64c..b1ee43305b 100644--- a/Emby.Dlna/DlnaManager.cs+++ b/Emby.Dlna/DlnaManager.cs@@ -105,7 +105,7 @@ namespace Emby.DlnaArgumentNullException.ThrowIfNull(deviceInfo);var profile = GetProfiles()- .FirstOrDefault(i => i.Identification != null && IsMatch(deviceInfo, i.Identification));+ .FirstOrDefault(i => i.Identification is not null && IsMatch(deviceInfo, i.Identification));if (profile is null){@@ -171,7 +171,7 @@ namespace Emby.Dlna{ArgumentNullException.ThrowIfNull(headers);- var profile = GetProfiles().FirstOrDefault(i => i.Identification != null && IsMatch(headers, i.Identification));+ var profile = GetProfiles().FirstOrDefault(i => i.Identification is not null && IsMatch(headers, i.Identification));if (profile is null){_logger.LogDebug("No matching device profile found. {@Headers}", headers);@@ -224,7 +224,7 @@ namespace Emby.Dlnareturn _fileSystem.GetFilePaths(path).Where(i => string.Equals(Path.GetExtension(i), ".xml", StringComparison.OrdinalIgnoreCase)).Select(i => ParseProfileFile(i, type))- .Where(i => i != null)+ .Where(i => i is not null).ToList()!; // We just filtered out all the nulls}catch (IOException)diff --git a/Emby.Dlna/Eventing/DlnaEventManager.cs b/Emby.Dlna/Eventing/DlnaEventManager.csindex 68895a7fed..c0eacf5d83 100644--- a/Emby.Dlna/Eventing/DlnaEventManager.cs+++ b/Emby.Dlna/Eventing/DlnaEventManager.cs@@ -35,7 +35,7 @@ namespace Emby.Dlna.Eventingpublic EventSubscriptionResponse RenewEventSubscription(string subscriptionId, string notificationType, string requestedTimeoutString, string callbackUrl){var subscription = GetSubscription(subscriptionId, false);- if (subscription != null)+ if (subscription is not null){subscription.TimeoutSeconds = ParseTimeout(requestedTimeoutString) ?? 300;int timeoutSeconds = subscription.TimeoutSeconds;diff --git a/Emby.Dlna/Main/DlnaEntryPoint.cs b/Emby.Dlna/Main/DlnaEntryPoint.csindex bcd7ece085..2dc079254a 100644--- a/Emby.Dlna/Main/DlnaEntryPoint.cs+++ b/Emby.Dlna/Main/DlnaEntryPoint.cs@@ -222,7 +222,7 @@ namespace Emby.Dlna.Main{try{- if (communicationsServer != null)+ if (communicationsServer is not null){((DeviceDiscovery)_deviceDiscovery).Start(communicationsServer);}@@ -253,7 +253,7 @@ namespace Emby.Dlna.Mainreturn;}- if (_publisher != null)+ if (_publisher is not null){return;}@@ -382,7 +382,7 @@ namespace Emby.Dlna.Main{lock (_syncLock){- if (_manager != null)+ if (_manager is not null){return;}@@ -417,7 +417,7 @@ namespace Emby.Dlna.Main{lock (_syncLock){- if (_manager != null)+ if (_manager is not null){try{@@ -436,7 +436,7 @@ namespace Emby.Dlna.Mainpublic void DisposeDevicePublisher(){- if (_publisher != null)+ if (_publisher is not null){_logger.LogInformation("Disposing SsdpDevicePublisher");_publisher.Dispose();@@ -456,7 +456,7 @@ namespace Emby.Dlna.MainDisposePlayToManager();DisposeDeviceDiscovery();- if (_communicationsServer != null)+ if (_communicationsServer is not null){_logger.LogInformation("Disposing SsdpCommunicationsServer");_communicationsServer.Dispose();diff --git a/Emby.Dlna/PlayTo/Device.cs b/Emby.Dlna/PlayTo/Device.csindex 1c7730187b..fc000334a1 100644--- a/Emby.Dlna/PlayTo/Device.cs+++ b/Emby.Dlna/PlayTo/Device.cs@@ -543,7 +543,7 @@ namespace Emby.Dlna.PlayTocurrentObject = await GetMediaInfo(avCommands, cancellationToken).ConfigureAwait(false);}- if (currentObject != null)+ if (currentObject is not null){UpdateMediaInfo(currentObject, transportState.Value);}@@ -585,7 +585,7 @@ namespace Emby.Dlna.PlayToif (_connectFailureCount >= 3){var action = OnDeviceUnavailable;- if (action != null)+ if (action is not null){_logger.LogDebug("Disposing device due to loss of connection");action();@@ -631,7 +631,7 @@ namespace Emby.Dlna.PlayToreturn;}- var volume = result.Document.Descendants(UPnpNamespaces.RenderingControl + "GetVolumeResponse").Select(i => i.Element("CurrentVolume")).FirstOrDefault(i => i != null);+ var volume = result.Document.Descendants(UPnpNamespaces.RenderingControl + "GetVolumeResponse").Select(i => i.Element("CurrentVolume")).FirstOrDefault(i => i is not null);var volumeValue = volume?.Value;if (string.IsNullOrWhiteSpace(volumeValue))@@ -683,7 +683,7 @@ namespace Emby.Dlna.PlayTovar valueNode = result.Document.Descendants(UPnpNamespaces.RenderingControl + "GetMuteResponse").Select(i => i.Element("CurrentMute"))- .FirstOrDefault(i => i != null);+ .FirstOrDefault(i => i is not null);IsMuted = string.Equals(valueNode?.Value, "1", StringComparison.OrdinalIgnoreCase);}@@ -715,11 +715,11 @@ namespace Emby.Dlna.PlayTo}var transportState =- result.Document.Descendants(UPnpNamespaces.AvTransport + "GetTransportInfoResponse").Select(i => i.Element("CurrentTransportState")).FirstOrDefault(i => i != null);+ result.Document.Descendants(UPnpNamespaces.AvTransport + "GetTransportInfoResponse").Select(i => i.Element("CurrentTransportState")).FirstOrDefault(i => i is not null);var transportStateValue = transportState?.Value;- if (transportStateValue != null+ if (transportStateValue is not null&& Enum.TryParse(transportStateValue, true, out TransportState state)){return state;@@ -832,10 +832,10 @@ namespace Emby.Dlna.PlayToreturn (false, null);}- var trackUriElem = result.Document.Descendants(UPnpNamespaces.AvTransport + "GetPositionInfoResponse").Select(i => i.Element("TrackURI")).FirstOrDefault(i => i != null);+ var trackUriElem = result.Document.Descendants(UPnpNamespaces.AvTransport + "GetPositionInfoResponse").Select(i => i.Element("TrackURI")).FirstOrDefault(i => i is not null);var trackUri = trackUriElem?.Value;- var durationElem = result.Document.Descendants(UPnpNamespaces.AvTransport + "GetPositionInfoResponse").Select(i => i.Element("TrackDuration")).FirstOrDefault(i => i != null);+ var durationElem = result.Document.Descendants(UPnpNamespaces.AvTransport + "GetPositionInfoResponse").Select(i => i.Element("TrackDuration")).FirstOrDefault(i => i is not null);var duration = durationElem?.Value;if (!string.IsNullOrWhiteSpace(duration)@@ -848,7 +848,7 @@ namespace Emby.Dlna.PlayToDuration = null;}- var positionElem = result.Document.Descendants(UPnpNamespaces.AvTransport + "GetPositionInfoResponse").Select(i => i.Element("RelTime")).FirstOrDefault(i => i != null);+ var positionElem = result.Document.Descendants(UPnpNamespaces.AvTransport + "GetPositionInfoResponse").Select(i => i.Element("RelTime")).FirstOrDefault(i => i is not null);var position = positionElem?.Value;if (!string.IsNullOrWhiteSpace(position) && !string.Equals(position, "NOT_IMPLEMENTED", StringComparison.OrdinalIgnoreCase))@@ -959,11 +959,11 @@ namespace Emby.Dlna.PlayTovar resElement = container.Element(UPnpNamespaces.Res);- if (resElement != null)+ if (resElement is not null){var info = resElement.Attribute(UPnpNamespaces.ProtocolInfo);- if (info != null && !string.IsNullOrWhiteSpace(info.Value))+ if (info is not null && !string.IsNullOrWhiteSpace(info.Value)){return info.Value.Split(':');}@@ -974,7 +974,7 @@ namespace Emby.Dlna.PlayToprivate async Task<TransportCommands> GetAVProtocolAsync(CancellationToken cancellationToken){- if (AvCommands != null)+ if (AvCommands is not null){return AvCommands;}@@ -1006,7 +1006,7 @@ namespace Emby.Dlna.PlayToprivate async Task<TransportCommands> GetRenderingProtocolAsync(CancellationToken cancellationToken){- if (RendererCommands != null)+ if (RendererCommands is not null){return RendererCommands;}@@ -1070,13 +1070,13 @@ namespace Emby.Dlna.PlayTovar friendlyNames = new List<string>();var name = document.Descendants(UPnpNamespaces.Ud.GetName("friendlyName")).FirstOrDefault();- if (name != null && !string.IsNullOrWhiteSpace(name.Value))+ if (name is not null && !string.IsNullOrWhiteSpace(name.Value)){friendlyNames.Add(name.Value);}var room = document.Descendants(UPnpNamespaces.Ud.GetName("roomName")).FirstOrDefault();- if (room != null && !string.IsNullOrWhiteSpace(room.Value))+ if (room is not null && !string.IsNullOrWhiteSpace(room.Value)){friendlyNames.Add(room.Value);}@@ -1088,61 +1088,61 @@ namespace Emby.Dlna.PlayTo};var model = document.Descendants(UPnpNamespaces.Ud.GetName("modelName")).FirstOrDefault();- if (model != null)+ if (model is not null){deviceProperties.ModelName = model.Value;}var modelNumber = document.Descendants(UPnpNamespaces.Ud.GetName("modelNumber")).FirstOrDefault();- if (modelNumber != null)+ if (modelNumber is not null){deviceProperties.ModelNumber = modelNumber.Value;}var uuid = document.Descendants(UPnpNamespaces.Ud.GetName("UDN")).FirstOrDefault();- if (uuid != null)+ if (uuid is not null){deviceProperties.UUID = uuid.Value;}var manufacturer = document.Descendants(UPnpNamespaces.Ud.GetName("manufacturer")).FirstOrDefault();- if (manufacturer != null)+ if (manufacturer is not null){deviceProperties.Manufacturer = manufacturer.Value;}var manufacturerUrl = document.Descendants(UPnpNamespaces.Ud.GetName("manufacturerURL")).FirstOrDefault();- if (manufacturerUrl != null)+ if (manufacturerUrl is not null){deviceProperties.ManufacturerUrl = manufacturerUrl.Value;}var presentationUrl = document.Descendants(UPnpNamespaces.Ud.GetName("presentationURL")).FirstOrDefault();- if (presentationUrl != null)+ if (presentationUrl is not null){deviceProperties.PresentationUrl = presentationUrl.Value;}var modelUrl = document.Descendants(UPnpNamespaces.Ud.GetName("modelURL")).FirstOrDefault();- if (modelUrl != null)+ if (modelUrl is not null){deviceProperties.ModelUrl = modelUrl.Value;}var serialNumber = document.Descendants(UPnpNamespaces.Ud.GetName("serialNumber")).FirstOrDefault();- if (serialNumber != null)+ if (serialNumber is not null){deviceProperties.SerialNumber = serialNumber.Value;}var modelDescription = document.Descendants(UPnpNamespaces.Ud.GetName("modelDescription")).FirstOrDefault();- if (modelDescription != null)+ if (modelDescription is not null){deviceProperties.ModelDescription = modelDescription.Value;}var icon = document.Descendants(UPnpNamespaces.Ud.GetName("icon")).FirstOrDefault();- if (icon != null)+ if (icon is not null){deviceProperties.Icon = CreateIcon(icon);}@@ -1164,7 +1164,7 @@ namespace Emby.Dlna.PlayTo{var service = Create(element);- if (service != null)+ if (service is not null){deviceProperties.Services.Add(service);}@@ -1214,7 +1214,7 @@ namespace Emby.Dlna.PlayToif (mediaInfo is null){- if (previousMediaInfo != null)+ if (previousMediaInfo is not null){OnPlaybackStop(previousMediaInfo);}diff --git a/Emby.Dlna/PlayTo/PlayToController.cs b/Emby.Dlna/PlayTo/PlayToController.csindex fca5fc2a0d..d46a501c79 100644--- a/Emby.Dlna/PlayTo/PlayToController.cs+++ b/Emby.Dlna/PlayTo/PlayToController.cs@@ -84,7 +84,7 @@ namespace Emby.Dlna.PlayTo_mediaEncoder = mediaEncoder;}- public bool IsSessionActive => !_disposed && _device != null;+ public bool IsSessionActive => !_disposed && _device is not null;public bool SupportsMediaControl => IsSessionActive;@@ -156,7 +156,7 @@ namespace Emby.Dlna.PlayTotry{var streamInfo = StreamParams.ParseFromUrl(e.OldMediaInfo.Url, _libraryManager, _mediaSourceManager);- if (streamInfo.Item != null)+ if (streamInfo.Item is not null){var positionTicks = GetProgressPositionTicks(streamInfo);@@ -268,7 +268,7 @@ namespace Emby.Dlna.PlayTo{var info = StreamParams.ParseFromUrl(e.MediaInfo.Url, _libraryManager, _mediaSourceManager);- if (info.Item != null)+ if (info.Item is not null){var progress = GetProgressInfo(info);@@ -299,7 +299,7 @@ namespace Emby.Dlna.PlayTovar info = StreamParams.ParseFromUrl(mediaUrl, _libraryManager, _mediaSourceManager);- if (info.Item != null)+ if (info.Item is not null){var progress = GetProgressInfo(info);@@ -441,11 +441,11 @@ namespace Emby.Dlna.PlayTo{var media = _device.CurrentMediaInfo;- if (media != null)+ if (media is not null){var info = StreamParams.ParseFromUrl(media.Url, _libraryManager, _mediaSourceManager);- if (info.Item != null && !EnableClientSideSeek(info))+ if (info.Item is not null && !EnableClientSideSeek(info)){var user = _session.UserId.Equals(default)? null@@ -760,11 +760,11 @@ namespace Emby.Dlna.PlayTo{var media = _device.CurrentMediaInfo;- if (media != null)+ if (media is not null){var info = StreamParams.ParseFromUrl(media.Url, _libraryManager, _mediaSourceManager);- if (info.Item != null)+ if (info.Item is not null){var newPosition = GetProgressPositionTicks(info) ?? 0;@@ -791,11 +791,11 @@ namespace Emby.Dlna.PlayTo{var media = _device.CurrentMediaInfo;- if (media != null)+ if (media is not null){var info = StreamParams.ParseFromUrl(media.Url, _libraryManager, _mediaSourceManager);- if (info.Item != null)+ if (info.Item is not null){var newPosition = GetProgressPositionTicks(info) ?? 0;@@ -916,7 +916,7 @@ namespace Emby.Dlna.PlayTopublic async Task<MediaSourceInfo> GetMediaSource(CancellationToken cancellationToken){- if (_mediaSource != null)+ if (_mediaSource is not null){return _mediaSource;}@@ -926,7 +926,7 @@ namespace Emby.Dlna.PlayToreturn null;}- if (_mediaSourceManager != null)+ if (_mediaSourceManager is not null){_mediaSource = await _mediaSourceManager.GetMediaSource(Item, MediaSourceId, LiveStreamId, false, cancellationToken).ConfigureAwait(false);}diff --git a/Emby.Dlna/PlayTo/PlaylistItemFactory.cs b/Emby.Dlna/PlayTo/PlaylistItemFactory.csindex 6574913032..53cd05cfda 100644--- a/Emby.Dlna/PlayTo/PlaylistItemFactory.cs+++ b/Emby.Dlna/PlayTo/PlaylistItemFactory.cs@@ -29,7 +29,7 @@ namespace Emby.Dlna.PlayTovar directPlay = profile.DirectPlayProfiles.FirstOrDefault(i => i.Type == DlnaProfileType.Photo && IsSupported(i, item));- if (directPlay != null)+ if (directPlay is not null){playlistItem.StreamInfo.PlayMethod = PlayMethod.DirectStream;playlistItem.StreamInfo.Container = Path.GetExtension(item.Path);@@ -40,7 +40,7 @@ namespace Emby.Dlna.PlayTovar transcodingProfile = profile.TranscodingProfiles.FirstOrDefault(i => i.Type == DlnaProfileType.Photo);- if (transcodingProfile != null)+ if (transcodingProfile is not null){playlistItem.StreamInfo.PlayMethod = PlayMethod.Transcode;playlistItem.StreamInfo.Container = "." + transcodingProfile.Container.TrimStart('.');diff --git a/Emby.Dlna/PlayTo/TransportCommands.cs b/Emby.Dlna/PlayTo/TransportCommands.csindex 9c3a9103be..c463727329 100644--- a/Emby.Dlna/PlayTo/TransportCommands.cs+++ b/Emby.Dlna/PlayTo/TransportCommands.cs@@ -31,7 +31,7 @@ namespace Emby.Dlna.PlayTovar stateValues = document.Descendants(UPnpNamespaces.ServiceStateTable).FirstOrDefault();- if (stateValues != null)+ if (stateValues is not null){foreach (var container in stateValues.Elements(UPnpNamespaces.Svc + "stateVariable")){@@ -77,7 +77,7 @@ namespace Emby.Dlna.PlayTovar element = container.Descendants(UPnpNamespaces.Svc + "allowedValueList").FirstOrDefault();- if (element != null)+ if (element is not null){var values = element.Descendants(UPnpNamespaces.Svc + "allowedValue");@@ -167,7 +167,7 @@ namespace Emby.Dlna.PlayTo{var state = StateVariables.FirstOrDefault(a => string.Equals(a.Name, argument.RelatedStateVariable, StringComparison.OrdinalIgnoreCase));- if (state != null)+ if (state is not null){var sendValue = state.AllowedValues.FirstOrDefault(a => string.Equals(a, commandParameter, StringComparison.OrdinalIgnoreCase)) ??(state.AllowedValues.Count > 0 ? state.AllowedValues[0] : value);diff --git a/Emby.Dlna/Service/BaseControlHandler.cs b/Emby.Dlna/Service/BaseControlHandler.csindex 9c423b3958..bff5307a49 100644--- a/Emby.Dlna/Service/BaseControlHandler.cs+++ b/Emby.Dlna/Service/BaseControlHandler.cs@@ -173,7 +173,7 @@ namespace Emby.Dlna.Service}}- if (localName != null && namespaceURI != null)+ if (localName is not null && namespaceURI is not null){return new ControlRequestInfo(localName, namespaceURI);}diff --git a/Emby.Dlna/Ssdp/DeviceDiscovery.cs b/Emby.Dlna/Ssdp/DeviceDiscovery.csindex bb58a5d1b6..8a4e5ff455 100644--- a/Emby.Dlna/Ssdp/DeviceDiscovery.cs+++ b/Emby.Dlna/Ssdp/DeviceDiscovery.cs@@ -71,7 +71,7 @@ namespace Emby.Dlna.Ssdp{lock (_syncLock){- if (_listenerCount > 0 && _deviceLocator is null && _commsServer != null)+ if (_listenerCount > 0 && _deviceLocator is null && _commsServer is not null){_deviceLocator = new SsdpDeviceLocator(_commsServer);@@ -136,7 +136,7 @@ namespace Emby.Dlna.Ssdpif (!_disposed){_disposed = true;- if (_deviceLocator != null)+ if (_deviceLocator is not null){_deviceLocator.Dispose();_deviceLocator = null;diff --git a/Emby.Naming/AudioBook/AudioBookListResolver.cs b/Emby.Naming/AudioBook/AudioBookListResolver.csindex 7a241aab2b..bdae20b6b2 100644--- a/Emby.Naming/AudioBook/AudioBookListResolver.cs+++ b/Emby.Naming/AudioBook/AudioBookListResolver.cs@@ -69,7 +69,7 @@ namespace Emby.Naming.AudioBookextras = new List<AudioBookFileInfo>();alternativeVersions = new List<AudioBookFileInfo>();- var haveChaptersOrPages = stackFiles.Any(x => x.ChapterNumber != null || x.PartNumber != null);+ var haveChaptersOrPages = stackFiles.Any(x => x.ChapterNumber is not null || x.PartNumber is not null);var groupedBy = stackFiles.GroupBy(file => new { file.ChapterNumber, file.PartNumber });var nameWithReplacedDots = nameParserResult.Name.Replace(' ', '.');diff --git a/Emby.Naming/ExternalFiles/ExternalPathParser.cs b/Emby.Naming/ExternalFiles/ExternalPathParser.csindex cfe3256e3d..9531296711 100644--- a/Emby.Naming/ExternalFiles/ExternalPathParser.cs+++ b/Emby.Naming/ExternalFiles/ExternalPathParser.cs@@ -94,12 +94,12 @@ namespace Emby.Naming.ExternalFiles// Try to translate to three character codevar culture = _localizationManager.FindLanguageInfo(currentSliceWithoutSeparator);- if (culture != null && pathInfo.Language is null)+ if (culture is not null && pathInfo.Language is null){pathInfo.Language = culture.ThreeLetterISOLanguageName;extraString = extraString.Replace(currentSlice, string.Empty, StringComparison.OrdinalIgnoreCase);}- else if (culture != null && pathInfo.Language == "hin")+ else if (culture is not null && pathInfo.Language == "hin"){// Hindi language code "hi" collides with a hearing impaired flag - use as Hindi only if no other language is setpathInfo.IsHearingImpaired = true;diff --git a/Emby.Naming/TV/EpisodePathParser.cs b/Emby.Naming/TV/EpisodePathParser.csindex 6d0597356b..d706be2802 100644--- a/Emby.Naming/TV/EpisodePathParser.cs+++ b/Emby.Naming/TV/EpisodePathParser.cs@@ -76,7 +76,7 @@ namespace Emby.Naming.TV}}- if (result != null && fillExtendedInfo)+ if (result is not null && fillExtendedInfo){FillAdditional(path, result);diff --git a/Emby.Naming/TV/SeriesPathParser.cs b/Emby.Naming/TV/SeriesPathParser.csindex 23067e6a44..94b4b5c823 100644--- a/Emby.Naming/TV/SeriesPathParser.cs+++ b/Emby.Naming/TV/SeriesPathParser.cs@@ -28,7 +28,7 @@ namespace Emby.Naming.TV}}- if (result != null)+ if (result is not null){if (!string.IsNullOrEmpty(result.SeriesName)){diff --git a/Emby.Naming/Video/ExtraRuleResolver.cs b/Emby.Naming/Video/ExtraRuleResolver.csindex 0970e509a4..21d0da3642 100644--- a/Emby.Naming/Video/ExtraRuleResolver.cs+++ b/Emby.Naming/Video/ExtraRuleResolver.cs@@ -76,7 +76,7 @@ namespace Emby.Naming.Video}}- if (result.ExtraType != null)+ if (result.ExtraType is not null){return result;}diff --git a/Emby.Naming/Video/VideoListResolver.cs b/Emby.Naming/Video/VideoListResolver.csindex 1366bdb2c3..8048320400 100644--- a/Emby.Naming/Video/VideoListResolver.cs+++ b/Emby.Naming/Video/VideoListResolver.cs@@ -109,7 +109,7 @@ namespace Emby.Naming.Videofor (var i = 0; i < videos.Count; i++){var video = videos[i];- if (video.ExtraType != null)+ if (video.ExtraType is not null){continue;}diff --git a/Emby.Notifications/NotificationManager.cs b/Emby.Notifications/NotificationManager.csindex 2b9d2c5774..a5a76b2af7 100644--- a/Emby.Notifications/NotificationManager.cs+++ b/Emby.Notifications/NotificationManager.cs@@ -113,7 +113,7 @@ namespace Emby.Notifications}}- if (options != null && !string.IsNullOrEmpty(request.NotificationType))+ if (options is not null && !string.IsNullOrEmpty(request.NotificationType)){var config = GetConfiguration();diff --git a/Emby.Photos/PhotoProvider.cs b/Emby.Photos/PhotoProvider.csindex cef82b4d66..ddf4f49898 100644--- a/Emby.Photos/PhotoProvider.cs+++ b/Emby.Photos/PhotoProvider.cs@@ -49,7 +49,7 @@ namespace Emby.Photosif (item.IsFileProtocol){var file = directoryService.GetFile(item.Path);- return file != null && file.LastWriteTimeUtc != item.DateModified;+ return file is not null && file.LastWriteTimeUtc != item.DateModified;}return false;@@ -70,20 +70,20 @@ namespace Emby.Photosif (file.GetTag(TagTypes.TiffIFD) is IFDTag tag){var structure = tag.Structure;- if (structure != null+ if (structure is not null&& structure.GetEntry(0, (ushort)IFDEntryTag.ExifIFD) is SubIFDEntry exif){var exifStructure = exif.Structure;- if (exifStructure != null)+ if (exifStructure is not null){var entry = exifStructure.GetEntry(0, (ushort)ExifEntryTag.ApertureValue) as RationalIFDEntry;- if (entry != null)+ if (entry is not null){item.Aperture = (double)entry.Value.Numerator / entry.Value.Denominator;}entry = exifStructure.GetEntry(0, (ushort)ExifEntryTag.ShutterSpeedValue) as RationalIFDEntry;- if (entry != null)+ if (entry is not null){item.ShutterSpeed = (double)entry.Value.Numerator / entry.Value.Denominator;}diff --git a/Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs b/Emby.Server.Implementations/AppBase/BaseConfigurationManager.csindex 5876c9b4c6..985a127d50 100644--- a/Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs+++ b/Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs@@ -131,7 +131,7 @@ namespace Emby.Server.Implementations.AppBase{_configuration = value;- _configurationLoaded = value != null;+ _configurationLoaded = value is not null;}}diff --git a/Emby.Server.Implementations/ApplicationHost.cs b/Emby.Server.Implementations/ApplicationHost.csindex 8e4c13def0..5db3748bf7 100644--- a/Emby.Server.Implementations/ApplicationHost.cs+++ b/Emby.Server.Implementations/ApplicationHost.cs@@ -196,7 +196,7 @@ namespace Emby.Server.Implementations/// <summary>/// Gets a value indicating whether this instance can self restart./// </summary>- public bool CanSelfRestart => _startupOptions.RestartPath != null;+ public bool CanSelfRestart => _startupOptions.RestartPath is not null;public bool CoreStartupHasCompleted { get; private set; }@@ -311,7 +311,7 @@ namespace Emby.Server.Implementationspublic X509Certificate2 Certificate { get; private set; }/// <inheritdoc/>- public bool ListenWithHttps => Certificate != null && ConfigurationManager.GetNetworkConfiguration().EnableHttps;+ public bool ListenWithHttps => Certificate is not null && ConfigurationManager.GetNetworkConfiguration().EnableHttps;public string FriendlyName =>string.IsNullOrEmpty(ConfigurationManager.Configuration.ServerName)@@ -403,7 +403,7 @@ namespace Emby.Server.Implementations// Convert to list so this isn't executed for each iterationvar parts = GetExportTypes<T>().Select(CreateInstanceSafe)- .Where(i => i != null)+ .Where(i => i is not null).Cast<T>().ToList();@@ -424,7 +424,7 @@ namespace Emby.Server.Implementations// Convert to list so this isn't executed for each iterationvar parts = GetExportTypes<T>().Select(i => defaultFunc(i))- .Where(i => i != null)+ .Where(i => i is not null).Cast<T>().ToList();diff --git a/Emby.Server.Implementations/Channels/ChannelManager.cs b/Emby.Server.Implementations/Channels/ChannelManager.csindex d7eb7e3aca..a961c09e86 100644--- a/Emby.Server.Implementations/Channels/ChannelManager.cs+++ b/Emby.Server.Implementations/Channels/ChannelManager.cs@@ -227,7 +227,7 @@ namespace Emby.Server.Implementations.Channels.ToList();}- if (user != null)+ if (user is not null){channels = channels.Where(i =>{@@ -739,7 +739,7 @@ namespace Emby.Server.Implementations.Channelsquery.GroupByPresentationUniqueKey = false;// null if came from cache- if (itemsResult != null)+ if (itemsResult is not null){var items = itemsResult.Items;var itemsLen = items.Count;@@ -761,7 +761,7 @@ namespace Emby.Server.Implementations.Channelsforeach (var deadId in deadIds){var deadItem = _libraryManager.GetItemById(deadId);- if (deadItem != null)+ if (deadItem is not null){_libraryManager.DeleteItem(deadItem,@@ -813,7 +813,7 @@ namespace Emby.Server.Implementations.Channels{await using FileStream jsonStream = AsyncFile.OpenRead(cachePath);var cachedResult = await JsonSerializer.DeserializeAsync<ChannelItemResult>(jsonStream, _jsonOptions, cancellationToken).ConfigureAwait(false);- if (cachedResult != null)+ if (cachedResult is not null){return null;}@@ -836,7 +836,7 @@ namespace Emby.Server.Implementations.Channels{await using FileStream jsonStream = AsyncFile.OpenRead(cachePath);var cachedResult = await JsonSerializer.DeserializeAsync<ChannelItemResult>(jsonStream, _jsonOptions, cancellationToken).ConfigureAwait(false);- if (cachedResult != null)+ if (cachedResult is not null){return null;}@@ -1156,7 +1156,7 @@ namespace Emby.Server.Implementations.Channels{_libraryManager.CreateItem(item, parentFolder);- if (info.People != null && info.People.Count > 0)+ if (info.People is not null && info.People.Count > 0){_libraryManager.UpdatePeople(item, info.People);}diff --git a/Emby.Server.Implementations/Collections/CollectionImageProvider.cs b/Emby.Server.Implementations/Collections/CollectionImageProvider.csindex ca84094024..c31bb4fb97 100644--- a/Emby.Server.Implementations/Collections/CollectionImageProvider.cs+++ b/Emby.Server.Implementations/Collections/CollectionImageProvider.cs@@ -59,7 +59,7 @@ namespace Emby.Server.Implementations.Collectionsvar episode = subItem as Episode;var series = episode?.Series;- if (series != null && series.HasImage(ImageType.Primary))+ if (series is not null && series.HasImage(ImageType.Primary)){return series;}@@ -71,7 +71,7 @@ namespace Emby.Server.Implementations.Collectionsvar parent = subItem.GetOwner() ?? subItem.GetParent();- if (parent != null && parent.HasImage(ImageType.Primary))+ if (parent is not null && parent.HasImage(ImageType.Primary)){if (parent is MusicAlbum){@@ -81,7 +81,7 @@ namespace Emby.Server.Implementations.Collectionsreturn null;})- .Where(i => i != null)+ .Where(i => i is not null).GroupBy(x => x!.Id) // We removed the null values.Select(x => x.First()).ToList()!; // Again... the list doesn't contain any null valuesdiff --git a/Emby.Server.Implementations/Collections/CollectionManager.cs b/Emby.Server.Implementations/Collections/CollectionManager.csindex 701c7b61dc..b53c8ca512 100644--- a/Emby.Server.Implementations/Collections/CollectionManager.cs+++ b/Emby.Server.Implementations/Collections/CollectionManager.cs@@ -81,7 +81,7 @@ namespace Emby.Server.Implementations.Collectionsinternal async Task<Folder?> EnsureLibraryFolder(string path, bool createIfNeeded){var existingFolder = FindFolders(path).FirstOrDefault();- if (existingFolder != null)+ if (existingFolder is not null){return existingFolder;}@@ -265,7 +265,7 @@ namespace Emby.Server.Implementations.Collections{var childItem = _libraryManager.GetItemById(guidId);- var child = collection.LinkedChildren.FirstOrDefault(i => (i.ItemId.HasValue && i.ItemId.Value.Equals(guidId)) || (childItem != null && string.Equals(childItem.Path, i.Path, StringComparison.OrdinalIgnoreCase)));+ var child = collection.LinkedChildren.FirstOrDefault(i => (i.ItemId.HasValue && i.ItemId.Value.Equals(guidId)) || (childItem is not null && string.Equals(childItem.Path, i.Path, StringComparison.OrdinalIgnoreCase)));if (child is null){@@ -275,7 +275,7 @@ namespace Emby.Server.Implementations.Collectionslist.Add(child);- if (childItem != null)+ if (childItem is not null){itemList.Add(childItem);}diff --git a/Emby.Server.Implementations/Data/BaseSqliteRepository.cs b/Emby.Server.Implementations/Data/BaseSqliteRepository.csindex 450688491a..ff9aa4c2a3 100644--- a/Emby.Server.Implementations/Data/BaseSqliteRepository.cs+++ b/Emby.Server.Implementations/Data/BaseSqliteRepository.cs@@ -101,7 +101,7 @@ namespace Emby.Server.Implementations.Dataprotected ManagedConnection GetConnection(bool readOnly = false){WriteLock.Wait();- if (WriteConnection != null)+ if (WriteConnection is not null){return new ManagedConnection(WriteConnection, WriteLock);}diff --git a/Emby.Server.Implementations/Data/CleanDatabaseScheduledTask.cs b/Emby.Server.Implementations/Data/CleanDatabaseScheduledTask.csindex 3de9d63719..4516b89dc2 100644--- a/Emby.Server.Implementations/Data/CleanDatabaseScheduledTask.cs+++ b/Emby.Server.Implementations/Data/CleanDatabaseScheduledTask.cs@@ -44,7 +44,7 @@ namespace Emby.Server.Implementations.Datavar item = _libraryManager.GetItemById(itemId);- if (item != null)+ if (item is not null){_logger.LogInformation("Cleaning item {0} type: {1} path: {2}", item.Name, item.GetType().Name, item.Path ?? string.Empty);diff --git a/Emby.Server.Implementations/Data/SqliteItemRepository.cs b/Emby.Server.Implementations/Data/SqliteItemRepository.csindex 36fdfc8f27..fa9d7dea24 100644--- a/Emby.Server.Implementations/Data/SqliteItemRepository.cs+++ b/Emby.Server.Implementations/Data/SqliteItemRepository.cs@@ -1146,7 +1146,7 @@ namespace Emby.Server.Implementations.Data{var image = ItemImageInfoFromValueString(part);- if (image != null)+ if (image is not null){result[position++] = image;}@@ -1825,7 +1825,7 @@ namespace Emby.Server.Implementations.Datavar hasSeries = item as IHasSeries;if (hasSeriesFields){- if (hasSeries != null)+ if (hasSeries is not null){if (reader.TryGetGuid(index, out var seriesId)){@@ -1938,7 +1938,7 @@ namespace Emby.Server.Implementations.Dataif (HasField(query, ItemFields.SeriesPresentationUniqueKey)){- if (hasSeries != null)+ if (hasSeries is not null){if (reader.TryGetString(index, out var seriesPresentationUniqueKey)){@@ -2205,7 +2205,7 @@ namespace Emby.Server.Implementations.Dataprivate bool HasProgramAttributes(InternalItemsQuery query){- if (query.ParentType != null && _programExcludeParentTypes.Contains(query.ParentType.Value))+ if (query.ParentType is not null && _programExcludeParentTypes.Contains(query.ParentType.Value)){return false;}@@ -2220,7 +2220,7 @@ namespace Emby.Server.Implementations.Dataprivate bool HasServiceName(InternalItemsQuery query){- if (query.ParentType != null && _programExcludeParentTypes.Contains(query.ParentType.Value))+ if (query.ParentType is not null && _programExcludeParentTypes.Contains(query.ParentType.Value)){return false;}@@ -2235,7 +2235,7 @@ namespace Emby.Server.Implementations.Dataprivate bool HasStartDate(InternalItemsQuery query){- if (query.ParentType != null && _programExcludeParentTypes.Contains(query.ParentType.Value))+ if (query.ParentType is not null && _programExcludeParentTypes.Contains(query.ParentType.Value)){return false;}@@ -2270,7 +2270,7 @@ namespace Emby.Server.Implementations.Dataprivate bool HasArtistFields(InternalItemsQuery query){- if (query.ParentType != null && _artistExcludeParentTypes.Contains(query.ParentType.Value))+ if (query.ParentType is not null && _artistExcludeParentTypes.Contains(query.ParentType.Value)){return false;}@@ -2392,7 +2392,7 @@ namespace Emby.Server.Implementations.Datacolumns.Add("UserDatas.rating");}- if (query.SimilarTo != null)+ if (query.SimilarTo is not null){var item = query.SimilarTo;@@ -2681,7 +2681,7 @@ namespace Emby.Server.Implementations.Dataforeach (var row in statement.ExecuteQuery()){var item = GetItem(row, query, hasProgramAttributes, hasEpisodeAttributes, hasServiceName, hasStartDate, hasTrailerTypes, hasArtistFields, hasSeriesFields);- if (item != null)+ if (item is not null){items.Add(item);}@@ -2923,7 +2923,7 @@ namespace Emby.Server.Implementations.Dataforeach (var row in statement.ExecuteQuery()){var item = GetItem(row, query, hasProgramAttributes, hasEpisodeAttributes, hasServiceName, hasStartDate, hasTrailerTypes, hasArtistFields, hasSeriesFields);- if (item != null)+ if (item is not null){list.Add(item);}@@ -2966,7 +2966,7 @@ namespace Emby.Server.Implementations.Dataprivate string GetOrderByText(InternalItemsQuery query){var orderBy = query.OrderBy;- bool hasSimilar = query.SimilarTo != null;+ bool hasSimilar = query.SimilarTo is not null;bool hasSearch = !string.IsNullOrEmpty(query.SearchTerm);if (hasSimilar || hasSearch)@@ -3396,7 +3396,7 @@ namespace Emby.Server.Implementations.Data}}- if (query.SimilarTo != null && query.MinSimilarityScore > 0)+ if (query.SimilarTo is not null && query.MinSimilarityScore > 0){whereClauses.Add("SimilarityScore > " + (query.MinSimilarityScore - 1).ToString(CultureInfo.InvariantCulture));}@@ -3683,7 +3683,7 @@ namespace Emby.Server.Implementations.Data.Append(paramName).Append("))) OR ");- if (statement != null)+ if (statement is not null){query.PersonIds[i].TryWriteBytes(idBytes);statement.TryBind(paramName, idBytes);@@ -3734,7 +3734,7 @@ namespace Emby.Server.Implementations.Dataif (!string.IsNullOrWhiteSpace(nameContains)){whereClauses.Add("(CleanName like @NameContains or OriginalTitle like @NameContains)");- if (statement != null)+ if (statement is not null){nameContains = FixUnicodeChars(nameContains);@@ -3865,7 +3865,7 @@ namespace Emby.Server.Implementations.Datavar paramName = "@ArtistIds" + index;clauses.Add("(guid in (select itemid from ItemValues where CleanValue = (select CleanName from TypedBaseItems where guid=" + paramName + ") and Type<=1))");- if (statement != null)+ if (statement is not null){statement.TryBind(paramName, artistId);}@@ -3886,7 +3886,7 @@ namespace Emby.Server.Implementations.Datavar paramName = "@ArtistIds" + index;clauses.Add("(guid in (select itemid from ItemValues where CleanValue = (select CleanName from TypedBaseItems where guid=" + paramName + ") and Type=1))");- if (statement != null)+ if (statement is not null){statement.TryBind(paramName, artistId);}@@ -3907,7 +3907,7 @@ namespace Emby.Server.Implementations.Datavar paramName = "@ArtistIds" + index;clauses.Add("((select CleanName from TypedBaseItems where guid=" + paramName + ") in (select CleanValue from ItemValues where ItemId=Guid and Type=0) AND (select CleanName from TypedBaseItems where guid=" + paramName + ") not in (select CleanValue from ItemValues where ItemId=Guid and Type=1))");- if (statement != null)+ if (statement is not null){statement.TryBind(paramName, artistId);}@@ -3928,7 +3928,7 @@ namespace Emby.Server.Implementations.Datavar paramName = "@AlbumIds" + index;clauses.Add("Album in (select Name from typedbaseitems where guid=" + paramName + ")");- if (statement != null)+ if (statement is not null){statement.TryBind(paramName, albumId);}@@ -3949,7 +3949,7 @@ namespace Emby.Server.Implementations.Datavar paramName = "@ExcludeArtistId" + index;clauses.Add("(guid not in (select itemid from ItemValues where CleanValue = (select CleanName from TypedBaseItems where guid=" + paramName + ") and Type<=1))");- if (statement != null)+ if (statement is not null){statement.TryBind(paramName, artistId);}@@ -3970,7 +3970,7 @@ namespace Emby.Server.Implementations.Datavar paramName = "@GenreId" + index;clauses.Add("(guid in (select itemid from ItemValues where CleanValue = (select CleanName from TypedBaseItems where guid=" + paramName + ") and Type=2))");- if (statement != null)+ if (statement is not null){statement.TryBind(paramName, genreId);}@@ -3989,7 +3989,7 @@ namespace Emby.Server.Implementations.Dataforeach (var item in query.Genres){clauses.Add("@Genre" + index + " in (select CleanValue from ItemValues where ItemId=Guid and Type=2)");- if (statement != null)+ if (statement is not null){statement.TryBind("@Genre" + index, GetCleanValue(item));}@@ -4008,7 +4008,7 @@ namespace Emby.Server.Implementations.Dataforeach (var item in tags){clauses.Add("@Tag" + index + " in (select CleanValue from ItemValues where ItemId=Guid and Type=4)");- if (statement != null)+ if (statement is not null){statement.TryBind("@Tag" + index, GetCleanValue(item));}@@ -4027,7 +4027,7 @@ namespace Emby.Server.Implementations.Dataforeach (var item in excludeTags){clauses.Add("@ExcludeTag" + index + " not in (select CleanValue from ItemValues where ItemId=Guid and Type=4)");- if (statement != null)+ if (statement is not null){statement.TryBind("@ExcludeTag" + index, GetCleanValue(item));}@@ -4049,7 +4049,7 @@ namespace Emby.Server.Implementations.Dataclauses.Add("(guid in (select itemid from ItemValues where CleanValue = (select CleanName from TypedBaseItems where guid=" + paramName + ") and Type=3))");- if (statement != null)+ if (statement is not null){statement.TryBind(paramName, studioId);}@@ -4068,7 +4068,7 @@ namespace Emby.Server.Implementations.Dataforeach (var item in query.OfficialRatings){clauses.Add("OfficialRating=@OfficialRating" + index);- if (statement != null)+ if (statement is not null){statement.TryBind("@OfficialRating" + index, item);}@@ -4083,7 +4083,7 @@ namespace Emby.Server.Implementations.Dataif (query.MinParentalRating.HasValue){whereClauses.Add("InheritedParentalRatingValue>=@MinParentalRating");- if (statement != null)+ if (statement is not null){statement.TryBind("@MinParentalRating", query.MinParentalRating.Value);}@@ -4092,7 +4092,7 @@ namespace Emby.Server.Implementations.Dataif (query.MaxParentalRating.HasValue){whereClauses.Add("InheritedParentalRatingValue<=@MaxParentalRating");- if (statement != null)+ if (statement is not null){statement.TryBind("@MaxParentalRating", query.MaxParentalRating.Value);}@@ -4149,7 +4149,7 @@ namespace Emby.Server.Implementations.Dataif (!string.IsNullOrWhiteSpace(query.HasNoAudioTrackWithLanguage)){whereClauses.Add("((select language from MediaStreams where MediaStreams.ItemId=A.Guid and MediaStreams.StreamType='Audio' and MediaStreams.Language=@HasNoAudioTrackWithLanguage limit 1) is null)");- if (statement != null)+ if (statement is not null){statement.TryBind("@HasNoAudioTrackWithLanguage", query.HasNoAudioTrackWithLanguage);}@@ -4158,7 +4158,7 @@ namespace Emby.Server.Implementations.Dataif (!string.IsNullOrWhiteSpace(query.HasNoInternalSubtitleTrackWithLanguage)){whereClauses.Add("((select language from MediaStreams where MediaStreams.ItemId=A.Guid and MediaStreams.StreamType='Subtitle' and MediaStreams.IsExternal=0 and MediaStreams.Language=@HasNoInternalSubtitleTrackWithLanguage limit 1) is null)");- if (statement != null)+ if (statement is not null){statement.TryBind("@HasNoInternalSubtitleTrackWithLanguage", query.HasNoInternalSubtitleTrackWithLanguage);}@@ -4167,7 +4167,7 @@ namespace Emby.Server.Implementations.Dataif (!string.IsNullOrWhiteSpace(query.HasNoExternalSubtitleTrackWithLanguage)){whereClauses.Add("((select language from MediaStreams where MediaStreams.ItemId=A.Guid and MediaStreams.StreamType='Subtitle' and MediaStreams.IsExternal=1 and MediaStreams.Language=@HasNoExternalSubtitleTrackWithLanguage limit 1) is null)");- if (statement != null)+ if (statement is not null){statement.TryBind("@HasNoExternalSubtitleTrackWithLanguage", query.HasNoExternalSubtitleTrackWithLanguage);}@@ -4176,7 +4176,7 @@ namespace Emby.Server.Implementations.Dataif (!string.IsNullOrWhiteSpace(query.HasNoSubtitleTrackWithLanguage)){whereClauses.Add("((select language from MediaStreams where MediaStreams.ItemId=A.Guid and MediaStreams.StreamType='Subtitle' and MediaStreams.Language=@HasNoSubtitleTrackWithLanguage limit 1) is null)");- if (statement != null)+ if (statement is not null){statement.TryBind("@HasNoSubtitleTrackWithLanguage", query.HasNoSubtitleTrackWithLanguage);}@@ -4229,7 +4229,7 @@ namespace Emby.Server.Implementations.Dataif (query.Years.Length == 1){whereClauses.Add("ProductionYear=@Years");- if (statement != null)+ if (statement is not null){statement.TryBind("@Years", query.Years[0].ToString(CultureInfo.InvariantCulture));}@@ -4245,7 +4245,7 @@ namespace Emby.Server.Implementations.Dataif (isVirtualItem.HasValue){whereClauses.Add("IsVirtualItem=@IsVirtualItem");- if (statement != null)+ if (statement is not null){statement.TryBind("@IsVirtualItem", isVirtualItem.Value);}@@ -4279,7 +4279,7 @@ namespace Emby.Server.Implementations.Dataif (queryMediaTypes.Length == 1){whereClauses.Add("MediaType=@MediaTypes");- if (statement != null)+ if (statement is not null){statement.TryBind("@MediaTypes", queryMediaTypes[0]);}@@ -4299,7 +4299,7 @@ namespace Emby.Server.Implementations.Dataforeach (var id in query.ItemIds){includeIds.Add("Guid = @IncludeId" + index);- if (statement != null)+ if (statement is not null){statement.TryBind("@IncludeId" + index, id);}@@ -4318,7 +4318,7 @@ namespace Emby.Server.Implementations.Dataforeach (var id in query.ExcludeItemIds){excludeIds.Add("Guid <> @ExcludeId" + index);- if (statement != null)+ if (statement is not null){statement.TryBind("@ExcludeId" + index, id);}@@ -4329,7 +4329,7 @@ namespace Emby.Server.Implementations.DatawhereClauses.Add(string.Join(" AND ", excludeIds));}- if (query.ExcludeProviderIds != null && query.ExcludeProviderIds.Count > 0)+ if (query.ExcludeProviderIds is not null && query.ExcludeProviderIds.Count > 0){var excludeIds = new List<string>();@@ -4343,7 +4343,7 @@ namespace Emby.Server.Implementations.Datavar paramName = "@ExcludeProviderId" + index;excludeIds.Add("(ProviderIds is null or ProviderIds not like " + paramName + ")");- if (statement != null)+ if (statement is not null){statement.TryBind(paramName, "%" + pair.Key + "=" + pair.Value + "%");}@@ -4359,7 +4359,7 @@ namespace Emby.Server.Implementations.Data}}- if (query.HasAnyProviderId != null && query.HasAnyProviderId.Count > 0)+ if (query.HasAnyProviderId is not null && query.HasAnyProviderId.Count > 0){var hasProviderIds = new List<string>();@@ -4386,7 +4386,7 @@ namespace Emby.Server.Implementations.DatahasProviderIds.Add("ProviderIds like " + paramName);// this replaces the placeholder with a value, here: %key=val%- if (statement != null)+ if (statement is not null){statement.TryBind(paramName, "%" + pair.Key + "=" + pair.Value + "%");}@@ -4468,7 +4468,7 @@ namespace Emby.Server.Implementations.Data{whereClauses.Add("Guid in (select itemId from AncestorIds where AncestorId=@AncestorId)");- if (statement != null)+ if (statement is not null){statement.TryBind("@AncestorId", query.AncestorIds[0]);}@@ -4484,7 +4484,7 @@ namespace Emby.Server.Implementations.Data{var inClause = "select guid from TypedBaseItems where PresentationUniqueKey=@AncestorWithPresentationUniqueKey";whereClauses.Add(string.Format(CultureInfo.InvariantCulture, "Guid in (select itemId from AncestorIds where AncestorId in ({0}))", inClause));- if (statement != null)+ if (statement is not null){statement.TryBind("@AncestorWithPresentationUniqueKey", query.AncestorWithPresentationUniqueKey);}@@ -4494,7 +4494,7 @@ namespace Emby.Server.Implementations.Data{whereClauses.Add("SeriesPresentationUniqueKey=@SeriesPresentationUniqueKey");- if (statement != null)+ if (statement is not null){statement.TryBind("@SeriesPresentationUniqueKey", query.SeriesPresentationUniqueKey);}@@ -4503,7 +4503,7 @@ namespace Emby.Server.Implementations.Dataif (query.BlockUnratedItems.Length == 1){whereClauses.Add("(InheritedParentalRatingValue > 0 or UnratedType <> @UnratedType)");- if (statement != null)+ if (statement is not null){statement.TryBind("@UnratedType", query.BlockUnratedItems[0].ToString());}@@ -4916,7 +4916,7 @@ where AncestorIdText not null and ItemValues.Value not null and ItemValues.Type{var whereClauses = new List<string>();- if (query.User != null && query.IsFavorite.HasValue)+ if (query.User is not null && query.IsFavorite.HasValue){whereClauses.Add(@"p.Name IN (SELECT Name FROM TypedBaseItems WHERE UserDataKey IN (@@ -5293,7 +5293,7 @@ AND Type = @InternalPersonType)");.Append(" group by PresentationUniqueKey");if (query.OrderBy.Count != 0- || query.SimilarTo != null+ || query.SimilarTo is not null|| !string.IsNullOrEmpty(query.SearchTerm)){stringBuilder.Append(GetOrderByText(query));@@ -5361,7 +5361,7 @@ AND Type = @InternalPersonType)");statement.TryBind("@UserId", query.User.InternalId);}- if (typeSubQuery != null)+ if (typeSubQuery is not null){GetWhereClauses(typeSubQuery, null);}@@ -5382,7 +5382,7 @@ AND Type = @InternalPersonType)");foreach (var row in statement.ExecuteQuery()){var item = GetItem(row, query, hasProgramAttributes, hasEpisodeAttributes, hasServiceName, hasStartDate, hasTrailerTypes, hasArtistFields, hasSeriesFields);- if (item != null)+ if (item is not null){var countStartColumn = columns.Count - 1;@@ -5402,7 +5402,7 @@ AND Type = @InternalPersonType)");statement.TryBind("@UserId", query.User.InternalId);}- if (typeSubQuery != null)+ if (typeSubQuery is not null){GetWhereClauses(typeSubQuery, null);}diff --git a/Emby.Server.Implementations/Data/TypeMapper.cs b/Emby.Server.Implementations/Data/TypeMapper.csindex 064664e1fe..4202915ec9 100644--- a/Emby.Server.Implementations/Data/TypeMapper.cs+++ b/Emby.Server.Implementations/Data/TypeMapper.cs@@ -30,7 +30,7 @@ namespace Emby.Server.Implementations.Datareturn _typeMap.GetOrAdd(typeName, k => AppDomain.CurrentDomain.GetAssemblies().Select(a => a.GetType(k))- .FirstOrDefault(t => t != null));+ .FirstOrDefault(t => t is not null));}}}diff --git a/Emby.Server.Implementations/Dto/DtoService.cs b/Emby.Server.Implementations/Dto/DtoService.csindex e0e3366b4f..0c6c31982e 100644--- a/Emby.Server.Implementations/Dto/DtoService.cs+++ b/Emby.Server.Implementations/Dto/DtoService.cs@@ -213,7 +213,7 @@ namespace Emby.Server.Implementations.Dtodto.DisplayPreferencesId = item.DisplayPreferencesId.ToString("N", CultureInfo.InvariantCulture);}- if (user != null)+ if (user is not null){AttachUserSpecificInfo(dto, item, user, options);}@@ -254,7 +254,7 @@ namespace Emby.Server.Implementations.Dtovar liveTvManager = LivetvManager;var activeRecording = liveTvManager.GetActiveRecordingInfo(item.Path);- if (activeRecording != null)+ if (activeRecording is not null){dto.Type = BaseItemKind.Recording;dto.CanDownload = false;@@ -317,7 +317,7 @@ namespace Emby.Server.Implementations.Dto{var dto = GetBaseItemDtoInternal(item, options, user);- if (taggedItems != null && options.ContainsField(ItemFields.ItemCounts))+ if (taggedItems is not null && options.ContainsField(ItemFields.ItemCounts)){SetItemByNameInfo(item, dto, taggedItems);}@@ -417,7 +417,7 @@ namespace Emby.Server.Implementations.Dtoif (options.ContainsField(ItemFields.BasicSyncInfo)){- var userCanSync = user != null && user.HasPermission(PermissionKind.EnableContentDownloading);+ var userCanSync = user is not null && user.HasPermission(PermissionKind.EnableContentDownloading);if (userCanSync && item.SupportsExternalTransfer){dto.SupportsSync = true;@@ -460,7 +460,7 @@ namespace Emby.Server.Implementations.Dtovar album = item.AlbumEntity;- if (album != null)+ if (album is not null){dto.Album = album.Name;dto.AlbumId = album.Id;@@ -491,7 +491,7 @@ namespace Emby.Server.Implementations.Dto{return images.Select(p => GetImageCacheTag(item, p))- .Where(i => i != null)+ .Where(i => i is not null).ToArray();}@@ -570,7 +570,7 @@ namespace Emby.Server.Implementations.Dto_logger.LogError(ex, "Error getting person {Name}", c);return null;}- }).Where(i => i != null)+ }).Where(i => i is not null).Where(i => user is null ?true :i.IsVisible(user))@@ -593,13 +593,13 @@ namespace Emby.Server.Implementations.Dto{baseItemPerson.PrimaryImageTag = GetTagAndFillBlurhash(dto, entity, ImageType.Primary);baseItemPerson.Id = entity.Id;- if (dto.ImageBlurHashes != null)+ if (dto.ImageBlurHashes is not null){// Only add BlurHash for the person's image.baseItemPerson.ImageBlurHashes = new Dictionary<ImageType, Dictionary<string, string>>();foreach (var (imageType, blurHash) in dto.ImageBlurHashes){- if (blurHash != null)+ if (blurHash is not null){baseItemPerson.ImageBlurHashes[imageType] = new Dictionary<string, string>();foreach (var (imageId, blurHashValue) in blurHash)@@ -662,7 +662,7 @@ namespace Emby.Server.Implementations.Dtoprivate string GetTagAndFillBlurhash(BaseItemDto dto, BaseItem item, ImageType imageType, int imageIndex = 0){var image = item.GetImageInfo(imageType, imageIndex);- if (image != null)+ if (image is not null){return GetTagAndFillBlurhash(dto, item, image);}@@ -782,7 +782,7 @@ namespace Emby.Server.Implementations.Dto{var tag = GetTagAndFillBlurhash(dto, item, image);- if (tag != null)+ if (tag is not null){dto.ImageTags[image.Type] = tag;}@@ -917,7 +917,7 @@ namespace Emby.Server.Implementations.Dtovar albumParent = audio.AlbumEntity;- if (albumParent != null)+ if (albumParent is not null){dto.AlbumId = albumParent.Id;dto.AlbumPrimaryImageTag = GetTagAndFillBlurhash(dto, albumParent, ImageType.Primary);@@ -967,7 +967,7 @@ namespace Emby.Server.Implementations.Dto{EnableImages = false});- if (artist != null)+ if (artist is not null){return new NameGuidPair{@@ -977,7 +977,7 @@ namespace Emby.Server.Implementations.Dto}return null;- }).Where(i => i != null).ToArray();+ }).Where(i => i is not null).ToArray();}if (item is IHasAlbumArtist hasAlbumArtist)@@ -1016,7 +1016,7 @@ namespace Emby.Server.Implementations.Dto{EnableImages = false});- if (artist != null)+ if (artist is not null){return new NameGuidPair{@@ -1026,7 +1026,7 @@ namespace Emby.Server.Implementations.Dto}return null;- }).Where(i => i != null).ToArray();+ }).Where(i => i is not null).ToArray();}// Add video info@@ -1073,7 +1073,7 @@ namespace Emby.Server.Implementations.Dto{MediaStream[] mediaStreams;- if (dto.MediaSources != null && dto.MediaSources.Length > 0)+ if (dto.MediaSources is not null && dto.MediaSources.Length > 0){if (item.SourceType == SourceType.Channel){@@ -1140,7 +1140,7 @@ namespace Emby.Server.Implementations.Dto// if (options.ContainsField(ItemFields.SeriesPrimaryImage)){episodeSeries ??= episode.Series;- if (episodeSeries != null)+ if (episodeSeries is not null){dto.SeriesPrimaryImageTag = GetTagAndFillBlurhash(dto, episodeSeries, ImageType.Primary);if (dto.ImageTags is null || !dto.ImageTags.ContainsKey(ImageType.Primary))@@ -1153,7 +1153,7 @@ namespace Emby.Server.Implementations.Dtoif (options.ContainsField(ItemFields.SeriesStudio)){episodeSeries ??= episode.Series;- if (episodeSeries != null)+ if (episodeSeries is not null){dto.SeriesStudio = episodeSeries.Studios.FirstOrDefault();}@@ -1179,7 +1179,7 @@ namespace Emby.Server.Implementations.Dtoif (options.ContainsField(ItemFields.SeriesStudio)){series ??= season.Series;- if (series != null)+ if (series is not null){dto.SeriesStudio = series.Studios.FirstOrDefault();}@@ -1190,7 +1190,7 @@ namespace Emby.Server.Implementations.Dto// if (options.ContainsField(ItemFields.SeriesPrimaryImage)){series ??= season.Series;- if (series != null)+ if (series is not null){dto.SeriesPrimaryImageTag = GetTagAndFillBlurhash(dto, series, ImageType.Primary);if (dto.ImageTags is null || !dto.ImageTags.ContainsKey(ImageType.Primary))@@ -1256,7 +1256,7 @@ namespace Emby.Server.Implementations.Dtoif (item.SourceType == SourceType.Channel){var channel = _libraryManager.GetItemById(item.ChannelId);- if (channel != null)+ if (channel is not null){dto.ChannelName = channel.Name;}@@ -1268,7 +1268,7 @@ namespace Emby.Server.Implementations.Dtoif (currentItem is MusicAlbum musicAlbum){var artist = musicAlbum.GetMusicArtist(new DtoOptions(false));- if (artist != null)+ if (artist is not null){return artist;}@@ -1309,9 +1309,9 @@ namespace Emby.Server.Implementations.Dtovar imageTags = dto.ImageTags;- while ((!(imageTags != null && imageTags.ContainsKey(ImageType.Logo)) && logoLimit > 0)- || (!(imageTags != null && imageTags.ContainsKey(ImageType.Art)) && artLimit > 0)- || (!(imageTags != null && imageTags.ContainsKey(ImageType.Thumb)) && thumbLimit > 0)+ while ((!(imageTags is not null && imageTags.ContainsKey(ImageType.Logo)) && logoLimit > 0)+ || (!(imageTags is not null && imageTags.ContainsKey(ImageType.Art)) && artLimit > 0)+ || (!(imageTags is not null && imageTags.ContainsKey(ImageType.Thumb)) && thumbLimit > 0)|| parent is Series){parent ??= isFirst ? GetImageDisplayParent(item, item) ?? owner : parent;@@ -1322,40 +1322,40 @@ namespace Emby.Server.Implementations.Dtovar allImages = parent.ImageInfos;- if (logoLimit > 0 && !(imageTags != null && imageTags.ContainsKey(ImageType.Logo)) && dto.ParentLogoItemId is null)+ if (logoLimit > 0 && !(imageTags is not null && imageTags.ContainsKey(ImageType.Logo)) && dto.ParentLogoItemId is null){var image = allImages.FirstOrDefault(i => i.Type == ImageType.Logo);- if (image != null)+ if (image is not null){dto.ParentLogoItemId = parent.Id;dto.ParentLogoImageTag = GetTagAndFillBlurhash(dto, parent, image);}}- if (artLimit > 0 && !(imageTags != null && imageTags.ContainsKey(ImageType.Art)) && dto.ParentArtItemId is null)+ if (artLimit > 0 && !(imageTags is not null && imageTags.ContainsKey(ImageType.Art)) && dto.ParentArtItemId is null){var image = allImages.FirstOrDefault(i => i.Type == ImageType.Art);- if (image != null)+ if (image is not null){dto.ParentArtItemId = parent.Id;dto.ParentArtImageTag = GetTagAndFillBlurhash(dto, parent, image);}}- if (thumbLimit > 0 && !(imageTags != null && imageTags.ContainsKey(ImageType.Thumb)) && (dto.ParentThumbItemId is null || parent is Series) && parent is not ICollectionFolder && parent is not UserView)+ if (thumbLimit > 0 && !(imageTags is not null && imageTags.ContainsKey(ImageType.Thumb)) && (dto.ParentThumbItemId is null || parent is Series) && parent is not ICollectionFolder && parent is not UserView){var image = allImages.FirstOrDefault(i => i.Type == ImageType.Thumb);- if (image != null)+ if (image is not null){dto.ParentThumbItemId = parent.Id;dto.ParentThumbImageTag = GetTagAndFillBlurhash(dto, parent, image);}}- if (backdropLimit > 0 && !((dto.BackdropImageTags != null && dto.BackdropImageTags.Length > 0) || (dto.ParentBackdropImageTags != null && dto.ParentBackdropImageTags.Length > 0)))+ if (backdropLimit > 0 && !((dto.BackdropImageTags is not null && dto.BackdropImageTags.Length > 0) || (dto.ParentBackdropImageTags is not null && dto.ParentBackdropImageTags.Length > 0))){var images = allImages.Where(i => i.Type == ImageType.Backdrop).Take(backdropLimit).ToList();diff --git a/Emby.Server.Implementations/EntryPoints/LibraryChangedNotifier.cs b/Emby.Server.Implementations/EntryPoints/LibraryChangedNotifier.csindex fb6f52332f..25a7029c90 100644--- a/Emby.Server.Implementations/EntryPoints/LibraryChangedNotifier.cs+++ b/Emby.Server.Implementations/EntryPoints/LibraryChangedNotifier.cs@@ -299,7 +299,7 @@ namespace Emby.Server.Implementations.EntryPointsSendChangeNotifications(_itemsAdded.ToList(), itemsUpdated, _itemsRemoved.ToList(), foldersAddedTo, foldersRemovedFrom, CancellationToken.None).GetAwaiter().GetResult();- if (LibraryUpdateTimer != null)+ if (LibraryUpdateTimer is not null){LibraryUpdateTimer.Dispose();LibraryUpdateTimer = null;@@ -475,7 +475,7 @@ namespace Emby.Server.Implementations.EntryPoints{if (dispose){- if (LibraryUpdateTimer != null)+ if (LibraryUpdateTimer is not null){LibraryUpdateTimer.Dispose();LibraryUpdateTimer = null;diff --git a/Emby.Server.Implementations/EntryPoints/UserDataChangeNotifier.cs b/Emby.Server.Implementations/EntryPoints/UserDataChangeNotifier.csindex ce81f9e42f..42c8f24a14 100644--- a/Emby.Server.Implementations/EntryPoints/UserDataChangeNotifier.cs+++ b/Emby.Server.Implementations/EntryPoints/UserDataChangeNotifier.cs@@ -75,11 +75,11 @@ namespace Emby.Server.Implementations.EntryPointsvar baseItem = e.Item;// Go up one level for indicators- if (baseItem != null)+ if (baseItem is not null){var parent = baseItem.GetOwner() ?? baseItem.GetParent();- if (parent != null)+ if (parent is not null){keys.Add(parent);}@@ -97,7 +97,7 @@ namespace Emby.Server.Implementations.EntryPointsSendNotifications(changes, CancellationToken.None).GetAwaiter().GetResult();- if (_updateTimer != null)+ if (_updateTimer is not null){_updateTimer.Dispose();_updateTimer = null;@@ -145,7 +145,7 @@ namespace Emby.Server.Implementations.EntryPointspublic void Dispose(){- if (_updateTimer != null)+ if (_updateTimer is not null){_updateTimer.Dispose();_updateTimer = null;diff --git a/Emby.Server.Implementations/IO/FileRefresher.cs b/Emby.Server.Implementations/IO/FileRefresher.csindex 6337952c12..534ca7b6c3 100644--- a/Emby.Server.Implementations/IO/FileRefresher.cs+++ b/Emby.Server.Implementations/IO/FileRefresher.cs@@ -138,7 +138,7 @@ namespace Emby.Server.Implementations.IOIEnumerable<BaseItem> itemsToRefresh = paths.Distinct(StringComparer.OrdinalIgnoreCase).Select(GetAffectedBaseItem)- .Where(item => item != null)+ .Where(item => item is not null).GroupBy(x => x!.Id) // Removed null values in the previous .Where().Select(x => x.First())!;@@ -185,7 +185,7 @@ namespace Emby.Server.Implementations.IOpath = System.IO.Path.GetDirectoryName(path) ?? string.Empty;}- if (item != null)+ if (item is not null){// If the item has been deleted find the first valid parent that still existswhile (!Directory.Exists(item.Path) && !File.Exists(item.Path))@@ -206,7 +206,7 @@ namespace Emby.Server.Implementations.IO{lock (_timerLock){- if (_timer != null)+ if (_timer is not null){_timer.Dispose();_timer = null;diff --git a/Emby.Server.Implementations/IO/LibraryMonitor.cs b/Emby.Server.Implementations/IO/LibraryMonitor.csindex c1422c43da..e883467715 100644--- a/Emby.Server.Implementations/IO/LibraryMonitor.cs+++ b/Emby.Server.Implementations/IO/LibraryMonitor.cs@@ -115,7 +115,7 @@ namespace Emby.Server.Implementations.IOvar options = _libraryManager.GetLibraryOptions(item);- if (options != null)+ if (options is not null){return options.EnableRealtimeMonitor;}diff --git a/Emby.Server.Implementations/IO/ManagedFileSystem.cs b/Emby.Server.Implementations/IO/ManagedFileSystem.csindex 120b1812a7..cdb301094d 100644--- a/Emby.Server.Implementations/IO/ManagedFileSystem.cs+++ b/Emby.Server.Implementations/IO/ManagedFileSystem.cs@@ -149,7 +149,7 @@ namespace Emby.Server.Implementations.IOvar extension = Path.GetExtension(shortcutPath);var handler = _shortcutHandlers.Find(i => string.Equals(extension, i.Extension, StringComparison.OrdinalIgnoreCase));- if (handler != null)+ if (handler is not null){handler.Create(shortcutPath, target);}@@ -621,14 +621,14 @@ namespace Emby.Server.Implementations.IO// On linux and osx the search pattern is case sensitive// If we're OK with case-sensitivity, and we're only filtering for one extension, then use the native method- if ((enableCaseSensitiveExtensions || _isEnvironmentCaseInsensitive) && extensions != null && extensions.Count == 1)+ if ((enableCaseSensitiveExtensions || _isEnvironmentCaseInsensitive) && extensions is not null && extensions.Count == 1){return ToMetadata(new DirectoryInfo(path).EnumerateFiles("*" + extensions[0], enumerationOptions));}var files = new DirectoryInfo(path).EnumerateFiles("*", enumerationOptions);- if (extensions != null && extensions.Count > 0)+ if (extensions is not null && extensions.Count > 0){files = files.Where(i =>{@@ -678,14 +678,14 @@ namespace Emby.Server.Implementations.IO// On linux and osx the search pattern is case sensitive// If we're OK with case-sensitivity, and we're only filtering for one extension, then use the native method- if ((enableCaseSensitiveExtensions || _isEnvironmentCaseInsensitive) && extensions != null && extensions.Length == 1)+ if ((enableCaseSensitiveExtensions || _isEnvironmentCaseInsensitive) && extensions is not null && extensions.Length == 1){return Directory.EnumerateFiles(path, "*" + extensions[0], enumerationOptions);}var files = Directory.EnumerateFiles(path, "*", enumerationOptions);- if (extensions != null && extensions.Length > 0)+ if (extensions is not null && extensions.Length > 0){files = files.Where(i =>{diff --git a/Emby.Server.Implementations/IO/StreamHelper.cs b/Emby.Server.Implementations/IO/StreamHelper.csindex f55c16d6d7..6eaf22ce48 100644--- a/Emby.Server.Implementations/IO/StreamHelper.cs+++ b/Emby.Server.Implementations/IO/StreamHelper.cs@@ -23,7 +23,7 @@ namespace Emby.Server.Implementations.IOawait destination.WriteAsync(buffer.AsMemory(0, read), cancellationToken).ConfigureAwait(false);- if (onStarted != null)+ if (onStarted is not null){onStarted();onStarted = null;diff --git a/Emby.Server.Implementations/Images/BaseDynamicImageProvider.cs b/Emby.Server.Implementations/Images/BaseDynamicImageProvider.csindex 57c2f1a5e5..0a3d740ccf 100644--- a/Emby.Server.Implementations/Images/BaseDynamicImageProvider.cs+++ b/Emby.Server.Implementations/Images/BaseDynamicImageProvider.cs@@ -81,7 +81,7 @@ namespace Emby.Server.Implementations.Images{var image = item.GetImageInfo(imageType, 0);- if (image != null)+ if (image is not null){if (!image.IsLocalFile){@@ -143,20 +143,20 @@ namespace Emby.Server.Implementations.Imagesif (useBackdrop){var backdrop = i.GetImageInfo(ImageType.Backdrop, 0);- if (backdrop != null && backdrop.IsLocalFile)+ if (backdrop is not null && backdrop.IsLocalFile){return backdrop.Path;}}var image = i.GetImageInfo(ImageType.Primary, 0);- if (image != null && image.IsLocalFile)+ if (image is not null && image.IsLocalFile){return image.Path;}image = i.GetImageInfo(ImageType.Thumb, 0);- if (image != null && image.IsLocalFile)+ if (image is not null && image.IsLocalFile){return image.Path;}@@ -268,7 +268,7 @@ namespace Emby.Server.Implementations.Images{var image = item.GetImageInfo(type, 0);- if (image != null)+ if (image is not null){if (!image.IsLocalFile){diff --git a/Emby.Server.Implementations/Images/DynamicImageProvider.cs b/Emby.Server.Implementations/Images/DynamicImageProvider.csindex 0faa0f8faf..82690f8a95 100644--- a/Emby.Server.Implementations/Images/DynamicImageProvider.cs+++ b/Emby.Server.Implementations/Images/DynamicImageProvider.cs@@ -52,7 +52,7 @@ namespace Emby.Server.Implementations.Imagesif (i is Episode episode){var series = episode.Series;- if (series != null)+ if (series is not null){return series;}@@ -63,7 +63,7 @@ namespace Emby.Server.Implementations.Imagesif (i is Season season){var series = season.Series;- if (series != null)+ if (series is not null){return series;}@@ -74,7 +74,7 @@ namespace Emby.Server.Implementations.Imagesif (i is Audio audio){var album = audio.AlbumEntity;- if (album != null && album.HasImage(ImageType.Primary))+ if (album is not null && album.HasImage(ImageType.Primary)){return album;}diff --git a/Emby.Server.Implementations/Images/PlaylistImageProvider.cs b/Emby.Server.Implementations/Images/PlaylistImageProvider.csindex b8f0f0d65c..5801512873 100644--- a/Emby.Server.Implementations/Images/PlaylistImageProvider.cs+++ b/Emby.Server.Implementations/Images/PlaylistImageProvider.cs@@ -34,7 +34,7 @@ namespace Emby.Server.Implementations.Imagesif (subItem is Episode episode){var series = episode.Series;- if (series != null && series.HasImage(ImageType.Primary))+ if (series is not null && series.HasImage(ImageType.Primary)){return series;}@@ -47,7 +47,7 @@ namespace Emby.Server.Implementations.Imagesvar parent = subItem.GetOwner() ?? subItem.GetParent();- if (parent != null && parent.HasImage(ImageType.Primary))+ if (parent is not null && parent.HasImage(ImageType.Primary)){if (parent is MusicAlbum){@@ -57,7 +57,7 @@ namespace Emby.Server.Implementations.Imagesreturn null;})- .Where(i => i != null)+ .Where(i => i is not null).GroupBy(x => x.Id).Select(x => x.First()).ToList();diff --git a/Emby.Server.Implementations/Library/CoreResolutionIgnoreRule.cs b/Emby.Server.Implementations/Library/CoreResolutionIgnoreRule.csindex e558fbe27b..665d70a418 100644--- a/Emby.Server.Implementations/Library/CoreResolutionIgnoreRule.cs+++ b/Emby.Server.Implementations/Library/CoreResolutionIgnoreRule.cs@@ -52,7 +52,7 @@ namespace Emby.Server.Implementations.Libraryif (fileInfo.IsDirectory){- if (parent != null)+ if (parent is not null){// Ignore extras folders but allow it at the collection levelif (_namingOptions.AllExtrasTypesFolderNames.ContainsKey(filename)@@ -65,7 +65,7 @@ namespace Emby.Server.Implementations.Library}else{- if (parent != null)+ if (parent is not null){// Don't resolve these into audio filesif (Path.GetFileNameWithoutExtension(filename.AsSpan()).Equals(BaseItem.ThemeSongFileName, StringComparison.Ordinal)diff --git a/Emby.Server.Implementations/Library/LibraryManager.cs b/Emby.Server.Implementations/Library/LibraryManager.csindex e8f6d2d236..9ee8a630d2 100644--- a/Emby.Server.Implementations/Library/LibraryManager.cs+++ b/Emby.Server.Implementations/Library/LibraryManager.cs@@ -465,9 +465,9 @@ namespace Emby.Server.Implementations.Libraryprivate BaseItem ResolveItem(ItemResolveArgs args, IItemResolver[] resolvers){var item = (resolvers ?? EntityResolvers).Select(r => Resolve(args, r))- .FirstOrDefault(i => i != null);+ .FirstOrDefault(i => i is not null);- if (item != null)+ if (item is not null){ResolverHelper.SetInitialItemValues(item, args, _fileSystem, this);}@@ -536,7 +536,7 @@ namespace Emby.Server.Implementations.Libraryvar fullPath = fileInfo.FullName;- if (string.IsNullOrEmpty(collectionType) && parent != null)+ if (string.IsNullOrEmpty(collectionType) && parent is not null){collectionType = GetContentTypeOverride(fullPath, true);}@@ -572,7 +572,7 @@ namespace Emby.Server.Implementations.Library}catch (Exception ex){- if (parent != null && parent.IsPhysicalRoot)+ if (parent is not null && parent.IsPhysicalRoot){_logger.LogError(ex, "Error in GetFilteredFileSystemEntries isPhysicalRoot: {0} IsVf: {1}", isPhysicalRoot, isVf);@@ -654,7 +654,7 @@ namespace Emby.Server.Implementations.Library{var fileList = files.Where(i => !IgnoreFile(i, parent)).ToList();- if (parent != null)+ if (parent is not null){var multiItemResolvers = resolvers is null ? MultiItemResolvers : resolvers.OfType<IMultiItemResolver>().ToArray();@@ -697,7 +697,7 @@ namespace Emby.Server.Implementations.Library_logger.LogError(ex, "Error resolving path {Path}", file.FullName);}- if (result != null)+ if (result is not null){yield return result;}@@ -750,7 +750,7 @@ namespace Emby.Server.Implementations.Libraryvar dbItem = GetItemById(folder.Id) as BasePluginFolder;- if (dbItem != null && string.Equals(dbItem.Path, folder.Path, StringComparison.OrdinalIgnoreCase))+ if (dbItem is not null && string.Equals(dbItem.Path, folder.Path, StringComparison.OrdinalIgnoreCase)){folder = dbItem;}@@ -952,7 +952,7 @@ namespace Emby.Server.Implementations.Library.Cast<T>().FirstOrDefault();- if (existing != null)+ if (existing is not null){return existing;}@@ -1181,7 +1181,7 @@ namespace Emby.Server.Implementations.Libraryreturn null;}})- .Where(i => i != null)+ .Where(i => i is not null).OrderBy(i => i).ToArray(),@@ -1190,17 +1190,17 @@ namespace Emby.Server.Implementations.Libraryvar libraryFolder = allCollectionFolders.FirstOrDefault(i => string.Equals(i.Path, dir, StringComparison.OrdinalIgnoreCase));- if (libraryFolder != null && libraryFolder.HasImage(ImageType.Primary))+ if (libraryFolder is not null && libraryFolder.HasImage(ImageType.Primary)){info.PrimaryImageItemId = libraryFolder.Id.ToString("N", CultureInfo.InvariantCulture);}- if (libraryFolder != null)+ if (libraryFolder is not null){info.ItemId = libraryFolder.Id.ToString("N", CultureInfo.InvariantCulture);info.LibraryOptions = GetLibraryOptions(libraryFolder);- if (refreshQueue != null)+ if (refreshQueue is not null){info.RefreshProgress = libraryFolder.GetRefreshProgress();@@ -1245,7 +1245,7 @@ namespace Emby.Server.Implementations.Libraryitem = RetrieveItem(id);- if (item != null)+ if (item is not null){RegisterItem(item);}@@ -1258,13 +1258,13 @@ namespace Emby.Server.Implementations.Libraryif (query.Recursive && !query.ParentId.Equals(default)){var parent = GetItemById(query.ParentId);- if (parent != null)+ if (parent is not null){SetTopParentIdsOrAncestors(query, new List<BaseItem> { parent });}}- if (query.User != null)+ if (query.User is not null){AddUserToQuery(query, query.User, allowExternalContent);}@@ -1282,13 +1282,13 @@ namespace Emby.Server.Implementations.Libraryif (query.Recursive && !query.ParentId.Equals(default)){var parent = GetItemById(query.ParentId);- if (parent != null)+ if (parent is not null){SetTopParentIdsOrAncestors(query, new List<BaseItem> { parent });}}- if (query.User != null)+ if (query.User is not null){AddUserToQuery(query, query.User);}@@ -1302,7 +1302,7 @@ namespace Emby.Server.Implementations.Libraryif (query.AncestorIds.Length == 0 && query.TopParentIds.Length == 0){- if (query.User != null)+ if (query.User is not null){AddUserToQuery(query, query.User);}@@ -1313,7 +1313,7 @@ namespace Emby.Server.Implementations.Librarypublic QueryResult<BaseItem> QueryItems(InternalItemsQuery query){- if (query.User != null)+ if (query.User is not null){AddUserToQuery(query, query.User);}@@ -1331,7 +1331,7 @@ namespace Emby.Server.Implementations.Librarypublic List<Guid> GetItemIds(InternalItemsQuery query){- if (query.User != null)+ if (query.User is not null){AddUserToQuery(query, query.User);}@@ -1341,7 +1341,7 @@ namespace Emby.Server.Implementations.Librarypublic QueryResult<(BaseItem Item, ItemCounts ItemCounts)> GetStudios(InternalItemsQuery query){- if (query.User != null)+ if (query.User is not null){AddUserToQuery(query, query.User);}@@ -1352,7 +1352,7 @@ namespace Emby.Server.Implementations.Librarypublic QueryResult<(BaseItem Item, ItemCounts ItemCounts)> GetGenres(InternalItemsQuery query){- if (query.User != null)+ if (query.User is not null){AddUserToQuery(query, query.User);}@@ -1363,7 +1363,7 @@ namespace Emby.Server.Implementations.Librarypublic QueryResult<(BaseItem Item, ItemCounts ItemCounts)> GetMusicGenres(InternalItemsQuery query){- if (query.User != null)+ if (query.User is not null){AddUserToQuery(query, query.User);}@@ -1374,7 +1374,7 @@ namespace Emby.Server.Implementations.Librarypublic QueryResult<(BaseItem Item, ItemCounts ItemCounts)> GetAllArtists(InternalItemsQuery query){- if (query.User != null)+ if (query.User is not null){AddUserToQuery(query, query.User);}@@ -1385,7 +1385,7 @@ namespace Emby.Server.Implementations.Librarypublic QueryResult<(BaseItem Item, ItemCounts ItemCounts)> GetArtists(InternalItemsQuery query){- if (query.User != null)+ if (query.User is not null){AddUserToQuery(query, query.User);}@@ -1426,7 +1426,7 @@ namespace Emby.Server.Implementations.Librarypublic QueryResult<(BaseItem Item, ItemCounts ItemCounts)> GetAlbumArtists(InternalItemsQuery query){- if (query.User != null)+ if (query.User is not null){AddUserToQuery(query, query.User);}@@ -1440,13 +1440,13 @@ namespace Emby.Server.Implementations.Libraryif (query.Recursive && !query.ParentId.Equals(default)){var parent = GetItemById(query.ParentId);- if (parent != null)+ if (parent is not null){SetTopParentIdsOrAncestors(query, new List<BaseItem> { parent });}}- if (query.User != null)+ if (query.User is not null){AddUserToQuery(query, query.User);}@@ -1524,7 +1524,7 @@ namespace Emby.Server.Implementations.Libraryif (!view.DisplayParentId.Equals(default)){var displayParent = GetItemById(view.DisplayParentId);- if (displayParent != null)+ if (displayParent is not null){return GetTopParentIdsForQuery(displayParent, user);}@@ -1535,7 +1535,7 @@ namespace Emby.Server.Implementations.Libraryif (!view.ParentId.Equals(default)){var displayParent = GetItemById(view.ParentId);- if (displayParent != null)+ if (displayParent is not null){return GetTopParentIdsForQuery(displayParent, user);}@@ -1544,7 +1544,7 @@ namespace Emby.Server.Implementations.Library}// Handle grouping- if (user != null && !string.IsNullOrEmpty(view.ViewType) && UserView.IsEligibleForGrouping(view.ViewType)+ if (user is not null && !string.IsNullOrEmpty(view.ViewType) && UserView.IsEligibleForGrouping(view.ViewType)&& user.GetPreference(PreferenceKind.GroupedFolders).Length > 0){return GetUserRootFolder()@@ -1564,7 +1564,7 @@ namespace Emby.Server.Implementations.Library}var topParent = item.GetTopParent();- if (topParent != null)+ if (topParent is not null){return new[] { topParent.Id };}@@ -1589,7 +1589,7 @@ namespace Emby.Server.Implementations.Libraryreturn items.SelectMany(i => i.ToArray()).Select(ResolveIntro)- .Where(i => i != null);+ .Where(i => i is not null);}/// <summary>@@ -1648,7 +1648,7 @@ namespace Emby.Server.Implementations.Library// Pull the saved db item that will include metadatavar dbItem = GetItemById(video.Id) as Video;- if (dbItem != null)+ if (dbItem is not null){video = dbItem;}@@ -1685,7 +1685,7 @@ namespace Emby.Server.Implementations.LibraryIOrderedEnumerable<BaseItem> orderedItems = null;- foreach (var orderBy in sortBy.Select(o => GetComparer(o, user)).Where(c => c != null))+ foreach (var orderBy in sortBy.Select(o => GetComparer(o, user)).Where(c => c is not null)){if (isFirst){@@ -1781,7 +1781,7 @@ namespace Emby.Server.Implementations.LibraryRegisterItem(item);}- if (ItemAdded != null)+ if (ItemAdded is not null){foreach (var item in items){@@ -1811,7 +1811,7 @@ namespace Emby.Server.Implementations.Libraryprivate bool ImageNeedsRefresh(ItemImageInfo image){- if (image.Path != null && image.IsLocalFile)+ if (image.Path is not null && image.IsLocalFile){if (image.Width == 0 || image.Height == 0 || string.IsNullOrEmpty(image.BlurHash)){@@ -1829,7 +1829,7 @@ namespace Emby.Server.Implementations.Library}}- return image.Path != null && !image.IsLocalFile;+ return image.Path is not null && !image.IsLocalFile;}/// <inheritdoc />@@ -1838,7 +1838,7 @@ namespace Emby.Server.Implementations.LibraryArgumentNullException.ThrowIfNull(item);var outdated = forceUpdate- ? item.ImageInfos.Where(i => i.Path != null).ToArray()+ ? item.ImageInfos.Where(i => i.Path is not null).ToArray(): item.ImageInfos.Where(ImageNeedsRefresh).ToArray();// Skip image processing if current or live tv sourceif (outdated.Length == 0 || item.SourceType != SourceType.Library)@@ -1923,7 +1923,7 @@ namespace Emby.Server.Implementations.Library_itemRepository.SaveItems(items, cancellationToken);- if (ItemUpdated != null)+ if (ItemUpdated is not null){foreach (var item in items){@@ -1975,7 +1975,7 @@ namespace Emby.Server.Implementations.Library/// <param name="parent">The parent item.</param>public void ReportItemRemoved(BaseItem item, BaseItem parent){- if (ItemRemoved != null)+ if (ItemRemoved is not null){try{@@ -2006,7 +2006,7 @@ namespace Emby.Server.Implementations.Librarypublic List<Folder> GetCollectionFolders(BaseItem item){- while (item != null)+ while (item is not null){var parent = item.GetParent();@@ -2028,7 +2028,7 @@ namespace Emby.Server.Implementations.Librarypublic List<Folder> GetCollectionFolders(BaseItem item, List<Folder> allUserRootChildren){- while (item != null)+ while (item is not null){var parent = item.GetParent();@@ -2251,7 +2251,7 @@ namespace Emby.Server.Implementations.Libraryif (!refresh && !item.DisplayParentId.Equals(default)){var displayParent = GetItemById(item.DisplayParentId);- refresh = displayParent != null && displayParent.DateLastSaved > item.DateLastRefreshed;+ refresh = displayParent is not null && displayParent.DateLastSaved > item.DateLastRefreshed;}if (refresh)@@ -2315,7 +2315,7 @@ namespace Emby.Server.Implementations.Libraryif (!refresh && !item.DisplayParentId.Equals(default)){var displayParent = GetItemById(item.DisplayParentId);- refresh = displayParent != null && displayParent.DateLastSaved > item.DateLastRefreshed;+ refresh = displayParent is not null && displayParent.DateLastSaved > item.DateLastRefreshed;}if (refresh)@@ -2394,7 +2394,7 @@ namespace Emby.Server.Implementations.Libraryif (!refresh && !item.DisplayParentId.Equals(default)){var displayParent = GetItemById(item.DisplayParentId);- refresh = displayParent != null && displayParent.DateLastSaved > item.DateLastRefreshed;+ refresh = displayParent is not null && displayParent.DateLastSaved > item.DateLastRefreshed;}if (refresh)@@ -2441,7 +2441,7 @@ namespace Emby.Server.Implementations.Librarypublic bool FillMissingEpisodeNumbersFromPath(Episode episode, bool forceRefresh){var series = episode.Series;- bool? isAbsoluteNaming = series != null && string.Equals(series.DisplayOrder, "absolute", StringComparison.OrdinalIgnoreCase);+ bool? isAbsoluteNaming = series is not null && string.Equals(series.DisplayOrder, "absolute", StringComparison.OrdinalIgnoreCase);if (!isAbsoluteNaming.Value){// In other words, no filter applied@@ -2462,7 +2462,7 @@ namespace Emby.Server.Implementations.Libraryif (episodeInfo is null && parent.GetType() == typeof(Folder)){episodeInfo = resolver.Resolve(parent.Path, true, null, null, isAbsoluteNaming);- if (episodeInfo != null)+ if (episodeInfo is not null){// add the containerepisodeInfo.Container = Path.GetExtension(episode.Path)?.TrimStart('.');@@ -2582,7 +2582,7 @@ namespace Emby.Server.Implementations.Library{var season = episode.Season;- if (season != null)+ if (season is not null){episode.ParentIndexNumber = season.IndexNumber;}@@ -2640,7 +2640,7 @@ namespace Emby.Server.Implementations.Library}var extra = GetExtra(file, extraType.Value);- if (extra != null)+ if (extra is not null){yield return extra;}@@ -2649,7 +2649,7 @@ namespace Emby.Server.Implementations.Libraryelse if (!current.IsDirectory && _extraResolver.TryGetExtraTypeForOwner(current.FullName, ownerVideoInfo, out var extraType)){var extra = GetExtra(current, extraType.Value);- if (extra != null)+ if (extra is not null){yield return extra;}@@ -2666,7 +2666,7 @@ namespace Emby.Server.Implementations.Library// Try to retrieve it from the db. If we don't find it, use the resolved versionvar itemById = GetItemById(extra.Id);- if (itemById != null)+ if (itemById is not null){extra = itemById;}@@ -2681,10 +2681,10 @@ namespace Emby.Server.Implementations.Librarypublic string GetPathAfterNetworkSubstitution(string path, BaseItem ownerItem){string newPath;- if (ownerItem != null)+ if (ownerItem is not null){var libraryOptions = GetLibraryOptions(ownerItem);- if (libraryOptions != null)+ if (libraryOptions is not null){foreach (var pathInfo in libraryOptions.PathInfos){@@ -2753,7 +2753,7 @@ namespace Emby.Server.Implementations.Libraryreturn null;}})- .Where(i => i != null)+ .Where(i => i is not null).Where(i => query.User is null ?true :i.IsVisible(query.User))@@ -2838,10 +2838,10 @@ namespace Emby.Server.Implementations.Library}var mediaPathInfos = options.PathInfos;- if (mediaPathInfos != null)+ if (mediaPathInfos is not null){var invalidpath = mediaPathInfos.FirstOrDefault(i => !Directory.Exists(i.Path));- if (invalidpath != null)+ if (invalidpath is not null){throw new ArgumentException("The specified path does not exist: " + invalidpath.Path + ".");}@@ -2853,7 +2853,7 @@ namespace Emby.Server.Implementations.Library{Directory.CreateDirectory(virtualFolderPath);- if (collectionType != null)+ if (collectionType is not null){var path = Path.Combine(virtualFolderPath, collectionType.ToString().ToLowerInvariant() + ".collection");@@ -2862,7 +2862,7 @@ namespace Emby.Server.Implementations.LibraryCollectionFolder.SaveLibraryOptions(virtualFolderPath, options);- if (mediaPathInfos != null)+ if (mediaPathInfos is not null){foreach (var path in mediaPathInfos){diff --git a/Emby.Server.Implementations/Library/LiveStreamHelper.cs b/Emby.Server.Implementations/Library/LiveStreamHelper.csindex 1010335512..936a08da81 100644--- a/Emby.Server.Implementations/Library/LiveStreamHelper.cs+++ b/Emby.Server.Implementations/Library/LiveStreamHelper.cs@@ -81,7 +81,7 @@ namespace Emby.Server.Implementations.Library},cancellationToken).ConfigureAwait(false);- if (cacheFilePath != null)+ if (cacheFilePath is not null){Directory.CreateDirectory(Path.GetDirectoryName(cacheFilePath));await using FileStream createStream = AsyncFile.OpenWrite(cacheFilePath);@@ -140,7 +140,7 @@ namespace Emby.Server.Implementations.Library}var videoStream = mediaStreams.FirstOrDefault(i => i.Type == MediaStreamType.Video);- if (videoStream != null)+ if (videoStream is not null){if (!videoStream.BitRate.HasValue){diff --git a/Emby.Server.Implementations/Library/MediaSourceManager.cs b/Emby.Server.Implementations/Library/MediaSourceManager.csindex e2474f5081..7fff6ab7b3 100644--- a/Emby.Server.Implementations/Library/MediaSourceManager.cs+++ b/Emby.Server.Implementations/Library/MediaSourceManager.cs@@ -182,7 +182,7 @@ namespace Emby.Server.Implementations.Librarysource.SupportsDirectStream = SupportsDirectStream(source.Path, source.Protocol);}- if (user != null)+ if (user is not null){SetDefaultAudioAndSubtitleStreamIndexes(item, source, user);@@ -248,7 +248,7 @@ namespace Emby.Server.Implementations.Libraryif (protocol == MediaProtocol.Http){- if (path != null)+ if (path is not null){if (path.Contains(".m3u", StringComparison.OrdinalIgnoreCase)){@@ -328,7 +328,7 @@ namespace Emby.Server.Implementations.Libraryvar sources = hasMediaSources.GetMediaSources(enablePathSubstitution);- if (user != null)+ if (user is not null){foreach (var source in sources){@@ -357,7 +357,7 @@ namespace Emby.Server.Implementations.Library}var culture = _localizationManager.FindLanguageInfo(language);- if (culture != null)+ if (culture is not null){return culture.ThreeLetterISOLanguageNames;}@@ -432,7 +432,7 @@ namespace Emby.Server.Implementations.Library{var audio = source.MediaStreams.FirstOrDefault(i => i.Type == MediaStreamType.Audio);- if (audio != null)+ if (audio is not null){source.DefaultAudioStreamIndex = audio.Index;}@@ -553,7 +553,7 @@ namespace Emby.Server.Implementations.Library}var videoStream = mediaSource.MediaStreams.FirstOrDefault(i => i.Type == MediaStreamType.Video);- if (videoStream != null)+ if (videoStream is not null){if (!videoStream.BitRate.HasValue){@@ -661,7 +661,7 @@ namespace Emby.Server.Implementations.Library},cancellationToken).ConfigureAwait(false);- if (cacheFilePath != null)+ if (cacheFilePath is not null){Directory.CreateDirectory(Path.GetDirectoryName(cacheFilePath));await using FileStream createStream = File.Create(cacheFilePath);@@ -723,7 +723,7 @@ namespace Emby.Server.Implementations.Library}var videoStream = mediaStreams.FirstOrDefault(i => i.Type == MediaStreamType.Video);- if (videoStream != null)+ if (videoStream is not null){if (!videoStream.BitRate.HasValue){diff --git a/Emby.Server.Implementations/Library/MediaStreamSelector.cs b/Emby.Server.Implementations/Library/MediaStreamSelector.csindex 609b957727..74c53b2dac 100644--- a/Emby.Server.Implementations/Library/MediaStreamSelector.cs+++ b/Emby.Server.Implementations/Library/MediaStreamSelector.cs@@ -19,7 +19,7 @@ namespace Emby.Server.Implementations.Library{var defaultStream = sortedStreams.FirstOrDefault(i => i.IsDefault);- if (defaultStream != null)+ if (defaultStream is not null){return defaultStream.Index;}diff --git a/Emby.Server.Implementations/Library/ResolverHelper.cs b/Emby.Server.Implementations/Library/ResolverHelper.csindex 590d37b926..dedb56d678 100644--- a/Emby.Server.Implementations/Library/ResolverHelper.cs+++ b/Emby.Server.Implementations/Library/ResolverHelper.cs@@ -31,7 +31,7 @@ namespace Emby.Server.Implementations.Library}// If the resolver didn't specify this- if (parent != null)+ if (parent is not null){item.SetParent(parent);}@@ -71,7 +71,7 @@ namespace Emby.Server.Implementations.Library}// If the resolver didn't specify this- if (args.Parent != null)+ if (args.Parent is not null){item.SetParent(args.Parent);}@@ -113,7 +113,7 @@ namespace Emby.Server.Implementations.Library{var childData = args.IsDirectory ? args.GetFileSystemEntryByPath(item.Path) : null;- if (childData != null)+ if (childData is not null){SetDateCreated(item, childData);}@@ -140,7 +140,7 @@ namespace Emby.Server.Implementations.Libraryif (config.UseFileCreationTimeForDateAdded){// directoryService.getFile may return null- if (info != null)+ if (info is not null){var dateCreated = info.CreationTimeUtc;diff --git a/Emby.Server.Implementations/Library/Resolvers/Audio/AudioResolver.cs b/Emby.Server.Implementations/Library/Resolvers/Audio/AudioResolver.csindex bc1f5d08a8..06621700aa 100644--- a/Emby.Server.Implementations/Library/Resolvers/Audio/AudioResolver.cs+++ b/Emby.Server.Implementations/Library/Resolvers/Audio/AudioResolver.cs@@ -45,7 +45,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Audio{var result = ResolveMultipleInternal(parent, files, collectionType);- if (result != null)+ if (result is not null){foreach (var item in result.Items){@@ -126,7 +126,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Audioitem = new AudioBook();}- if (item != null)+ if (item is not null){item.IsShortcut = string.Equals(extension, ".strm", StringComparison.OrdinalIgnoreCase);@@ -183,7 +183,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.AudioItems = items};- var isInMixedFolder = resolverResult.Count > 1 || (parent != null && parent.IsTopParent);+ var isInMixedFolder = resolverResult.Count > 1 || (parent is not null && parent.IsTopParent);foreach (var resolvedItem in resolverResult){diff --git a/Emby.Server.Implementations/Library/Resolvers/Books/BookResolver.cs b/Emby.Server.Implementations/Library/Resolvers/Books/BookResolver.csindex 6fc200e3b1..042422c6f4 100644--- a/Emby.Server.Implementations/Library/Resolvers/Books/BookResolver.cs+++ b/Emby.Server.Implementations/Library/Resolvers/Books/BookResolver.cs@@ -34,7 +34,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Booksvar extension = Path.GetExtension(args.Path);- if (extension != null && _validExtensions.Contains(extension, StringComparison.OrdinalIgnoreCase))+ if (extension is not null && _validExtensions.Contains(extension, StringComparison.OrdinalIgnoreCase)){// It's a bookreturn new Bookdiff --git a/Emby.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs b/Emby.Server.Implementations/Library/Resolvers/Movies/MovieResolver.csindex 6b18ad237f..5f1a3ec6de 100644--- a/Emby.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs+++ b/Emby.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs@@ -64,7 +64,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Movies{var result = ResolveMultipleInternal(parent, files, collectionType);- if (result != null)+ if (result is not null){foreach (var item in result.Items){@@ -168,12 +168,12 @@ namespace Emby.Server.Implementations.Library.Resolvers.Movies}// Ignore extras- if (item?.ExtraType != null)+ if (item?.ExtraType is not null){return null;}- if (item != null)+ if (item is not null){item.IsInMixedFolder = true;}@@ -268,7 +268,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Moviesvar videoInfos = files.Select(i => VideoResolver.Resolve(i.FullName, i.IsDirectory, NamingOptions, parseName))- .Where(f => f != null)+ .Where(f => f is not null).ToList();var resolverResult = VideoListResolver.Resolve(videoInfos, NamingOptions, supportMultiEditions, parseName);@@ -284,7 +284,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Movies{var firstVideo = video.Files[0];var path = firstVideo.Path;- if (video.ExtraType != null)+ if (video.ExtraType is not null){result.ExtraFiles.Add(files.Find(f => string.Equals(f.FullName, path, StringComparison.OrdinalIgnoreCase)));continue;@@ -568,7 +568,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Moviesprivate bool IsInvalid(Folder parent, ReadOnlySpan<char> collectionType){- if (parent != null)+ if (parent is not null){if (parent.IsRoot){diff --git a/Emby.Server.Implementations/Library/Resolvers/TV/EpisodeResolver.cs b/Emby.Server.Implementations/Library/Resolvers/TV/EpisodeResolver.csindex 2e2b793418..0fcc5070b3 100644--- a/Emby.Server.Implementations/Library/Resolvers/TV/EpisodeResolver.cs+++ b/Emby.Server.Implementations/Library/Resolvers/TV/EpisodeResolver.cs@@ -46,27 +46,27 @@ namespace Emby.Server.Implementations.Library.Resolvers.TV// If the parent is a Season or Series and the parent is not an extras folder, then this is an Episode if the VideoResolver returns something// Also handle flat tv folders- if (season != null ||+ if (season is not null ||string.Equals(args.GetCollectionType(), CollectionType.TvShows, StringComparison.OrdinalIgnoreCase) ||args.HasParent<Series>()){var episode = ResolveVideo<Episode>(args, false);// Ignore extras- if (episode is null || episode.ExtraType != null)+ if (episode is null || episode.ExtraType is not null){return null;}var series = parent as Series ?? parent.GetParents().OfType<Series>().FirstOrDefault();- if (series != null)+ if (series is not null){episode.SeriesId = series.Id;episode.SeriesName = series.Name;}- if (season != null)+ if (season is not null){episode.SeasonId = season.Id;episode.SeasonName = season.Name;diff --git a/Emby.Server.Implementations/Library/Resolvers/TV/SeasonResolver.cs b/Emby.Server.Implementations/Library/Resolvers/TV/SeasonResolver.csindex ea48514587..62a524d2eb 100644--- a/Emby.Server.Implementations/Library/Resolvers/TV/SeasonResolver.cs+++ b/Emby.Server.Implementations/Library/Resolvers/TV/SeasonResolver.cs@@ -66,7 +66,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.TVvar episodeInfo = resolver.Resolve(testPath, true);- if (episodeInfo?.EpisodeNumber != null && episodeInfo.SeasonNumber.HasValue)+ if (episodeInfo?.EpisodeNumber is not null && episodeInfo.SeasonNumber.HasValue){_logger.LogDebug("Found folder underneath series with episode number: {0}. Season {1}. Episode {2}",diff --git a/Emby.Server.Implementations/Library/Resolvers/TV/SeriesResolver.cs b/Emby.Server.Implementations/Library/Resolvers/TV/SeriesResolver.csindex f5ac3c665e..8f69175d07 100644--- a/Emby.Server.Implementations/Library/Resolvers/TV/SeriesResolver.cs+++ b/Emby.Server.Implementations/Library/Resolvers/TV/SeriesResolver.cs@@ -76,7 +76,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.TV{if (args.ContainsFileSystemEntryByName("tvshow.nfo")){- if (args.Parent != null && args.Parent.IsRoot)+ if (args.Parent is not null && args.Parent.IsRoot){// For now, return null, but if we want to allow this in the future then add some additional checks to guard against a misplaced tvshow.nforeturn null;@@ -89,7 +89,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.TV};}- if (args.Parent != null && args.Parent.IsRoot)+ if (args.Parent is not null && args.Parent.IsRoot){return null;}@@ -138,7 +138,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.TVvar episodeResolver = new Naming.TV.EpisodeResolver(namingOptions);var episodeInfo = episodeResolver.Resolve(fullName, false, true, false, fillExtendedInfo: false);- if (episodeInfo != null && episodeInfo.EpisodeNumber.HasValue)+ if (episodeInfo is not null && episodeInfo.EpisodeNumber.HasValue){return true;}diff --git a/Emby.Server.Implementations/Library/UserDataManager.cs b/Emby.Server.Implementations/Library/UserDataManager.csindex aecab7d9c8..a0a90b129f 100644--- a/Emby.Server.Implementations/Library/UserDataManager.cs+++ b/Emby.Server.Implementations/Library/UserDataManager.cs@@ -126,7 +126,7 @@ namespace Emby.Server.Implementations.Library{var userData = _repository.GetUserData(internalUserId, keys);- if (userData != null)+ if (userData is not null){return userData;}diff --git a/Emby.Server.Implementations/Library/UserViewManager.cs b/Emby.Server.Implementations/Library/UserViewManager.csindex c294a63db6..1137625f44 100644--- a/Emby.Server.Implementations/Library/UserViewManager.cs+++ b/Emby.Server.Implementations/Library/UserViewManager.cs@@ -72,7 +72,7 @@ namespace Emby.Server.Implementations.Librarycontinue;}- if (collectionFolder != null && UserView.IsEligibleForGrouping(folder) && user.IsFolderGrouped(folder.Id))+ if (collectionFolder is not null && UserView.IsEligibleForGrouping(folder) && user.IsFolderGrouped(folder.Id)){groupedFolders.Add(collectionFolder);continue;@@ -214,9 +214,9 @@ namespace Emby.Server.Implementations.Library}else{- var current = list.FirstOrDefault(i => i.Item1 != null && i.Item1.Id.Equals(container.Id));+ var current = list.FirstOrDefault(i => i.Item1 is not null && i.Item1.Id.Equals(container.Id));- if (current != null)+ if (current is not null){current.Item2.Add(item);}diff --git a/Emby.Server.Implementations/LiveTv/EmbyTV/DirectRecorder.cs b/Emby.Server.Implementations/LiveTv/EmbyTV/DirectRecorder.csindex b2d25fdaeb..49833de737 100644--- a/Emby.Server.Implementations/LiveTv/EmbyTV/DirectRecorder.cs+++ b/Emby.Server.Implementations/LiveTv/EmbyTV/DirectRecorder.cs@@ -34,7 +34,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTVpublic Task Record(IDirectStreamProvider? directStreamProvider, MediaSourceInfo mediaSource, string targetFile, TimeSpan duration, Action onStarted, CancellationToken cancellationToken){- if (directStreamProvider != null)+ if (directStreamProvider is not null){return RecordFromDirectStreamProvider(directStreamProvider, targetFile, duration, onStarted, cancellationToken);}diff --git a/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.csindex 2f4854a6dd..8f5fa86944 100644--- a/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs+++ b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs@@ -367,7 +367,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV{var epgChannel = GetEpgChannelFromTunerChannel(info, tunerChannel, epgChannels);- if (epgChannel != null)+ if (epgChannel is not null){if (!string.IsNullOrWhiteSpace(epgChannel.Name)){@@ -450,7 +450,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTVvar channel = epgChannelData.GetChannelById(mappedTunerChannelId);- if (channel != null)+ if (channel is not null){return channel;}@@ -473,7 +473,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTVvar channel = epgChannelData.GetChannelById(mappedTunerChannelId);- if (channel != null)+ if (channel is not null){return channel;}@@ -490,7 +490,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTVvar channel = epgChannelData.GetChannelByNumber(tunerChannelNumber);- if (channel != null)+ if (channel is not null){return channel;}@@ -502,7 +502,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTVvar channel = epgChannelData.GetChannelByName(normalizedName);- if (channel != null)+ if (channel is not null){return channel;}@@ -552,7 +552,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV}var remove = _seriesTimerProvider.GetAll().FirstOrDefault(r => string.Equals(r.Id, timerId, StringComparison.OrdinalIgnoreCase));- if (remove != null)+ if (remove is not null){_seriesTimerProvider.Delete(remove);}@@ -563,7 +563,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTVprivate void CancelTimerInternal(string timerId, bool isSeriesCancelled, bool isManualCancellation){var timer = _timerProvider.GetTimer(timerId);- if (timer != null)+ if (timer is not null){var statusChanging = timer.Status != RecordingStatus.Cancelled;timer.Status = RecordingStatus.Cancelled;@@ -582,7 +582,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV_timerProvider.AddOrUpdate(timer, false);}- if (statusChanging && TimerCancelled != null)+ if (statusChanging && TimerCancelled is not null){TimerCancelled(this, new GenericEventArgs<string>(timerId));}@@ -617,7 +617,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTVnull :_timerProvider.GetTimerByProgramId(info.ProgramId);- if (existingTimer != null)+ if (existingTimer is not null){if (existingTimer.Status == RecordingStatus.Cancelled|| existingTimer.Status == RecordingStatus.Completed)@@ -648,7 +648,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTVprogramInfo = GetProgramInfoFromCache(info.ChannelId, info.StartDate);}- if (programInfo != null)+ if (programInfo is not null){CopyProgramInfoToTimerInfo(programInfo, info);}@@ -668,7 +668,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV// populate info.seriesIDvar program = GetProgramInfoFromCache(info.ProgramId);- if (program != null)+ if (program is not null){info.SeriesId = program.ExternalSeriesId;}@@ -714,7 +714,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV{var instance = _seriesTimerProvider.GetAll().FirstOrDefault(i => string.Equals(i.Id, info.Id, StringComparison.OrdinalIgnoreCase));- if (instance != null)+ if (instance is not null){instance.ChannelId = info.ChannelId;instance.Days = info.Days;@@ -861,7 +861,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV}};- if (program != null)+ if (program is not null){defaults.SeriesId = program.SeriesId;defaults.ProgramId = program.Id;@@ -947,7 +947,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTVreturn provider is null ? null : new Tuple<IListingsProvider, ListingsProviderInfo>(provider, i);})- .Where(i => i != null)+ .Where(i => i is not null).ToList();}@@ -964,7 +964,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTVnull :currentLiveStreams.FirstOrDefault(i => string.Equals(i.OriginalStreamId, streamId, StringComparison.OrdinalIgnoreCase));- if (result != null && result.EnableStreamSharing)+ if (result is not null && result.EnableStreamSharing){result.ConsumerCount++;@@ -1134,7 +1134,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV// trim trailing period from the folder namevar folderName = _fileSystem.GetValidFilename(timer.Name).Trim().TrimEnd('.').Trim();- if (metadata != null && metadata.ProductionYear.HasValue)+ if (metadata is not null && metadata.ProductionYear.HasValue){folderName += " (" + metadata.ProductionYear.Value.ToString(CultureInfo.InvariantCulture) + ")";}@@ -1238,7 +1238,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTVprogramInfo = GetProgramInfoFromCache(timer.ChannelId, timer.StartDate);}- if (programInfo != null)+ if (programInfo is not null){CopyProgramInfoToTimerInfo(programInfo, timer);}@@ -1412,7 +1412,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTVvar item = GetAffectedBaseItem(Path.GetDirectoryName(path));- if (item != null)+ if (item is not null){_logger.LogInformation("Refreshing recording parent {Path}", item.Path);@@ -1444,12 +1444,12 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTVpath = Path.GetDirectoryName(path);}- if (item != null)+ if (item is not null){if (item.GetType() == typeof(Folder) && string.Equals(item.Path, parentPath, StringComparison.OrdinalIgnoreCase)){var parentItem = item.GetParent();- if (parentItem != null && parentItem is not AggregateFolder)+ if (parentItem is not null && parentItem is not AggregateFolder){item = parentItem;}@@ -1569,7 +1569,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV{var libraryItem = _libraryManager.FindByPath(timer.RecordingPath, false);- if (libraryItem != null)+ if (libraryItem is not null){_libraryManager.DeleteItem(libraryItem,@@ -1714,7 +1714,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV(program.GetImageInfo(ImageType.Thumb, 0) ?? program.GetImageInfo(ImageType.Primary, 0)) :(program.GetImageInfo(ImageType.Primary, 0) ?? program.GetImageInfo(ImageType.Thumb, 0));- if (image != null)+ if (image is not null){try{@@ -1729,7 +1729,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTVif (!program.IsSeries){image = program.GetImageInfo(ImageType.Backdrop, 0);- if (image != null)+ if (image is not null){try{@@ -1742,7 +1742,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV}image = program.GetImageInfo(ImageType.Thumb, 0);- if (image != null)+ if (image is not null){try{@@ -1755,7 +1755,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV}image = program.GetImageInfo(ImageType.Logo, 0);- if (image != null)+ if (image is not null){try{@@ -2367,13 +2367,13 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTVDtoOptions = new DtoOptions()}).FirstOrDefault() as LiveTvChannel;- if (channel != null && !string.IsNullOrWhiteSpace(channel.ExternalId))+ if (channel is not null && !string.IsNullOrWhiteSpace(channel.ExternalId)){tempChannelCache[parent.ChannelId] = channel;}}- if (channel != null || tempChannelCache.TryGetValue(parent.ChannelId, out channel))+ if (channel is not null || tempChannelCache.TryGetValue(parent.ChannelId, out channel)){channelId = channel.ExternalId;}@@ -2426,13 +2426,13 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTVDtoOptions = new DtoOptions()}).FirstOrDefault() as LiveTvChannel;- if (channel != null && !string.IsNullOrWhiteSpace(channel.ExternalId))+ if (channel is not null && !string.IsNullOrWhiteSpace(channel.ExternalId)){tempChannelCache[programInfo.ChannelId] = channel;}}- if (channel != null || tempChannelCache.TryGetValue(programInfo.ChannelId, out channel))+ if (channel is not null || tempChannelCache.TryGetValue(programInfo.ChannelId, out channel)){channelId = channel.ExternalId;}@@ -2626,7 +2626,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV{var configuredDevice = configuredDevices.FirstOrDefault(i => string.Equals(i.DeviceId, device.DeviceId, StringComparison.OrdinalIgnoreCase));- if (configuredDevice != null && !string.Equals(device.Url, configuredDevice.Url, StringComparison.OrdinalIgnoreCase))+ if (configuredDevice is not null && !string.Equals(device.Url, configuredDevice.Url, StringComparison.OrdinalIgnoreCase)){_logger.LogInformation("Tuner url has changed from {PreviousUrl} to {NewUrl}", configuredDevice.Url, device.Url);diff --git a/Emby.Server.Implementations/LiveTv/EmbyTV/EncodedRecorder.cs b/Emby.Server.Implementations/LiveTv/EmbyTV/EncodedRecorder.csindex 08534de59d..5369c9b3d1 100644--- a/Emby.Server.Implementations/LiveTv/EmbyTV/EncodedRecorder.cs+++ b/Emby.Server.Implementations/LiveTv/EmbyTV/EncodedRecorder.cs@@ -208,7 +208,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV// var audioChannels = 2;// var audioStream = mediaStreams.FirstOrDefault(i => i.Type == MediaStreamType.Audio);- // if (audioStream != null)+ // if (audioStream is not null)// {// audioChannels = audioStream.Channels ?? audioChannels;// }diff --git a/Emby.Server.Implementations/LiveTv/EmbyTV/ItemDataProvider.cs b/Emby.Server.Implementations/LiveTv/EmbyTV/ItemDataProvider.csindex 80e3e5233f..d5a6feb470 100644--- a/Emby.Server.Implementations/LiveTv/EmbyTV/ItemDataProvider.cs+++ b/Emby.Server.Implementations/LiveTv/EmbyTV/ItemDataProvider.cs@@ -36,7 +36,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV[MemberNotNull(nameof(_items))]private void EnsureLoaded(){- if (_items != null)+ if (_items is not null){return;}diff --git a/Emby.Server.Implementations/LiveTv/EmbyTV/RecordingHelper.cs b/Emby.Server.Implementations/LiveTv/EmbyTV/RecordingHelper.csindex 40dcca94f6..7bbeae866a 100644--- a/Emby.Server.Implementations/LiveTv/EmbyTV/RecordingHelper.cs+++ b/Emby.Server.Implementations/LiveTv/EmbyTV/RecordingHelper.cs@@ -63,7 +63,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV}}}- else if (info.IsMovie && info.ProductionYear != null)+ else if (info.IsMovie && info.ProductionYear is not null){name += " (" + info.ProductionYear + ")";}diff --git a/Emby.Server.Implementations/LiveTv/EmbyTV/TimerManager.cs b/Emby.Server.Implementations/LiveTv/EmbyTV/TimerManager.csindex f612565d1b..1dfdfe84de 100644--- a/Emby.Server.Implementations/LiveTv/EmbyTV/TimerManager.cs+++ b/Emby.Server.Implementations/LiveTv/EmbyTV/TimerManager.cs@@ -165,7 +165,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTVvar timerId = (string?)state ?? throw new ArgumentNullException(nameof(state));var timer = GetAll().FirstOrDefault(i => string.Equals(i.Id, timerId, StringComparison.OrdinalIgnoreCase));- if (timer != null)+ if (timer is not null){TimerFired?.Invoke(this, new GenericEventArgs<TimerInfo>(timer));}diff --git a/Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs b/Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.csindex 69670e8110..7db7ac576e 100644--- a/Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs+++ b/Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs@@ -153,7 +153,7 @@ namespace Emby.Server.Implementations.LiveTv.Listingscontinue;}- if (images != null)+ if (images is not null){var imageIndex = images.FindIndex(i => i.ProgramId == schedule.ProgramId[..10]);if (imageIndex > -1)@@ -266,7 +266,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings}string episodeTitle = null;- if (details.EpisodeTitle150 != null)+ if (details.EpisodeTitle150 is not null){episodeTitle = details.EpisodeTitle150;}@@ -315,13 +315,13 @@ namespace Emby.Server.Implementations.LiveTv.Listingsinfo.ShowId = showId;- if (programInfo.VideoProperties != null)+ if (programInfo.VideoProperties is not null){info.IsHD = programInfo.VideoProperties.Contains("hdtv", StringComparison.OrdinalIgnoreCase);info.Is3D = programInfo.VideoProperties.Contains("3d", StringComparison.OrdinalIgnoreCase);}- if (details.ContentRating != null && details.ContentRating.Count > 0)+ if (details.ContentRating is not null && details.ContentRating.Count > 0){info.OfficialRating = details.ContentRating[0].Code.Replace("TV", "TV-", StringComparison.Ordinal).Replace("--", "-", StringComparison.Ordinal);@@ -333,13 +333,13 @@ namespace Emby.Server.Implementations.LiveTv.Listings}}- if (details.Descriptions != null)+ if (details.Descriptions is not null){- if (details.Descriptions.Description1000 != null && details.Descriptions.Description1000.Count > 0)+ if (details.Descriptions.Description1000 is not null && details.Descriptions.Description1000.Count > 0){info.Overview = details.Descriptions.Description1000[0].Description;}- else if (details.Descriptions.Description100 != null && details.Descriptions.Description100.Count > 0)+ else if (details.Descriptions.Description100 is not null && details.Descriptions.Description100.Count > 0){info.Overview = details.Descriptions.Description100[0].Description;}@@ -351,12 +351,12 @@ namespace Emby.Server.Implementations.LiveTv.Listingsinfo.SeriesProviderIds[MetadataProvider.Zap2It.ToString()] = info.SeriesId;- if (details.Metadata != null)+ if (details.Metadata is not null){foreach (var metadataProgram in details.Metadata){var gracenote = metadataProgram.Gracenote;- if (gracenote != null)+ if (gracenote is not null){info.SeasonNumber = gracenote.Season;@@ -371,13 +371,13 @@ namespace Emby.Server.Implementations.LiveTv.Listings}}- if (details.OriginalAirDate != null)+ if (details.OriginalAirDate is not null){info.OriginalAirDate = details.OriginalAirDate;info.ProductionYear = info.OriginalAirDate.Value.Year;}- if (details.Movie != null)+ if (details.Movie is not null){if (!string.IsNullOrEmpty(details.Movie.Year)&& int.TryParse(details.Movie.Year, out int year))@@ -386,7 +386,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings}}- if (details.Genres != null)+ if (details.Genres is not null){info.Genres = details.Genres.Where(g => !string.IsNullOrWhiteSpace(g)).ToList();info.IsNews = details.Genres.Contains("news", StringComparison.OrdinalIgnoreCase);@@ -518,7 +518,7 @@ namespace Emby.Server.Implementations.LiveTv.Listingsvar root = await JsonSerializer.DeserializeAsync<IReadOnlyList<HeadendsDto>>(response, _jsonOptions, cancellationToken).ConfigureAwait(false);- if (root != null)+ if (root is not null){foreach (HeadendsDto headend in root){@@ -814,7 +814,7 @@ namespace Emby.Server.Implementations.LiveTv.ListingsName = string.IsNullOrWhiteSpace(station.Name) ? channelNumber : station.Name};- if (station.Logo != null)+ if (station.Logo is not null){channelInfo.ImageUrl = station.Logo.Url;}diff --git a/Emby.Server.Implementations/LiveTv/Listings/XmlTvListingsProvider.cs b/Emby.Server.Implementations/LiveTv/Listings/XmlTvListingsProvider.csindex 1b72a44b4b..e874990da1 100644--- a/Emby.Server.Implementations/LiveTv/Listings/XmlTvListingsProvider.cs+++ b/Emby.Server.Implementations/LiveTv/Listings/XmlTvListingsProvider.cs@@ -151,9 +151,9 @@ namespace Emby.Server.Implementations.LiveTv.ListingsOverview = program.Description,ProductionYear = program.CopyrightDate?.Year,SeasonNumber = program.Episode?.Series,- IsSeries = program.Episode != null,+ IsSeries = program.Episode is not null,IsRepeat = program.IsPreviouslyShown && !program.IsNew,- IsPremiere = program.Premiere != null,+ IsPremiere = program.Premiere is not null,IsKids = program.Categories.Any(c => info.KidsCategories.Contains(c, StringComparison.OrdinalIgnoreCase)),IsMovie = program.Categories.Any(c => info.MovieCategories.Contains(c, StringComparison.OrdinalIgnoreCase)),IsNews = program.Categories.Any(c => info.NewsCategories.Contains(c, StringComparison.OrdinalIgnoreCase)),diff --git a/Emby.Server.Implementations/LiveTv/LiveTvDtoService.cs b/Emby.Server.Implementations/LiveTv/LiveTvDtoService.csindex a92b473b5d..9326fbd5c7 100644--- a/Emby.Server.Implementations/LiveTv/LiveTvDtoService.cs+++ b/Emby.Server.Implementations/LiveTv/LiveTvDtoService.cs@@ -80,7 +80,7 @@ namespace Emby.Server.Implementations.LiveTvdto.ProgramId = GetInternalProgramId(info.ProgramId).ToString("N", CultureInfo.InvariantCulture);}- if (program != null)+ if (program is not null){dto.ProgramInfo = _dtoService.GetBaseItemDto(program, new DtoOptions());@@ -98,7 +98,7 @@ namespace Emby.Server.Implementations.LiveTv}}- if (channel != null)+ if (channel is not null){dto.ChannelName = channel.Name;@@ -168,10 +168,10 @@ namespace Emby.Server.Implementations.LiveTvDtoOptions = new DtoOptions(false)}).FirstOrDefault();- if (librarySeries != null)+ if (librarySeries is not null){var image = librarySeries.GetImageInfo(ImageType.Thumb, 0);- if (image != null)+ if (image is not null){try{@@ -185,7 +185,7 @@ namespace Emby.Server.Implementations.LiveTv}image = librarySeries.GetImageInfo(ImageType.Backdrop, 0);- if (image != null)+ if (image is not null){try{@@ -212,10 +212,10 @@ namespace Emby.Server.Implementations.LiveTvName = string.IsNullOrEmpty(programSeriesId) ? seriesName : null}).FirstOrDefault();- if (program != null)+ if (program is not null){var image = program.GetImageInfo(ImageType.Primary, 0);- if (image != null)+ if (image is not null){try{@@ -231,7 +231,7 @@ namespace Emby.Server.Implementations.LiveTvif (dto.ParentBackdropImageTags is null || dto.ParentBackdropImageTags.Length == 0){image = program.GetImageInfo(ImageType.Backdrop, 0);- if (image != null)+ if (image is not null){try{@@ -262,10 +262,10 @@ namespace Emby.Server.Implementations.LiveTvDtoOptions = new DtoOptions(false)}).FirstOrDefault();- if (librarySeries != null)+ if (librarySeries is not null){var image = librarySeries.GetImageInfo(ImageType.Thumb, 0);- if (image != null)+ if (image is not null){try{@@ -279,7 +279,7 @@ namespace Emby.Server.Implementations.LiveTv}image = librarySeries.GetImageInfo(ImageType.Backdrop, 0);- if (image != null)+ if (image is not null){try{@@ -318,10 +318,10 @@ namespace Emby.Server.Implementations.LiveTv}).FirstOrDefault();}- if (program != null)+ if (program is not null){var image = program.GetImageInfo(ImageType.Primary, 0);- if (image != null)+ if (image is not null){try{@@ -337,7 +337,7 @@ namespace Emby.Server.Implementations.LiveTvif (dto.ParentBackdropImageTags is null || dto.ParentBackdropImageTags.Length == 0){image = program.GetImageInfo(ImageType.Backdrop, 0);- if (image != null)+ if (image is not null){try{@@ -460,7 +460,7 @@ namespace Emby.Server.Implementations.LiveTv{var channel = _libraryManager.GetItemById(dto.ChannelId);- if (channel != null)+ if (channel is not null){info.ChannelId = channel.ExternalId;}@@ -470,7 +470,7 @@ namespace Emby.Server.Implementations.LiveTv{var program = _libraryManager.GetItemById(dto.ProgramId);- if (program != null)+ if (program is not null){info.ProgramId = program.ExternalId;}@@ -480,7 +480,7 @@ namespace Emby.Server.Implementations.LiveTv{var timer = await liveTv.GetSeriesTimer(dto.SeriesTimerId, cancellationToken).ConfigureAwait(false);- if (timer != null)+ if (timer is not null){info.SeriesTimerId = timer.ExternalId;}@@ -526,7 +526,7 @@ namespace Emby.Server.Implementations.LiveTv{var channel = _libraryManager.GetItemById(dto.ChannelId);- if (channel != null)+ if (channel is not null){info.ChannelId = channel.ExternalId;}@@ -536,7 +536,7 @@ namespace Emby.Server.Implementations.LiveTv{var program = _libraryManager.GetItemById(dto.ProgramId);- if (program != null)+ if (program is not null){info.ProgramId = program.ExternalId;}diff --git a/Emby.Server.Implementations/LiveTv/LiveTvManager.cs b/Emby.Server.Implementations/LiveTv/LiveTvManager.csindex ea26a2227f..7afc7959c1 100644--- a/Emby.Server.Implementations/LiveTv/LiveTvManager.cs+++ b/Emby.Server.Implementations/LiveTv/LiveTvManager.cs@@ -446,7 +446,7 @@ namespace Emby.Server.Implementations.LiveTvisNew = true;}- if (channelInfo.Tags != null)+ if (channelInfo.Tags is not null){if (!channelInfo.Tags.SequenceEqual(item.Tags, StringComparer.OrdinalIgnoreCase)){@@ -836,7 +836,7 @@ namespace Emby.Server.Implementations.LiveTv{var seriesTimers = await GetSeriesTimersInternal(new SeriesTimerQuery(), cancellationToken).ConfigureAwait(false);var seriesTimer = seriesTimers.Items.FirstOrDefault(i => string.Equals(_tvDtoService.GetInternalSeriesTimerId(i.Id).ToString("N", CultureInfo.InvariantCulture), query.SeriesTimerId, StringComparison.OrdinalIgnoreCase));- if (seriesTimer != null)+ if (seriesTimer is not null){internalQuery.ExternalSeriesId = seriesTimer.SeriesId;@@ -989,7 +989,7 @@ namespace Emby.Server.Implementations.LiveTvvar timer = timerList.FirstOrDefault(i => string.Equals(i.ProgramId, externalProgramId, StringComparison.OrdinalIgnoreCase));var foundSeriesTimer = false;- if (timer != null)+ if (timer is not null){if (timer.Status != RecordingStatus.Cancelled && timer.Status != RecordingStatus.Error){@@ -1016,7 +1016,7 @@ namespace Emby.Server.Implementations.LiveTvvar seriesTimer = seriesTimerList.FirstOrDefault(i => string.Equals(i.SeriesId, externalSeriesId, StringComparison.OrdinalIgnoreCase));- if (seriesTimer != null)+ if (seriesTimer is not null){program.SeriesTimerId = _tvDtoService.GetInternalSeriesTimerId(seriesTimer.Id).ToString("N", CultureInfo.InvariantCulture);@@ -1086,7 +1086,7 @@ namespace Emby.Server.Implementations.LiveTvvar coreService = _services.OfType<EmbyTV.EmbyTV>().FirstOrDefault();- if (coreService != null)+ if (coreService is not null){await coreService.RefreshSeriesTimers(cancellationToken).ConfigureAwait(false);await coreService.RefreshTimers(cancellationToken).ConfigureAwait(false);@@ -1280,7 +1280,7 @@ namespace Emby.Server.Implementations.LiveTv{var item = _libraryManager.GetItemById(itemId);- if (item != null)+ if (item is not null){_libraryManager.DeleteItem(item,@@ -1377,7 +1377,7 @@ namespace Emby.Server.Implementations.LiveTvlimit = null;// var allActivePaths = EmbyTV.EmbyTV.Current.GetAllActiveRecordings().Select(i => i.Path).ToArray();- // var items = allActivePaths.Select(i => _libraryManager.FindByPath(i, false)).Where(i => i != null).ToArray();+ // var items = allActivePaths.Select(i => _libraryManager.FindByPath(i, false)).Where(i => i is not null).ToArray();// return new QueryResult<BaseItem>// {@@ -1517,7 +1517,7 @@ namespace Emby.Server.Implementations.LiveTvdto.CompletionPercentage = pct;}- if (channel != null)+ if (channel is not null){dto.ChannelName = channel.Name;@@ -1887,7 +1887,7 @@ namespace Emby.Server.Implementations.LiveTv{var currentProgram = programs.FirstOrDefault(i => channel.Id.Equals(i.ChannelId));- if (currentProgram != null)+ if (currentProgram is not null){currentProgramsList.Add(currentProgram);}@@ -1913,7 +1913,7 @@ namespace Emby.Server.Implementations.LiveTvILiveTvService service = null;ProgramInfo programInfo = null;- if (program != null)+ if (program is not null){service = GetService(program);@@ -2317,7 +2317,7 @@ namespace Emby.Server.Implementations.LiveTvvar providerChannel = EmbyTV.EmbyTV.Current.GetEpgChannelFromTunerChannel(mappings, tunerChannel, providerChannels);- if (providerChannel != null)+ if (providerChannel is not null){result.ProviderChannelName = providerChannel.Name;result.ProviderChannelId = providerChannel.Id;@@ -2390,7 +2390,7 @@ namespace Emby.Server.Implementations.LiveTv.SelectMany(i => i.Locations).Distinct(StringComparer.OrdinalIgnoreCase).Select(i => _libraryManager.FindByPath(i, true))- .Where(i => i != null && i.IsVisibleStandalone(user))+ .Where(i => i is not null && i.IsVisibleStandalone(user)).SelectMany(i => _libraryManager.GetCollectionFolders(i)).GroupBy(x => x.Id).Select(x => x.First())diff --git a/Emby.Server.Implementations/LiveTv/LiveTvMediaSourceProvider.cs b/Emby.Server.Implementations/LiveTv/LiveTvMediaSourceProvider.csindex 4b7584af34..6a92fc5997 100644--- a/Emby.Server.Implementations/LiveTv/LiveTvMediaSourceProvider.cs+++ b/Emby.Server.Implementations/LiveTv/LiveTvMediaSourceProvider.cs@@ -42,7 +42,7 @@ namespace Emby.Server.Implementations.LiveTv{var activeRecordingInfo = _liveTvManager.GetActiveRecordingInfo(item.Path);- if (string.IsNullOrEmpty(item.Path) || activeRecordingInfo != null)+ if (string.IsNullOrEmpty(item.Path) || activeRecordingInfo is not null){return GetMediaSourcesInternal(item, activeRecordingInfo, cancellationToken);}@@ -59,7 +59,7 @@ namespace Emby.Server.Implementations.LiveTvtry{- if (activeRecordingInfo != null)+ if (activeRecordingInfo is not null){sources = await EmbyTV.EmbyTV.Current.GetRecordingStreamMediaSources(activeRecordingInfo, cancellationToken).ConfigureAwait(false);diff --git a/Emby.Server.Implementations/LiveTv/TunerHosts/BaseTunerHost.cs b/Emby.Server.Implementations/LiveTv/TunerHosts/BaseTunerHost.csindex 2b82f24623..2e1aef0726 100644--- a/Emby.Server.Implementations/LiveTv/TunerHosts/BaseTunerHost.cs+++ b/Emby.Server.Implementations/LiveTv/TunerHosts/BaseTunerHost.cs@@ -147,7 +147,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHostsvar channels = await GetChannels(host, true, cancellationToken).ConfigureAwait(false);var channelInfo = channels.FirstOrDefault(i => string.Equals(i.Id, channelId, StringComparison.OrdinalIgnoreCase));- if (channelInfo != null)+ if (channelInfo is not null){return await GetChannelStreamMediaSources(host, channelInfo, cancellationToken).ConfigureAwait(false);}@@ -187,7 +187,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHostsvar channels = await GetChannels(host, true, cancellationToken).ConfigureAwait(false);var channelInfo = channels.FirstOrDefault(i => string.Equals(i.Id, channelId, StringComparison.OrdinalIgnoreCase));- if (channelInfo != null)+ if (channelInfo is not null){hostsWithChannel.Add(new Tuple<TunerHostInfo, ChannelInfo>(host, channelInfo));}diff --git a/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs b/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.csindex 04d64e5006..5327b3d748 100644--- a/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs+++ b/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs@@ -503,7 +503,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun{var modelInfo = await GetModelInfo(tuner, false, cancellationToken).ConfigureAwait(false);- if (modelInfo != null && modelInfo.SupportsTranscoding)+ if (modelInfo is not null && modelInfo.SupportsTranscoding){if (tuner.AllowHWTranscoding){@@ -560,7 +560,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerunvar mediaSource = GetMediaSource(tunerHost, hdhrId, channel, profile);- if (hdhomerunChannel != null && hdhomerunChannel.IsLegacyTuner)+ if (hdhomerunChannel is not null && hdhomerunChannel.IsLegacyTuner){return new HdHomerunUdpStream(mediaSource,@@ -674,7 +674,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerunvar info = await TryGetTunerHostInfo(deviceAddress, cancellationToken).ConfigureAwait(false);- if (info != null)+ if (info is not null){list.Add(info);}diff --git a/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunManager.cs b/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunManager.csindex e67b5846aa..81eb083f6f 100644--- a/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunManager.cs+++ b/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunManager.cs@@ -37,7 +37,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun{using (var socket = _tcpClient){- if (socket != null)+ if (socket is not null){_tcpClient = null;diff --git a/Emby.Server.Implementations/LiveTv/TunerHosts/LiveStream.cs b/Emby.Server.Implementations/LiveTv/TunerHosts/LiveStream.csindex 2748794b38..3ae9e256b2 100644--- a/Emby.Server.Implementations/LiveTv/TunerHosts/LiveStream.cs+++ b/Emby.Server.Implementations/LiveTv/TunerHosts/LiveStream.cs@@ -35,7 +35,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHostsEnableStreamSharing = true;UniqueId = Guid.NewGuid().ToString("N", CultureInfo.InvariantCulture);- if (tuner != null)+ if (tuner is not null){TunerHostId = tuner.Id;}diff --git a/Emby.Server.Implementations/MediaEncoder/EncodingManager.cs b/Emby.Server.Implementations/MediaEncoder/EncodingManager.csindex 6e1dc725d4..9fe51f083f 100644--- a/Emby.Server.Implementations/MediaEncoder/EncodingManager.cs+++ b/Emby.Server.Implementations/MediaEncoder/EncodingManager.cs@@ -71,7 +71,7 @@ namespace Emby.Server.Implementations.MediaEncoder}var libraryOptions = _libraryManager.GetLibraryOptions(video);- if (libraryOptions != null)+ if (libraryOptions is not null){if (!libraryOptions.EnableChapterImageExtraction){diff --git a/Emby.Server.Implementations/Net/UdpSocket.cs b/Emby.Server.Implementations/Net/UdpSocket.csindex c3994fc040..577b79283a 100644--- a/Emby.Server.Implementations/Net/UdpSocket.cs+++ b/Emby.Server.Implementations/Net/UdpSocket.cs@@ -74,7 +74,7 @@ namespace Emby.Server.Implementations.Netprivate void OnReceiveSocketAsyncEventArgsCompleted(object sender, SocketAsyncEventArgs e){var tcs = _currentReceiveTaskCompletionSource;- if (tcs != null)+ if (tcs is not null){_currentReceiveTaskCompletionSource = null;@@ -98,7 +98,7 @@ namespace Emby.Server.Implementations.Netprivate void OnSendSocketAsyncEventArgsCompleted(object sender, SocketAsyncEventArgs e){var tcs = _currentSendTaskCompletionSource;- if (tcs != null)+ if (tcs is not null){_currentSendTaskCompletionSource = null;diff --git a/Emby.Server.Implementations/Playlists/PlaylistManager.cs b/Emby.Server.Implementations/Playlists/PlaylistManager.csindex d8d4629c1f..271c0bc4df 100644--- a/Emby.Server.Implementations/Playlists/PlaylistManager.cs+++ b/Emby.Server.Implementations/Playlists/PlaylistManager.cs@@ -183,7 +183,7 @@ namespace Emby.Server.Implementations.Playlistsprivate List<BaseItem> GetPlaylistItems(IEnumerable<Guid> itemIds, string playlistMediaType, User user, DtoOptions options){- var items = itemIds.Select(i => _libraryManager.GetItemById(i)).Where(i => i != null);+ var items = itemIds.Select(i => _libraryManager.GetItemById(i)).Where(i => i is not null);return Playlist.GetPlaylistItems(playlistMediaType, items, user, options);}diff --git a/Emby.Server.Implementations/Plugins/PluginManager.cs b/Emby.Server.Implementations/Plugins/PluginManager.csindex c1a38d23ca..39dc2135db 100644--- a/Emby.Server.Implementations/Plugins/PluginManager.cs+++ b/Emby.Server.Implementations/Plugins/PluginManager.cs@@ -268,7 +268,7 @@ namespace Emby.Server.Implementations.Plugins// If no version is given, return the current instance.var plugins = _plugins.Where(p => p.Id.Equals(id)).ToList();- plugin = plugins.FirstOrDefault(p => p.Instance != null) ?? plugins.OrderByDescending(p => p.Version).FirstOrDefault();+ plugin = plugins.FirstOrDefault(p => p.Instance is not null) ?? plugins.OrderByDescending(p => p.Version).FirstOrDefault();}else{@@ -500,7 +500,7 @@ namespace Emby.Server.Implementations.Plugins#pragma warning restore CA1031 // Do not catch general exception types{_logger.LogError(ex, "Error creating {Type}", type.FullName);- if (plugin != null)+ if (plugin is not null){if (ChangePluginState(plugin, PluginStatus.Malfunctioned)){@@ -523,7 +523,7 @@ namespace Emby.Server.Implementations.Pluginsvar predecessor = _plugins.OrderByDescending(p => p.Version).FirstOrDefault(p => p.Id.Equals(plugin.Id) && p.IsEnabledAndSupported && p.Version != plugin.Version);- if (predecessor != null)+ if (predecessor is not null){return;}@@ -577,7 +577,7 @@ namespace Emby.Server.Implementations.Plugins_logger.LogError(ex, "Error deserializing {Json}.", Encoding.UTF8.GetString(data!));}- if (manifest != null)+ if (manifest is not null){if (!Version.TryParse(manifest.TargetAbi, out var targetAbi)){diff --git a/Emby.Server.Implementations/ScheduledTasks/ScheduledTaskWorker.cs b/Emby.Server.Implementations/ScheduledTasks/ScheduledTaskWorker.csindex 25515f7787..ee9aa85699 100644--- a/Emby.Server.Implementations/ScheduledTasks/ScheduledTaskWorker.cs+++ b/Emby.Server.Implementations/ScheduledTasks/ScheduledTaskWorker.cs@@ -211,7 +211,7 @@ namespace Emby.Server.Implementations.ScheduledTasks{get{- if (CurrentCancellationTokenSource != null)+ if (CurrentCancellationTokenSource is not null){return CurrentCancellationTokenSource.IsCancellationRequested? TaskState.Cancelling@@ -240,7 +240,7 @@ namespace Emby.Server.Implementations.ScheduledTasksArgumentNullException.ThrowIfNull(value);// Cleanup current triggers- if (_triggers != null)+ if (_triggers is not null){DisposeTriggers();}@@ -269,7 +269,7 @@ namespace Emby.Server.Implementations.ScheduledTasksArgumentNullException.ThrowIfNull(value);// This null check is not great, but is needed to handle bad user input, or user mucking with the config file incorrectly- var triggerList = value.Where(i => i != null).ToArray();+ var triggerList = value.Where(i => i is not null).ToArray();SaveTriggers(triggerList);@@ -369,7 +369,7 @@ namespace Emby.Server.Implementations.ScheduledTasksprivate async Task ExecuteInternal(TaskOptions options){// Cancel the current execution, if any- if (CurrentCancellationTokenSource != null)+ if (CurrentCancellationTokenSource is not null){throw new InvalidOperationException("Cannot execute a Task that is already running");}@@ -391,7 +391,7 @@ namespace Emby.Server.Implementations.ScheduledTaskstry{- if (options != null && options.MaxRuntimeTicks.HasValue)+ if (options is not null && options.MaxRuntimeTicks.HasValue){CurrentCancellationTokenSource.CancelAfter(TimeSpan.FromTicks(options.MaxRuntimeTicks.Value));}@@ -507,7 +507,7 @@ namespace Emby.Server.Implementations.ScheduledTasksprivate Tuple<TaskTriggerInfo, ITaskTrigger>[] LoadTriggers(){// This null check is not great, but is needed to handle bad user input, or user mucking with the config file incorrectly- var settings = LoadTriggerSettings().Where(i => i != null).ToArray();+ var settings = LoadTriggerSettings().Where(i => i is not null).ToArray();return settings.Select(i => new Tuple<TaskTriggerInfo, ITaskTrigger>(i, GetTrigger(i))).ToArray();}@@ -583,7 +583,7 @@ namespace Emby.Server.Implementations.ScheduledTasksresult.Key = ScheduledTask.Key;- if (ex != null)+ if (ex is not null){result.ErrorMessage = ex.Message;result.LongErrorMessage = ex.StackTrace;@@ -617,7 +617,7 @@ namespace Emby.Server.Implementations.ScheduledTasksvar startTime = CurrentExecutionStartTime;var token = CurrentCancellationTokenSource;- if (token != null)+ if (token is not null){try{@@ -631,7 +631,7 @@ namespace Emby.Server.Implementations.ScheduledTasks}var task = _currentTask;- if (task != null)+ if (task is not null){try{@@ -653,7 +653,7 @@ namespace Emby.Server.Implementations.ScheduledTasks}}- if (token != null)+ if (token is not null){try{diff --git a/Emby.Server.Implementations/ScheduledTasks/Tasks/ChapterImagesTask.cs b/Emby.Server.Implementations/ScheduledTasks/Tasks/ChapterImagesTask.csindex da7c8732a8..abc203618d 100644--- a/Emby.Server.Implementations/ScheduledTasks/Tasks/ChapterImagesTask.cs+++ b/Emby.Server.Implementations/ScheduledTasks/Tasks/ChapterImagesTask.cs@@ -151,7 +151,7 @@ namespace Emby.Server.Implementations.ScheduledTasks.TaskspreviouslyFailedImages.Add(key);var parentPath = Path.GetDirectoryName(failHistoryPath);- if (parentPath != null)+ if (parentPath is not null){Directory.CreateDirectory(parentPath);}diff --git a/Emby.Server.Implementations/ScheduledTasks/Triggers/IntervalTrigger.cs b/Emby.Server.Implementations/ScheduledTasks/Triggers/IntervalTrigger.csindex e9b8a8257f..d65ac2e5ea 100644--- a/Emby.Server.Implementations/ScheduledTasks/Triggers/IntervalTrigger.cs+++ b/Emby.Server.Implementations/ScheduledTasks/Triggers/IntervalTrigger.cs@@ -100,7 +100,7 @@ namespace Emby.Server.Implementations.ScheduledTasks.Triggers{DisposeTimer();- if (Triggered != null)+ if (Triggered is not null){_lastStartDate = DateTime.UtcNow;Triggered(this, EventArgs.Empty);diff --git a/Emby.Server.Implementations/Session/SessionManager.cs b/Emby.Server.Implementations/Session/SessionManager.csindex a1e3b9dbd9..2add9be805 100644--- a/Emby.Server.Implementations/Session/SessionManager.cs+++ b/Emby.Server.Implementations/Session/SessionManager.cs@@ -200,7 +200,7 @@ namespace Emby.Server.Implementations.Session{var capabilities = _deviceManager.GetCapabilities(info.DeviceId);- if (capabilities != null)+ if (capabilities is not null){ReportCapabilities(info, capabilities, false);}@@ -238,7 +238,7 @@ namespace Emby.Server.Implementations.Sessionpublic void UpdateDeviceName(string sessionId, string reportedDeviceName){var session = GetSession(sessionId);- if (session != null)+ if (session is not null){session.DeviceName = reportedDeviceName;}@@ -284,7 +284,7 @@ namespace Emby.Server.Implementations.Sessionvar lastActivityDate = session.LastActivityDate;session.LastActivityDate = activityDate;- if (user != null)+ if (user is not null){var userLastActivityDate = user.LastActivityDate ?? DateTime.MinValue;@@ -351,7 +351,7 @@ namespace Emby.Server.Implementations.SessionCheckDisposed();var session = GetSession(sessionId, false);- if (session != null)+ if (session is not null){var key = GetSessionKey(session.Client, session.DeviceId);@@ -377,7 +377,7 @@ namespace Emby.Server.Implementations.Sessioninfo.MediaSourceId = info.ItemId.ToString("N", CultureInfo.InvariantCulture);}- if (!info.ItemId.Equals(default) && info.Item is null && libraryItem != null)+ if (!info.ItemId.Equals(default) && info.Item is null && libraryItem is not null){var current = session.NowPlayingItem;@@ -390,7 +390,7 @@ namespace Emby.Server.Implementations.Session{mediaSource = await GetMediaSource(libraryItem, info.MediaSourceId, info.LiveStreamId).ConfigureAwait(false);- if (mediaSource != null)+ if (mediaSource is not null){runtimeTicks = mediaSource.RunTimeTicks;}@@ -579,7 +579,7 @@ namespace Emby.Server.Implementations.Sessionusers.AddRange(session.AdditionalUsers.Select(i => _userManager.GetUserById(i.UserId))- .Where(i => i != null));+ .Where(i => i is not null));return users;}@@ -591,7 +591,7 @@ namespace Emby.Server.Implementations.Sessionprivate void StopIdleCheckTimer(){- if (_idleTimer != null)+ if (_idleTimer is not null){_idleTimer.Dispose();_idleTimer = null;@@ -600,7 +600,7 @@ namespace Emby.Server.Implementations.Sessionprivate async void CheckForIdlePlayback(object state){- var playingSessions = Sessions.Where(i => i.NowPlayingItem != null)+ var playingSessions = Sessions.Where(i => i.NowPlayingItem is not null).ToList();if (playingSessions.Count > 0)@@ -630,7 +630,7 @@ namespace Emby.Server.Implementations.Session}}- playingSessions = Sessions.Where(i => i.NowPlayingItem != null)+ playingSessions = Sessions.Where(i => i.NowPlayingItem is not null).ToList();}@@ -643,7 +643,7 @@ namespace Emby.Server.Implementations.Sessionprivate BaseItem GetNowPlayingItem(SessionInfo session, Guid itemId){var item = session.FullNowPlayingItem;- if (item != null && item.Id.Equals(itemId))+ if (item is not null && item.Id.Equals(itemId)){return item;}@@ -684,7 +684,7 @@ namespace Emby.Server.Implementations.Sessionvar users = GetUsers(session);- if (libraryItem != null)+ if (libraryItem is not null){foreach (var user in users){@@ -777,7 +777,7 @@ namespace Emby.Server.Implementations.Sessionvar users = GetUsers(session);// only update saved user data on actual check-ins, not automated ones- if (libraryItem != null && !isAutomated)+ if (libraryItem is not null && !isAutomated){foreach (var user in users){@@ -912,7 +912,7 @@ namespace Emby.Server.Implementations.Sessioninfo.MediaSourceId = info.ItemId.ToString("N", CultureInfo.InvariantCulture);}- if (!info.ItemId.Equals(default) && info.Item is null && libraryItem != null)+ if (!info.ItemId.Equals(default) && info.Item is null && libraryItem is not null){var current = session.NowPlayingItem;@@ -933,7 +933,7 @@ namespace Emby.Server.Implementations.Session}}- if (info.Item != null)+ if (info.Item is not null){var msString = info.PositionTicks.HasValue ? (info.PositionTicks.Value / 10000).ToString(CultureInfo.InvariantCulture) : "unknown";@@ -945,7 +945,7 @@ namespace Emby.Server.Implementations.SessionmsString);}- if (info.NowPlayingQueue != null)+ if (info.NowPlayingQueue is not null){session.NowPlayingQueue = info.NowPlayingQueue;}@@ -957,7 +957,7 @@ namespace Emby.Server.Implementations.Sessionvar users = GetUsers(session);var playedToCompletion = false;- if (libraryItem != null)+ if (libraryItem is not null){foreach (var user in users){@@ -1164,7 +1164,7 @@ namespace Emby.Server.Implementations.Sessioncommand.ItemIds = items.Select(i => i.Id).ToArray();- if (user != null)+ if (user is not null){if (items.Any(i => i.GetPlayAccess(user) != PlayAccess.Full)){@@ -1173,13 +1173,13 @@ namespace Emby.Server.Implementations.Session}}- if (user != null+ if (user is not null&& command.ItemIds.Length == 1&& user.EnableNextEpisodeAutoPlay&& _libraryManager.GetItemById(command.ItemIds[0]) is Episode episode){var series = episode.Series;- if (series != null)+ if (series is not null){var episodes = series.GetEpisodes(user,@@ -1429,7 +1429,7 @@ namespace Emby.Server.Implementations.Sessionvar user = session.AdditionalUsers.FirstOrDefault(i => i.UserId.Equals(userId));- if (user != null)+ if (user is not null){var list = session.AdditionalUsers.ToList();list.Remove(user);@@ -1554,7 +1554,7 @@ namespace Emby.Server.Implementations.Session}}- if (existing != null)+ if (existing is not null){_logger.LogInformation("Reissuing access token: {Token}", existing.AccessToken);return existing.AccessToken;@@ -1720,7 +1720,7 @@ namespace Emby.Server.Implementations.Sessionvar info = _dtoService.GetBaseItemDto(item, dtoOptions);- if (mediaSource != null)+ if (mediaSource is not null){info.MediaStreams = mediaSource.MediaStreams.ToArray();}@@ -1761,7 +1761,7 @@ namespace Emby.Server.Implementations.Sessionvar session = Sessions.FirstOrDefault(i =>string.Equals(i.DeviceId, deviceId, StringComparison.OrdinalIgnoreCase));- if (session != null)+ if (session is not null){session.TranscodingInfo = info;}diff --git a/Emby.Server.Implementations/Session/SessionWebSocketListener.cs b/Emby.Server.Implementations/Session/SessionWebSocketListener.csindex bab934578a..aebb559073 100644--- a/Emby.Server.Implementations/Session/SessionWebSocketListener.cs+++ b/Emby.Server.Implementations/Session/SessionWebSocketListener.cs@@ -94,7 +94,7 @@ namespace Emby.Server.Implementations.Sessionpublic async Task ProcessWebSocketConnectedAsync(IWebSocketConnection connection, HttpContext httpContext){var session = await GetSession(httpContext, connection.RemoteEndPoint?.ToString()).ConfigureAwait(false);- if (session != null)+ if (session is not null){EnsureController(session, connection);await KeepAliveWebSocket(connection).ConfigureAwait(false);@@ -221,7 +221,7 @@ namespace Emby.Server.Implementations.Session{lock (_keepAliveLock){- if (_keepAliveCancellationToken != null)+ if (_keepAliveCancellationToken is not null){_keepAliveCancellationToken.Cancel();_keepAliveCancellationToken.Dispose();diff --git a/Emby.Server.Implementations/Sorting/DatePlayedComparer.cs b/Emby.Server.Implementations/Sorting/DatePlayedComparer.csindex ec818253be..453d817c76 100644--- a/Emby.Server.Implementations/Sorting/DatePlayedComparer.cs+++ b/Emby.Server.Implementations/Sorting/DatePlayedComparer.cs@@ -58,7 +58,7 @@ namespace Emby.Server.Implementations.Sorting{var userdata = UserDataRepository.GetUserData(User, x);- if (userdata != null && userdata.LastPlayedDate.HasValue)+ if (userdata is not null && userdata.LastPlayedDate.HasValue){return userdata.LastPlayedDate.Value;}diff --git a/Emby.Server.Implementations/SyncPlay/Group.cs b/Emby.Server.Implementations/SyncPlay/Group.csindex ef2a4ef77e..7d7ea58106 100644--- a/Emby.Server.Implementations/SyncPlay/Group.cs+++ b/Emby.Server.Implementations/SyncPlay/Group.cs@@ -251,7 +251,7 @@ namespace Emby.Server.Implementations.SyncPlayGroupName = request.GroupName;AddSession(session);- var sessionIsPlayingAnItem = session.FullNowPlayingItem != null;+ var sessionIsPlayingAnItem = session.FullNowPlayingItem is not null;RestartCurrentItem();diff --git a/Emby.Server.Implementations/TV/TVSeriesManager.cs b/Emby.Server.Implementations/TV/TVSeriesManager.csindex 57fa57c592..967f90b55f 100644--- a/Emby.Server.Implementations/TV/TVSeriesManager.cs+++ b/Emby.Server.Implementations/TV/TVSeriesManager.cs@@ -62,7 +62,7 @@ namespace Emby.Server.Implementations.TV{var parent = _libraryManager.GetItemById(query.ParentId.Value);- if (parent != null)+ if (parent is not null){parents = new[] { parent };}@@ -168,7 +168,7 @@ namespace Emby.Server.Implementations.TVreturn !anyFound && i.LastWatchedDate == DateTime.MinValue;}).Select(i => i.GetEpisodeFunction())- .Where(i => i != null);+ .Where(i => i is not null);}private static string GetUniqueSeriesKey(Episode episode)@@ -247,23 +247,23 @@ namespace Emby.Server.Implementations.TVDtoOptions = dtoOptions}).Cast<Episode>()- .Where(episode => episode.AirsBeforeSeasonNumber != null || episode.AirsAfterSeasonNumber != null)+ .Where(episode => episode.AirsBeforeSeasonNumber is not null || episode.AirsAfterSeasonNumber is not null).ToList();- if (lastWatchedEpisode != null)+ if (lastWatchedEpisode is not null){// Last watched episode is added, because there could be specials that aired before the last watched episodeconsideredEpisodes.Add(lastWatchedEpisode);}- if (nextEpisode != null)+ if (nextEpisode is not null){consideredEpisodes.Add(nextEpisode);}var sortedConsideredEpisodes = _libraryManager.Sort(consideredEpisodes, user, new[] { (ItemSortBy.AiredEpisodeOrder, SortOrder.Ascending) }).Cast<Episode>();- if (lastWatchedEpisode != null)+ if (lastWatchedEpisode is not null){sortedConsideredEpisodes = sortedConsideredEpisodes.SkipWhile(episode => !episode.Id.Equals(lastWatchedEpisode.Id)).Skip(1);}@@ -271,7 +271,7 @@ namespace Emby.Server.Implementations.TVnextEpisode = sortedConsideredEpisodes.FirstOrDefault();}- if (nextEpisode != null)+ if (nextEpisode is not null){var userData = _userDataManager.GetUserData(user, nextEpisode);@@ -284,7 +284,7 @@ namespace Emby.Server.Implementations.TVreturn nextEpisode;}- if (lastWatchedEpisode != null)+ if (lastWatchedEpisode is not null){var userData = _userDataManager.GetUserData(user, lastWatchedEpisode);diff --git a/Emby.Server.Implementations/Updates/InstallationManager.cs b/Emby.Server.Implementations/Updates/InstallationManager.csindex 84489b6466..5e897833e0 100644--- a/Emby.Server.Implementations/Updates/InstallationManager.cs+++ b/Emby.Server.Implementations/Updates/InstallationManager.cs@@ -168,7 +168,7 @@ namespace Emby.Server.Implementations.Updatesvar result = new List<PackageInfo>();foreach (RepositoryInfo repository in _config.Configuration.PluginRepositories){- if (repository.Enabled && repository.Url != null)+ if (repository.Enabled && repository.Url is not null){// Where repositories have the same content, the details from the first is taken.foreach (var package in await GetPackages(repository.Name ?? "Unnamed Repo", repository.Url, true, cancellationToken).ConfigureAwait(true))@@ -181,7 +181,7 @@ namespace Emby.Server.Implementations.Updatesvar version = package.Versions[i];var plugin = _pluginManager.GetPlugin(package.Id, version.VersionNumber);- if (plugin != null)+ if (plugin is not null){await _pluginManager.GenerateManifest(package, version.VersionNumber, plugin.Path, plugin.Manifest.Status).ConfigureAwait(false);}@@ -199,7 +199,7 @@ namespace Emby.Server.Implementations.Updatescontinue;}- if (existing != null)+ if (existing is not null){// Assumption is both lists are ordered, so slot these into the correct place.MergeSortedList(existing.Versions, package.Versions);@@ -222,7 +222,7 @@ namespace Emby.Server.Implementations.UpdatesGuid id = default,Version? specificVersion = null){- if (name != null)+ if (name is not null){availablePackages = availablePackages.Where(x => x.Name.Equals(name, StringComparison.OrdinalIgnoreCase));}@@ -232,7 +232,7 @@ namespace Emby.Server.Implementations.UpdatesavailablePackages = availablePackages.Where(x => x.Id.Equals(id));}- if (specificVersion != null)+ if (specificVersion is not null){availablePackages = availablePackages.Where(x => x.Versions.Any(y => y.VersionNumber.Equals(specificVersion)));}@@ -260,11 +260,11 @@ namespace Emby.Server.Implementations.Updatesvar availableVersions = package.Versions.Where(x => string.IsNullOrEmpty(x.TargetAbi) || Version.Parse(x.TargetAbi) <= appVer);- if (specificVersion != null)+ if (specificVersion is not null){availableVersions = availableVersions.Where(x => x.VersionNumber.Equals(specificVersion));}- else if (minVersion != null)+ else if (minVersion is not null){availableVersions = availableVersions.Where(x => x.VersionNumber >= minVersion);}@@ -495,7 +495,7 @@ namespace Emby.Server.Implementations.Updatesvar compatibleVersions = GetCompatibleVersions(pluginCatalog, plugin.Name, plugin.Id, minVersion: plugin.Version);var version = compatibleVersions.FirstOrDefault(y => y.Version > plugin.Version);- if (version != null && CompletedInstallations.All(x => !x.Id.Equals(version.Id)))+ if (version is not null && CompletedInstallations.All(x => !x.Id.Equals(version.Id))){yield return version;}@@ -567,7 +567,7 @@ namespace Emby.Server.Implementations.Updatesawait PerformPackageInstallation(package, plugin?.Manifest.Status ?? PluginStatus.Active, cancellationToken).ConfigureAwait(false);_logger.LogInformation("Plugin {Action}: {PluginName} {PluginVersion}", plugin is null ? "installed" : "updated", package.Name, package.Version);- return plugin != null;+ return plugin is not null;}}}diff --git a/Jellyfin.Api/Auth/BaseAuthorizationHandler.cs b/Jellyfin.Api/Auth/BaseAuthorizationHandler.csindex 630bb7037a..8e5e66d64a 100644--- a/Jellyfin.Api/Auth/BaseAuthorizationHandler.cs+++ b/Jellyfin.Api/Auth/BaseAuthorizationHandler.cs@@ -78,7 +78,7 @@ namespace Jellyfin.Api.Authreturn false;}- var isInLocalNetwork = _httpContextAccessor.HttpContext != null+ var isInLocalNetwork = _httpContextAccessor.HttpContext is not null&& _networkManager.IsInLocalNetwork(_httpContextAccessor.HttpContext.GetNormalizedRemoteIp());// User cannot access remotely and user is remotediff --git a/Jellyfin.Api/Controllers/ArtistsController.cs b/Jellyfin.Api/Controllers/ArtistsController.csindex c059cb198a..c8ac2ed526 100644--- a/Jellyfin.Api/Controllers/ArtistsController.cs+++ b/Jellyfin.Api/Controllers/ArtistsController.cs@@ -183,7 +183,7 @@ namespace Jellyfin.Api.Controllers{return null;}- }).Where(i => i != null).Select(i => i!.Id).ToArray();+ }).Where(i => i is not null).Select(i => i!.Id).ToArray();}foreach (var filter in filters)@@ -386,7 +386,7 @@ namespace Jellyfin.Api.Controllers{return null;}- }).Where(i => i != null).Select(i => i!.Id).ToArray();+ }).Where(i => i is not null).Select(i => i!.Id).ToArray();}foreach (var filter in filters)diff --git a/Jellyfin.Api/Controllers/DynamicHlsController.cs b/Jellyfin.Api/Controllers/DynamicHlsController.csindex afe0de6302..af43bb578e 100644--- a/Jellyfin.Api/Controllers/DynamicHlsController.cs+++ b/Jellyfin.Api/Controllers/DynamicHlsController.cs@@ -341,7 +341,7 @@ namespace Jellyfin.Api.Controllersjob ??= _transcodingJobHelper.OnTranscodeBeginRequest(playlistPath, TranscodingJobType);- if (job != null)+ if (job is not null){_transcodingJobHelper.OnTranscodeEndRequest(job);}@@ -1533,7 +1533,7 @@ namespace Jellyfin.Api.Controllerselse{job = _transcodingJobHelper.OnTranscodeBeginRequest(playlistPath, TranscodingJobType);- if (job?.TranscodingThrottler != null)+ if (job?.TranscodingThrottler is not null){await job.TranscodingThrottler.UnpauseTranscoding().ConfigureAwait(false);}@@ -1806,7 +1806,7 @@ namespace Jellyfin.Api.Controllersif (EncodingHelper.IsCopyCodec(codec)){// If h264_mp4toannexb is ever added, do not use it for live tv.- if (state.VideoStream != null && !string.Equals(state.VideoStream.NalLengthSize, "0", StringComparison.OrdinalIgnoreCase))+ if (state.VideoStream is not null && !string.Equals(state.VideoStream.NalLengthSize, "0", StringComparison.OrdinalIgnoreCase)){string bitStreamArgs = EncodingHelper.GetBitStreamArgs(state.VideoStream);if (!string.IsNullOrEmpty(bitStreamArgs))@@ -1837,7 +1837,7 @@ namespace Jellyfin.Api.Controllers// -start_at_zero is necessary to use with -ss when seeking,// otherwise the target position cannot be determined.- if (state.SubtitleStream != null)+ if (state.SubtitleStream is not null){// Disable start_at_zero for external graphical subsif (!(state.SubtitleStream.IsExternal && !state.SubtitleStream.IsTextSubtitleStream))@@ -1883,7 +1883,7 @@ namespace Jellyfin.Api.Controllersvar segmentExists = System.IO.File.Exists(segmentPath);if (segmentExists){- if (transcodingJob != null && transcodingJob.HasExited)+ if (transcodingJob is not null && transcodingJob.HasExited){// Transcoding job is over, so assume all existing files are ready_logger.LogDebug("serving up {0} as transcode is over", segmentPath);@@ -1901,7 +1901,7 @@ namespace Jellyfin.Api.Controllers}var nextSegmentPath = GetSegmentPath(state, playlistPath, segmentIndex + 1);- if (transcodingJob != null)+ if (transcodingJob is not null){while (!cancellationToken.IsCancellationRequested && !transcodingJob.HasExited){@@ -1953,7 +1953,7 @@ namespace Jellyfin.Api.ControllersResponse.OnCompleted(() =>{_logger.LogDebug("Finished serving {SegmentPath}", segmentPath);- if (transcodingJob != null)+ if (transcodingJob is not null){transcodingJob.DownloadPositionTicks = Math.Max(transcodingJob.DownloadPositionTicks ?? segmentEndingPositionTicks, segmentEndingPositionTicks);_transcodingJobHelper.OnTranscodeEndRequest(transcodingJob);@@ -2011,7 +2011,7 @@ namespace Jellyfin.Api.Controllers{var file = GetLastTranscodingFile(playlistPath, segmentExtension, _fileSystem);- if (file != null)+ if (file is not null){DeleteFile(file.FullName, retryCount);}diff --git a/Jellyfin.Api/Controllers/HlsSegmentController.cs b/Jellyfin.Api/Controllers/HlsSegmentController.csindex 8e78d5a1af..50fee233a8 100644--- a/Jellyfin.Api/Controllers/HlsSegmentController.cs+++ b/Jellyfin.Api/Controllers/HlsSegmentController.cs@@ -178,7 +178,7 @@ namespace Jellyfin.Api.ControllersResponse.OnCompleted(() =>{- if (transcodingJob != null)+ if (transcodingJob is not null){_transcodingJobHelper.OnTranscodeEndRequest(transcodingJob);}diff --git a/Jellyfin.Api/Controllers/ImageController.cs b/Jellyfin.Api/Controllers/ImageController.csindex adcac8e974..260b9536e3 100644--- a/Jellyfin.Api/Controllers/ImageController.cs+++ b/Jellyfin.Api/Controllers/ImageController.cs@@ -110,7 +110,7 @@ namespace Jellyfin.Api.Controllers// Handle image/png; charset=utf-8var mimeType = Request.ContentType?.Split(';').FirstOrDefault();var userDataPath = Path.Combine(_serverConfigurationManager.ApplicationPaths.UserConfigurationDirectoryPath, user.Username);- if (user.ProfileImage != null)+ if (user.ProfileImage is not null){await _userManager.ClearProfileImageAsync(user).ConfigureAwait(false);}@@ -157,7 +157,7 @@ namespace Jellyfin.Api.Controllers// Handle image/png; charset=utf-8var mimeType = Request.ContentType?.Split(';').FirstOrDefault();var userDataPath = Path.Combine(_serverConfigurationManager.ApplicationPaths.UserConfigurationDirectoryPath, user.Username);- if (user.ProfileImage != null)+ if (user.ProfileImage is not null){await _userManager.ClearProfileImageAsync(user).ConfigureAwait(false);}@@ -452,7 +452,7 @@ namespace Jellyfin.Api.Controllers{var info = GetImageInfo(item, image, null);- if (info != null)+ if (info is not null){list.Add(info);}@@ -470,7 +470,7 @@ namespace Jellyfin.Api.Controllers{var info = GetImageInfo(item, image, index);- if (info != null)+ if (info is not null){list.Add(info);}@@ -1968,7 +1968,7 @@ namespace Jellyfin.Api.Controllers{ "realTimeInfo.dlna.org", "DLNA.ORG_TLAG=*" }};- if (!imageInfo.IsLocalFile && item != null)+ if (!imageInfo.IsLocalFile && item is not null){imageInfo = await _libraryManager.ConvertImageToLocal(item, imageInfo, imageIndex ?? 0).ConfigureAwait(false);}diff --git a/Jellyfin.Api/Controllers/ItemUpdateController.cs b/Jellyfin.Api/Controllers/ItemUpdateController.csindex 5f992f0335..af3d779f56 100644--- a/Jellyfin.Api/Controllers/ItemUpdateController.cs+++ b/Jellyfin.Api/Controllers/ItemUpdateController.cs@@ -80,13 +80,13 @@ namespace Jellyfin.Api.Controllersvar isLockedChanged = item.IsLocked != newLockData;var series = item as Series;- var displayOrderChanged = series != null && !string.Equals(+ var displayOrderChanged = series is not null && !string.Equals(series.DisplayOrder ?? string.Empty,request.DisplayOrder ?? string.Empty,StringComparison.OrdinalIgnoreCase);// Do this first so that metadata savers can pull the updates from the database.- if (request.People != null)+ if (request.People is not null){_libraryManager.UpdatePeople(item,@@ -248,12 +248,12 @@ namespace Jellyfin.Api.Controllersitem.Tags = request.Tags;- if (request.Taglines != null)+ if (request.Taglines is not null){item.Tagline = request.Taglines.FirstOrDefault();}- if (request.Studios != null)+ if (request.Studios is not null){item.Studios = request.Studios.Select(x => x.Name).ToArray();}@@ -269,7 +269,7 @@ namespace Jellyfin.Api.Controllersitem.OfficialRating = string.IsNullOrWhiteSpace(request.OfficialRating) ? null : request.OfficialRating;item.CustomRating = request.CustomRating;- if (request.ProductionLocations != null)+ if (request.ProductionLocations is not null){item.ProductionLocations = request.ProductionLocations;}@@ -289,7 +289,7 @@ namespace Jellyfin.Api.Controllersitem.IsLocked = request.LockData ?? false;- if (request.LockedFields != null)+ if (request.LockedFields is not null){item.LockedFields = request.LockedFields;}@@ -315,7 +315,7 @@ namespace Jellyfin.Api.Controllersvideo.Video3DFormat = request.Video3DFormat;}- if (request.AlbumArtists != null)+ if (request.AlbumArtists is not null){if (item is IHasAlbumArtist hasAlbumArtists){@@ -326,7 +326,7 @@ namespace Jellyfin.Api.Controllers}}- if (request.ArtistItems != null)+ if (request.ArtistItems is not null){if (item is IHasArtist hasArtists){@@ -349,7 +349,7 @@ namespace Jellyfin.Api.Controllers{series.Status = GetSeriesStatus(request);- if (request.AirDays != null)+ if (request.AirDays is not null){series.AirDays = request.AirDays;series.AirTime = request.AirTime;diff --git a/Jellyfin.Api/Controllers/ItemsController.cs b/Jellyfin.Api/Controllers/ItemsController.csindex 3ee5b8d737..717ddc32b3 100644--- a/Jellyfin.Api/Controllers/ItemsController.cs+++ b/Jellyfin.Api/Controllers/ItemsController.cs@@ -447,7 +447,7 @@ namespace Jellyfin.Api.Controllers{return null;}- }).Where(i => i != null).Select(i => i!.Id).ToArray();+ }).Where(i => i is not null).Select(i => i!.Id).ToArray();}// ExcludeArtistIds@@ -483,7 +483,7 @@ namespace Jellyfin.Api.Controllers{return null;}- }).Where(i => i != null).Select(i => i!.Id).ToArray();+ }).Where(i => i is not null).Select(i => i!.Id).ToArray();}// Apply default sorting if none requested@@ -837,7 +837,7 @@ namespace Jellyfin.Api.Controllersif (excludeActiveSessions){excludeItemIds = _sessionManager.Sessions- .Where(s => s.UserId.Equals(userId) && s.NowPlayingItem != null)+ .Where(s => s.UserId.Equals(userId) && s.NowPlayingItem is not null).Select(s => s.NowPlayingItem.Id).ToArray();}diff --git a/Jellyfin.Api/Controllers/LibraryController.cs b/Jellyfin.Api/Controllers/LibraryController.csindex 80d1c008b5..ab20208302 100644--- a/Jellyfin.Api/Controllers/LibraryController.cs+++ b/Jellyfin.Api/Controllers/LibraryController.cs@@ -449,9 +449,9 @@ namespace Jellyfin.Api.Controllersvar dtoOptions = new DtoOptions().AddClientFields(User);BaseItem? parent = item.GetParent();- while (parent != null)+ while (parent is not null){- if (user != null)+ if (user is not null){parent = TranslateParentItem(parent, user);}@@ -617,7 +617,7 @@ namespace Jellyfin.Api.Controllersvar user = _userManager.GetUserById(User.GetUserId());- if (user != null)+ if (user is not null){if (!item.CanDownload(user)){@@ -632,7 +632,7 @@ namespace Jellyfin.Api.Controllers}}- if (user != null)+ if (user is not null){await LogDownloadAsync(item, user).ConfigureAwait(false);}@@ -686,8 +686,8 @@ namespace Jellyfin.Api.Controllers.AddClientFields(User);var program = item as IHasProgramAttributes;- bool? isMovie = item is Movie || (program != null && program.IsMovie) || item is Trailer;- bool? isSeries = item is Series || (program != null && program.IsSeries);+ bool? isMovie = item is Movie || (program is not null && program.IsMovie) || item is Trailer;+ bool? isSeries = item is Series || (program is not null && program.IsSeries);var includeItemTypes = new List<BaseItemKind>();if (isMovie.Value)diff --git a/Jellyfin.Api/Controllers/LibraryStructureController.cs b/Jellyfin.Api/Controllers/LibraryStructureController.csindex ec1170411c..1c23940556 100644--- a/Jellyfin.Api/Controllers/LibraryStructureController.cs+++ b/Jellyfin.Api/Controllers/LibraryStructureController.cs@@ -82,7 +82,7 @@ namespace Jellyfin.Api.Controllers{var libraryOptions = libraryOptionsDto?.LibraryOptions ?? new LibraryOptions();- if (paths != null && paths.Length > 0)+ if (paths is not null && paths.Length > 0){libraryOptions.PathInfos = paths.Select(i => new MediaPathInfo(i)).ToArray();}diff --git a/Jellyfin.Api/Controllers/MediaInfoController.cs b/Jellyfin.Api/Controllers/MediaInfoController.csindex be6453af95..8115c35852 100644--- a/Jellyfin.Api/Controllers/MediaInfoController.cs+++ b/Jellyfin.Api/Controllers/MediaInfoController.cs@@ -124,7 +124,7 @@ namespace Jellyfin.Api.Controllersif (profile is null){var caps = _deviceManager.GetCapabilities(User.GetDeviceId());- if (caps != null)+ if (caps is not null){profile = caps.DeviceProfile;}@@ -154,12 +154,12 @@ namespace Jellyfin.Api.ControllersliveStreamId).ConfigureAwait(false);- if (info.ErrorCode != null)+ if (info.ErrorCode is not null){return info;}- if (profile != null)+ if (profile is not null){// set device specific datavar item = _libraryManager.GetItemById(itemId);@@ -194,7 +194,7 @@ namespace Jellyfin.Api.Controllers{var mediaSource = string.IsNullOrWhiteSpace(mediaSourceId) ? info.MediaSources[0] : info.MediaSources.FirstOrDefault(i => string.Equals(i.Id, mediaSourceId, StringComparison.Ordinal));- if (mediaSource != null && mediaSource.RequiresOpening && string.IsNullOrWhiteSpace(mediaSource.LiveStreamId))+ if (mediaSource is not null && mediaSource.RequiresOpening && string.IsNullOrWhiteSpace(mediaSource.LiveStreamId)){var openStreamResult = await _mediaInfoHelper.OpenMediaSource(HttpContext,diff --git a/Jellyfin.Api/Controllers/PluginsController.cs b/Jellyfin.Api/Controllers/PluginsController.csindex 361828fbd7..6a729b2373 100644--- a/Jellyfin.Api/Controllers/PluginsController.cs+++ b/Jellyfin.Api/Controllers/PluginsController.cs@@ -148,7 +148,7 @@ namespace Jellyfin.Api.Controllers// Select the un-instanced one first.var plugin = plugins.FirstOrDefault(p => p.Instance is null) ?? plugins.OrderBy(p => p.Manifest.Status).FirstOrDefault();- if (plugin != null)+ if (plugin is not null){_installationManager.UninstallPlugin(plugin);return NoContent();@@ -202,7 +202,7 @@ namespace Jellyfin.Api.Controllersvar configuration = (BasePluginConfiguration?)await JsonSerializer.DeserializeAsync(Request.Body, configPlugin.ConfigurationType, _serializerOptions).ConfigureAwait(false);- if (configuration != null)+ if (configuration is not null){configPlugin.UpdateConfiguration(configuration);}@@ -254,7 +254,7 @@ namespace Jellyfin.Api.Controllers{var plugin = _pluginManager.GetPlugin(pluginId);- if (plugin != null)+ if (plugin is not null){return plugin.Manifest;}diff --git a/Jellyfin.Api/Controllers/SearchController.cs b/Jellyfin.Api/Controllers/SearchController.csindex 3c0603a19a..3b7719f373 100644--- a/Jellyfin.Api/Controllers/SearchController.cs+++ b/Jellyfin.Api/Controllers/SearchController.cs@@ -161,7 +161,7 @@ namespace Jellyfin.Api.Controllersvar primaryImageTag = _imageProcessor.GetImageCacheTag(item, ImageType.Primary);- if (primaryImageTag != null)+ if (primaryImageTag is not null){result.PrimaryImageTag = primaryImageTag;result.PrimaryImageAspectRatio = _dtoService.GetPrimaryImageAspectRatio(item);@@ -195,7 +195,7 @@ namespace Jellyfin.Api.ControllersMusicAlbum musicAlbum = song.AlbumEntity;- if (musicAlbum != null)+ if (musicAlbum is not null){result.Album = musicAlbum.Name;result.AlbumId = musicAlbum.Id;@@ -228,11 +228,11 @@ namespace Jellyfin.Api.ControllersitemWithImage ??= GetParentWithImage<BaseItem>(item, ImageType.Thumb);- if (itemWithImage != null)+ if (itemWithImage is not null){var tag = _imageProcessor.GetImageCacheTag(itemWithImage, ImageType.Thumb);- if (tag != null)+ if (tag is not null){hint.ThumbImageTag = tag;hint.ThumbImageItemId = itemWithImage.Id.ToString("N", CultureInfo.InvariantCulture);@@ -245,11 +245,11 @@ namespace Jellyfin.Api.Controllersvar itemWithImage = (item.HasImage(ImageType.Backdrop) ? item : null)?? GetParentWithImage<BaseItem>(item, ImageType.Backdrop);- if (itemWithImage != null)+ if (itemWithImage is not null){var tag = _imageProcessor.GetImageCacheTag(itemWithImage, ImageType.Backdrop);- if (tag != null)+ if (tag is not null){hint.BackdropImageTag = tag;hint.BackdropImageItemId = itemWithImage.Id.ToString("N", CultureInfo.InvariantCulture);diff --git a/Jellyfin.Api/Controllers/StartupController.cs b/Jellyfin.Api/Controllers/StartupController.csindex c49bde93f1..eec5779e64 100644--- a/Jellyfin.Api/Controllers/StartupController.cs+++ b/Jellyfin.Api/Controllers/StartupController.cs@@ -132,7 +132,7 @@ namespace Jellyfin.Api.Controllers{var user = _userManager.Users.First();- if (startupUserDto.Name != null)+ if (startupUserDto.Name is not null){user.Username = startupUserDto.Name;}diff --git a/Jellyfin.Api/Controllers/SubtitleController.cs b/Jellyfin.Api/Controllers/SubtitleController.csindex b9c2a8ad8e..ff9bd095b5 100644--- a/Jellyfin.Api/Controllers/SubtitleController.cs+++ b/Jellyfin.Api/Controllers/SubtitleController.cs@@ -522,7 +522,7 @@ namespace Jellyfin.Api.Controllers.First(i => string.Equals(i.Name, name, StringComparison.OrdinalIgnoreCase));var fileSize = fontFile?.Length;- if (fontFile != null && fileSize != null && fileSize > 0)+ if (fontFile is not null && fileSize is not null && fileSize > 0){_logger.LogDebug("Fallback font size is {FileSize} Bytes", fileSize);return PhysicalFile(fontFile.FullName, MimeTypes.GetMimeType(fontFile.FullName));diff --git a/Jellyfin.Api/Controllers/UserController.cs b/Jellyfin.Api/Controllers/UserController.csindex 4ee3361b5b..002327d741 100644--- a/Jellyfin.Api/Controllers/UserController.cs+++ b/Jellyfin.Api/Controllers/UserController.cs@@ -477,7 +477,7 @@ namespace Jellyfin.Api.Controllersvar newUser = await _userManager.CreateUserAsync(request.Name).ConfigureAwait(false);// no need to authenticate password for new user- if (request.Password != null)+ if (request.Password is not null){await _userManager.ChangePassword(newUser, request.Password).ConfigureAwait(false);}diff --git a/Jellyfin.Api/Controllers/UserLibraryController.cs b/Jellyfin.Api/Controllers/UserLibraryController.csindex 60e1906164..c18fa29af6 100644--- a/Jellyfin.Api/Controllers/UserLibraryController.cs+++ b/Jellyfin.Api/Controllers/UserLibraryController.cs@@ -306,7 +306,7 @@ namespace Jellyfin.Api.Controllersvar item = i.Item2[0];var childCount = 0;- if (i.Item1 != null && (i.Item2.Count > 1 || i.Item1 is MusicAlbum))+ if (i.Item1 is not null && (i.Item2.Count > 1 || i.Item1 is MusicAlbum)){item = i.Item1;childCount = i.Item2.Count;diff --git a/Jellyfin.Api/Controllers/VideosController.cs b/Jellyfin.Api/Controllers/VideosController.csindex 17e5567305..64d8fb498b 100644--- a/Jellyfin.Api/Controllers/VideosController.cs+++ b/Jellyfin.Api/Controllers/VideosController.cs@@ -439,7 +439,7 @@ namespace Jellyfin.Api.ControllerscancellationTokenSource.Token).ConfigureAwait(false);- if (@static.HasValue && @static.Value && state.DirectStreamProvider != null)+ if (@static.HasValue && @static.Value && state.DirectStreamProvider is not null){StreamingHelpers.AddDlnaHeaders(state, Response.Headers, true, state.Request.StartTimeTicks, Request, _dlnaManager);@@ -472,7 +472,7 @@ namespace Jellyfin.Api.Controllersvar outputPathExists = System.IO.File.Exists(outputPath);var transcodingJob = _transcodingJobHelper.GetTranscodingJob(outputPath, TranscodingJobType.Progressive);- var isTranscodeCached = outputPathExists && transcodingJob != null;+ var isTranscodeCached = outputPathExists && transcodingJob is not null;StreamingHelpers.AddDlnaHeaders(state, Response.Headers, (@static.HasValue && @static.Value) || isTranscodeCached, state.Request.StartTimeTicks, Request, _dlnaManager);diff --git a/Jellyfin.Api/Controllers/YearsController.cs b/Jellyfin.Api/Controllers/YearsController.csindex f8193f19a5..cd85ba221b 100644--- a/Jellyfin.Api/Controllers/YearsController.cs+++ b/Jellyfin.Api/Controllers/YearsController.cs@@ -152,7 +152,7 @@ namespace Jellyfin.Api.Controllersvar result = new QueryResult<BaseItemDto>(startIndex,ibnItemsArray.Count,- dtos.Where(i => i != null).ToArray());+ dtos.Where(i => i is not null).ToArray());return result;}diff --git a/Jellyfin.Api/Helpers/AudioHelper.cs b/Jellyfin.Api/Helpers/AudioHelper.csindex 5c5a2fc348..be410ebcd6 100644--- a/Jellyfin.Api/Helpers/AudioHelper.cs+++ b/Jellyfin.Api/Helpers/AudioHelper.cs@@ -111,7 +111,7 @@ namespace Jellyfin.Api.HelperscancellationTokenSource.Token).ConfigureAwait(false);- if (streamingRequest.Static && state.DirectStreamProvider != null)+ if (streamingRequest.Static && state.DirectStreamProvider is not null){StreamingHelpers.AddDlnaHeaders(state, _httpContextAccessor.HttpContext.Response.Headers, true, streamingRequest.StartTimeTicks, _httpContextAccessor.HttpContext.Request, _dlnaManager);@@ -144,7 +144,7 @@ namespace Jellyfin.Api.Helpersvar outputPathExists = File.Exists(outputPath);var transcodingJob = _transcodingJobHelper.GetTranscodingJob(outputPath, TranscodingJobType.Progressive);- var isTranscodeCached = outputPathExists && transcodingJob != null;+ var isTranscodeCached = outputPathExists && transcodingJob is not null;StreamingHelpers.AddDlnaHeaders(state, _httpContextAccessor.HttpContext.Response.Headers, streamingRequest.Static || isTranscodeCached, streamingRequest.StartTimeTicks, _httpContextAccessor.HttpContext.Request, _dlnaManager);diff --git a/Jellyfin.Api/Helpers/DynamicHlsHelper.cs b/Jellyfin.Api/Helpers/DynamicHlsHelper.csindex 904021a86c..010b181f70 100644--- a/Jellyfin.Api/Helpers/DynamicHlsHelper.cs+++ b/Jellyfin.Api/Helpers/DynamicHlsHelper.cs@@ -183,7 +183,7 @@ namespace Jellyfin.Api.Helpers: null;// If we're burning in subtitles then don't add additional subs to the manifest- if (state.SubtitleStream != null && state.SubtitleDeliveryMethod == SubtitleDeliveryMethod.Encode)+ if (state.SubtitleStream is not null && state.SubtitleDeliveryMethod == SubtitleDeliveryMethod.Encode){subtitleGroup = null;}@@ -195,7 +195,7 @@ namespace Jellyfin.Api.Helpersvar basicPlaylist = AppendPlaylist(builder, state, playlistUrl, totalBitrate, subtitleGroup);- if (state.VideoStream != null && state.VideoRequest != null)+ if (state.VideoStream is not null && state.VideoRequest is not null){// Provide a workaround for the case issue between flac and fLaC.var flacWaPlaylist = ApplyFlacCaseWorkaround(state, basicPlaylist.ToString());@@ -211,7 +211,7 @@ namespace Jellyfin.Api.Helpers&& string.Equals(state.ActualOutputVideoCodec, "hevc", StringComparison.OrdinalIgnoreCase)){var requestedVideoProfiles = state.GetRequestedProfiles("hevc");- if (requestedVideoProfiles != null && requestedVideoProfiles.Length > 0)+ if (requestedVideoProfiles is not null && requestedVideoProfiles.Length > 0){// Force HEVC Main Profile and disable video stream copy.state.OutputVideoCodec = "hevc";@@ -327,7 +327,7 @@ namespace Jellyfin.Api.Helpers/// <param name="state">StreamState of the current stream.</param>private void AppendPlaylistVideoRangeField(StringBuilder builder, StreamState state){- if (state.VideoStream != null && !string.IsNullOrEmpty(state.VideoStream.VideoRange))+ if (state.VideoStream is not null && !string.IsNullOrEmpty(state.VideoStream.VideoRange)){var videoRange = state.VideoStream.VideoRange;if (EncodingHelper.IsCopyCodec(state.OutputVideoCodec))@@ -425,7 +425,7 @@ namespace Jellyfin.Api.Helpers{framerate = Math.Round(state.TargetFramerate.GetValueOrDefault(), 3);}- else if (state.VideoStream?.RealFrameRate != null)+ else if (state.VideoStream?.RealFrameRate is not null){framerate = Math.Round(state.VideoStream.RealFrameRate.GetValueOrDefault(), 3);}@@ -523,7 +523,7 @@ namespace Jellyfin.Api.Helpers{string levelString = string.Empty;if (EncodingHelper.IsCopyCodec(state.OutputVideoCodec)- && state.VideoStream != null+ && state.VideoStream is not null&& state.VideoStream.Level.HasValue){levelString = state.VideoStream.Level.ToString() ?? string.Empty;diff --git a/Jellyfin.Api/Helpers/MediaInfoHelper.cs b/Jellyfin.Api/Helpers/MediaInfoHelper.csindex 6134fb7274..e8ce1ca2a2 100644--- a/Jellyfin.Api/Helpers/MediaInfoHelper.cs+++ b/Jellyfin.Api/Helpers/MediaInfoHelper.cs@@ -127,7 +127,7 @@ namespace Jellyfin.Api.Helpers// Since we're going to be setting properties on MediaSourceInfos that come out of _mediaSourceManager, we should clone it// Should we move this directly into MediaSourceManager?var mediaSourcesClone = JsonSerializer.Deserialize<MediaSourceInfo[]>(JsonSerializer.SerializeToUtf8Bytes(mediaSources));- if (mediaSourcesClone != null)+ if (mediaSourcesClone is not null){result.MediaSources = mediaSourcesClone;}@@ -247,7 +247,7 @@ namespace Jellyfin.Api.Helpers? streamBuilder.BuildAudioItem(options): streamBuilder.BuildVideoItem(options);- if (streamInfo != null)+ if (streamInfo is not null){streamInfo.PlaySessionId = playSessionId;streamInfo.StartPositionTicks = startTimeTicks;@@ -262,7 +262,7 @@ namespace Jellyfin.Api.HelpersmediaSource.SupportsTranscoding =streamInfo.PlayMethod == PlayMethod.DirectStream- || mediaSource.TranscodingContainer != null+ || mediaSource.TranscodingContainer is not null|| profile.TranscodingProfiles.Any(i => i.Type == streamInfo.MediaType && i.Context == options.Context);if (item is Audio)@@ -393,13 +393,13 @@ namespace Jellyfin.Api.Helpersif (profile is null){var clientCapabilities = _deviceManager.GetCapabilities(httpContext.User.GetDeviceId());- if (clientCapabilities != null)+ if (clientCapabilities is not null){profile = clientCapabilities.DeviceProfile;}}- if (profile != null)+ if (profile is not null){var item = _libraryManager.GetItemById(request.ItemId);@@ -431,7 +431,7 @@ namespace Jellyfin.Api.Helpers}}- // here was a check if (result.MediaSource != null) but Rider said it will never be null+ // here was a check if (result.MediaSource is not null) but Rider said it will never be nullNormalizeMediaSourceContainer(result.MediaSource, profile!, DlnaProfileType.Video);return result;diff --git a/Jellyfin.Api/Helpers/ProgressiveFileStream.cs b/Jellyfin.Api/Helpers/ProgressiveFileStream.csindex 6f5b64ea8b..dfeeea2b0e 100644--- a/Jellyfin.Api/Helpers/ProgressiveFileStream.cs+++ b/Jellyfin.Api/Helpers/ProgressiveFileStream.cs@@ -151,7 +151,7 @@ namespace Jellyfin.Api.Helpers{_stream.Dispose();- if (_job != null)+ if (_job is not null){_transcodingJobHelper?.OnTranscodeEndRequest(_job);}@@ -166,7 +166,7 @@ namespace Jellyfin.Api.Helpersprivate void UpdateBytesWritten(int totalBytesRead){- if (_job != null)+ if (_job is not null){_job.BytesDownloaded += totalBytesRead;}diff --git a/Jellyfin.Api/Helpers/StreamingHelpers.cs b/Jellyfin.Api/Helpers/StreamingHelpers.csindex 5e01b7dccb..1decbcd923 100644--- a/Jellyfin.Api/Helpers/StreamingHelpers.cs+++ b/Jellyfin.Api/Helpers/StreamingHelpers.cs@@ -137,7 +137,7 @@ namespace Jellyfin.Api.Helpers? transcodingJobHelper.GetTranscodingJob(streamingRequest.PlaySessionId): null;- if (currentJob != null)+ if (currentJob is not null){mediaSource = currentJob.MediaSource;}@@ -189,7 +189,7 @@ namespace Jellyfin.Api.Helpersstate.OutputAudioChannels = encodingHelper.GetNumAudioChannelsParam(state, state.AudioStream, state.OutputAudioCodec);- if (state.VideoRequest != null)+ if (state.VideoRequest is not null){state.OutputVideoCodec = state.Request.VideoCodec;state.OutputVideoBitrate = encodingHelper.GetVideoBitrateParamValue(state.VideoRequest, state.VideoStream, state.OutputVideoCodec);@@ -204,7 +204,7 @@ namespace Jellyfin.Api.Helpers&& !state.VideoRequest.MaxHeight.HasValue;if (isVideoResolutionNotRequested- && state.VideoStream != null+ && state.VideoStream is not null&& state.VideoRequest.VideoBitRate.HasValue&& state.VideoStream.BitRate.HasValue&& state.VideoRequest.VideoBitRate.Value >= state.VideoStream.BitRate.Value)@@ -281,7 +281,7 @@ namespace Jellyfin.Api.HelpersConvert.ToInt32(ms)));}- if (!isStaticallyStreamed && profile != null)+ if (!isStaticallyStreamed && profile is not null){AddTimeSeekResponseHeaders(state, responseHeaders, startTimeTicks);}@@ -553,7 +553,7 @@ namespace Jellyfin.Api.Helpersstate.TargetVideoCodecTag,state.IsTargetAVC);- if (mediaProfile != null)+ if (mediaProfile is not null){state.MimeType = mediaProfile.MimeType;}@@ -562,13 +562,13 @@ namespace Jellyfin.Api.Helpers{var transcodingProfile = !state.IsVideoRequest ? profile.GetAudioTranscodingProfile(state.OutputContainer, audioCodec) : profile.GetVideoTranscodingProfile(state.OutputContainer, audioCodec, videoCodec);- if (transcodingProfile != null)+ if (transcodingProfile is not null){state.EstimateContentLength = transcodingProfile.EstimateContentLength;// state.EnableMpegtsM2TsMode = transcodingProfile.EnableMpegtsM2TsMode;state.TranscodeSeekInfo = transcodingProfile.TranscodeSeekInfo;- if (state.VideoRequest != null)+ if (state.VideoRequest is not null){state.VideoRequest.CopyTimestamps = transcodingProfile.CopyTimestamps;state.VideoRequest.EnableSubtitlesInManifest = transcodingProfile.EnableSubtitlesInManifest;@@ -616,7 +616,7 @@ namespace Jellyfin.Api.Helpersrequest.Static = string.Equals("true", val, StringComparison.OrdinalIgnoreCase);break;case 4:- if (videoRequest != null)+ if (videoRequest is not null){videoRequest.VideoCodec = val;}@@ -626,21 +626,21 @@ namespace Jellyfin.Api.Helpersrequest.AudioCodec = val;break;case 6:- if (videoRequest != null)+ if (videoRequest is not null){videoRequest.AudioStreamIndex = int.Parse(val, CultureInfo.InvariantCulture);}break;case 7:- if (videoRequest != null)+ if (videoRequest is not null){videoRequest.SubtitleStreamIndex = int.Parse(val, CultureInfo.InvariantCulture);}break;case 8:- if (videoRequest != null)+ if (videoRequest is not null){videoRequest.VideoBitRate = int.Parse(val, CultureInfo.InvariantCulture);}@@ -653,21 +653,21 @@ namespace Jellyfin.Api.Helpersrequest.MaxAudioChannels = int.Parse(val, CultureInfo.InvariantCulture);break;case 11:- if (videoRequest != null)+ if (videoRequest is not null){videoRequest.MaxFramerate = float.Parse(val, CultureInfo.InvariantCulture);}break;case 12:- if (videoRequest != null)+ if (videoRequest is not null){videoRequest.MaxWidth = int.Parse(val, CultureInfo.InvariantCulture);}break;case 13:- if (videoRequest != null)+ if (videoRequest is not null){videoRequest.MaxHeight = int.Parse(val, CultureInfo.InvariantCulture);}@@ -677,28 +677,28 @@ namespace Jellyfin.Api.Helpersrequest.StartTimeTicks = long.Parse(val, CultureInfo.InvariantCulture);break;case 15:- if (videoRequest != null)+ if (videoRequest is not null){videoRequest.Level = val;}break;case 16:- if (videoRequest != null)+ if (videoRequest is not null){videoRequest.MaxRefFrames = int.Parse(val, CultureInfo.InvariantCulture);}break;case 17:- if (videoRequest != null)+ if (videoRequest is not null){videoRequest.MaxVideoBitDepth = int.Parse(val, CultureInfo.InvariantCulture);}break;case 18:- if (videoRequest != null)+ if (videoRequest is not null){videoRequest.Profile = val;}@@ -720,14 +720,14 @@ namespace Jellyfin.Api.Helpers// Duplicating ItemId because of MediaMonkeybreak;case 24:- if (videoRequest != null)+ if (videoRequest is not null){videoRequest.CopyTimestamps = string.Equals("true", val, StringComparison.OrdinalIgnoreCase);}break;case 25:- if (!string.IsNullOrWhiteSpace(val) && videoRequest != null)+ if (!string.IsNullOrWhiteSpace(val) && videoRequest is not null){if (Enum.TryParse(val, out SubtitleDeliveryMethod method)){@@ -740,7 +740,7 @@ namespace Jellyfin.Api.Helpersrequest.TranscodingMaxAudioChannels = int.Parse(val, CultureInfo.InvariantCulture);break;case 27:- if (videoRequest != null)+ if (videoRequest is not null){videoRequest.EnableSubtitlesInManifest = string.Equals("true", val, StringComparison.OrdinalIgnoreCase);}@@ -750,7 +750,7 @@ namespace Jellyfin.Api.Helpersrequest.Tag = val;break;case 29:- if (videoRequest != null)+ if (videoRequest is not null){videoRequest.RequireAvc = string.Equals("true", val, StringComparison.OrdinalIgnoreCase);}@@ -760,14 +760,14 @@ namespace Jellyfin.Api.Helpersrequest.SubtitleCodec = val;break;case 31:- if (videoRequest != null)+ if (videoRequest is not null){videoRequest.RequireNonAnamorphic = string.Equals("true", val, StringComparison.OrdinalIgnoreCase);}break;case 32:- if (videoRequest != null)+ if (videoRequest is not null){videoRequest.DeInterlace = string.Equals("true", val, StringComparison.OrdinalIgnoreCase);}diff --git a/Jellyfin.Api/Helpers/TranscodingJobHelper.cs b/Jellyfin.Api/Helpers/TranscodingJobHelper.csindex 592f22d8dd..cb3442ccb8 100644--- a/Jellyfin.Api/Helpers/TranscodingJobHelper.cs+++ b/Jellyfin.Api/Helpers/TranscodingJobHelper.cs@@ -416,7 +416,7 @@ namespace Jellyfin.Api.Helpers}}- if (exs != null)+ if (exs is not null){throw new AggregateException("Error deleting HLS files", exs);}@@ -443,7 +443,7 @@ namespace Jellyfin.Api.Helpers{var ticks = transcodingPosition?.Ticks;- if (job != null)+ if (job is not null){job.Framerate = framerate;job.CompletionPercentage = percentComplete;@@ -510,11 +510,11 @@ namespace Jellyfin.Api.Helpersawait AcquireResources(state, cancellationTokenSource).ConfigureAwait(false);- if (state.VideoRequest != null && !EncodingHelper.IsCopyCodec(state.OutputVideoCodec))+ if (state.VideoRequest is not null && !EncodingHelper.IsCopyCodec(state.OutputVideoCodec)){var userId = request.HttpContext.User.GetUserId();var user = userId.Equals(default) ? null : _userManager.GetUserById(userId);- if (user != null && !user.HasPermission(PermissionKind.EnableVideoPlaybackTranscoding))+ if (user is not null && !user.HasPermission(PermissionKind.EnableVideoPlaybackTranscoding)){this.OnTranscodeFailedToStart(outputPath, transcodingJobType, state);@@ -528,7 +528,7 @@ namespace Jellyfin.Api.Helpers}// If subtitles get burned in fonts may need to be extracted from the media file- if (state.SubtitleStream != null && state.SubtitleDeliveryMethod == SubtitleDeliveryMethod.Encode)+ if (state.SubtitleStream is not null && state.SubtitleDeliveryMethod == SubtitleDeliveryMethod.Encode){var attachmentPath = Path.Combine(_appPaths.CachePath, "attachments", state.MediaSource.Id);await _attachmentExtractor.ExtractAllAttachments(state.MediaPath, state.MediaSource, attachmentPath, cancellationTokenSource.Token).ConfigureAwait(false);@@ -577,7 +577,7 @@ namespace Jellyfin.Api.Helpers_logger.LogInformation("{Filename} {Arguments}", process.StartInfo.FileName, process.StartInfo.Arguments);var logFilePrefix = "FFmpeg.Transcode-";- if (state.VideoRequest != null+ if (state.VideoRequest is not null&& EncodingHelper.IsCopyCodec(state.OutputVideoCodec)){logFilePrefix = EncodingHelper.IsCopyCodec(state.OutputAudioCodec)@@ -748,7 +748,7 @@ namespace Jellyfin.Api.Helpers{var job = _activeTranscodingJobs.FirstOrDefault(j => j.Type == type && string.Equals(j.Path, path, StringComparison.OrdinalIgnoreCase));- if (job != null)+ if (job is not null){_activeTranscodingJobs.Remove(job);}@@ -805,7 +805,7 @@ namespace Jellyfin.Api.Helpers_encodingHelper.AttachMediaSourceInfo(state, encodingOptions, liveStreamResponse.MediaSource, state.RequestedUrl);- if (state.VideoRequest != null)+ if (state.VideoRequest is not null){_encodingHelper.TryStreamCopy(state);}diff --git a/Jellyfin.Api/ModelBinders/CommaDelimitedArrayModelBinder.cs b/Jellyfin.Api/ModelBinders/CommaDelimitedArrayModelBinder.csindex c04f3c721b..75e47a71be 100644--- a/Jellyfin.Api/ModelBinders/CommaDelimitedArrayModelBinder.cs+++ b/Jellyfin.Api/ModelBinders/CommaDelimitedArrayModelBinder.cs@@ -40,7 +40,7 @@ namespace Jellyfin.Api.ModelBinders{var value = valueProviderResult.FirstValue;- if (value != null)+ if (value is not null){var splitValues = value.Split(',', StringSplitOptions.RemoveEmptyEntries);var typedValues = GetParsedResult(splitValues, elementType, converter);diff --git a/Jellyfin.Api/ModelBinders/PipeDelimitedArrayModelBinder.cs b/Jellyfin.Api/ModelBinders/PipeDelimitedArrayModelBinder.csindex 639ab07930..4257ba0e23 100644--- a/Jellyfin.Api/ModelBinders/PipeDelimitedArrayModelBinder.cs+++ b/Jellyfin.Api/ModelBinders/PipeDelimitedArrayModelBinder.cs@@ -40,7 +40,7 @@ namespace Jellyfin.Api.ModelBinders{var value = valueProviderResult.FirstValue;- if (value != null)+ if (value is not null){var splitValues = value.Split('|', StringSplitOptions.RemoveEmptyEntries);var typedValues = GetParsedResult(splitValues, elementType, converter);diff --git a/Jellyfin.Api/Models/PlaybackDtos/TranscodingJobDto.cs b/Jellyfin.Api/Models/PlaybackDtos/TranscodingJobDto.csindex bb0f51936f..9060500c8b 100644--- a/Jellyfin.Api/Models/PlaybackDtos/TranscodingJobDto.cs+++ b/Jellyfin.Api/Models/PlaybackDtos/TranscodingJobDto.cs@@ -189,7 +189,7 @@ namespace Jellyfin.Api.Models.PlaybackDtos{lock (_timerLock){- if (KillTimer != null)+ if (KillTimer is not null){KillTimer.Dispose();KillTimer = null;@@ -245,7 +245,7 @@ namespace Jellyfin.Api.Models.PlaybackDtoslock (_timerLock){- if (KillTimer != null)+ if (KillTimer is not null){var intervalMs = PingTimeout;diff --git a/Jellyfin.Api/Models/PlaybackDtos/TranscodingThrottler.cs b/Jellyfin.Api/Models/PlaybackDtos/TranscodingThrottler.csindex 99376873c0..9c4e377cde 100644--- a/Jellyfin.Api/Models/PlaybackDtos/TranscodingThrottler.cs+++ b/Jellyfin.Api/Models/PlaybackDtos/TranscodingThrottler.cs@@ -210,7 +210,7 @@ namespace Jellyfin.Api.Models.PlaybackDtosprivate void DisposeTimer(){- if (_timer != null)+ if (_timer is not null){_timer.Dispose();_timer = null;diff --git a/Jellyfin.Api/Models/StreamingDtos/StreamState.cs b/Jellyfin.Api/Models/StreamingDtos/StreamState.csindex 8182e3c9e8..1fce1d20a3 100644--- a/Jellyfin.Api/Models/StreamingDtos/StreamState.cs+++ b/Jellyfin.Api/Models/StreamingDtos/StreamState.cs@@ -43,7 +43,7 @@ namespace Jellyfin.Api.Models.StreamingDtosset{BaseRequest = value;- IsVideoRequest = VideoRequest != null;+ IsVideoRequest = VideoRequest is not null;}}diff --git a/Jellyfin.Data/Entities/User.cs b/Jellyfin.Data/Entities/User.csindex e2cd659e74..58d0510cdb 100644--- a/Jellyfin.Data/Entities/User.cs+++ b/Jellyfin.Data/Entities/User.cs@@ -419,7 +419,7 @@ namespace Jellyfin.Data.Entitiestry{var parsedValue = converter.ConvertFromString(stringValues[i].Trim());- if (parsedValue != null)+ if (parsedValue is not null){parsedValues[convertedCount++] = (T)parsedValue;}diff --git a/Jellyfin.Drawing.Skia/SkiaEncoder.cs b/Jellyfin.Drawing.Skia/SkiaEncoder.csindex 02b69398e1..3099725995 100644--- a/Jellyfin.Drawing.Skia/SkiaEncoder.cs+++ b/Jellyfin.Drawing.Skia/SkiaEncoder.cs@@ -274,7 +274,7 @@ namespace Jellyfin.Drawing.Skia{var bitmap = Decode(path, true, orientation, out var origin);- if (bitmap != null && origin != SKEncodedOrigin.TopLeft)+ if (bitmap is not null && origin != SKEncodedOrigin.TopLeft){using (bitmap){diff --git a/Jellyfin.Drawing.Skia/SkiaHelper.cs b/Jellyfin.Drawing.Skia/SkiaHelper.csindex 0478fc7c31..23e92dcb2d 100644--- a/Jellyfin.Drawing.Skia/SkiaHelper.cs+++ b/Jellyfin.Drawing.Skia/SkiaHelper.cs@@ -34,7 +34,7 @@ namespace Jellyfin.Drawing.SkiacurrentIndex++;- if (bitmap != null)+ if (bitmap is not null){break;}diff --git a/Jellyfin.Networking/Manager/NetworkManager.cs b/Jellyfin.Networking/Manager/NetworkManager.csindex 519b681615..366428e78e 100644--- a/Jellyfin.Networking/Manager/NetworkManager.cs+++ b/Jellyfin.Networking/Manager/NetworkManager.cs@@ -161,7 +161,7 @@ namespace Jellyfin.Networking.Managerpublic static Collection<IPObject> CreateCollection(IEnumerable<IPObject>? source = null){var result = new Collection<IPObject>();- if (source != null)+ if (source is not null){foreach (var item in source){@@ -225,7 +225,7 @@ namespace Jellyfin.Networking.Manager/// <inheritdoc/>public bool IsExcluded(EndPoint ip){- return ip != null && IsExcluded(((IPEndPoint)ip).Address);+ return ip is not null && IsExcluded(((IPEndPoint)ip).Address);}/// <inheritdoc/>@@ -335,7 +335,7 @@ namespace Jellyfin.Networking.Manager{string result;- if (source != null && IPHost.TryParse(source.Host.Host, out IPHost host))+ if (source is not null && IPHost.TryParse(source.Host.Host, out IPHost host)){result = GetBindInterface(host, out port);port ??= source.Host.Port;@@ -538,7 +538,7 @@ namespace Jellyfin.Networking.Managerreturn false;}- if (_interfaceNames != null && _interfaceNames.TryGetValue(token.ToLower(CultureInfo.InvariantCulture), out int index))+ if (_interfaceNames is not null && _interfaceNames.TryGetValue(token.ToLower(CultureInfo.InvariantCulture), out int index)){result = new Collection<IPObject>();@@ -718,7 +718,7 @@ namespace Jellyfin.Networking.Manager// Is it the name of an interface (windows) eg, Wireless LAN adapter Wireless Network Connection 1.// Null check required here for automated testing.- if (_interfaceNames != null && token.Length > 1)+ if (_interfaceNames is not null && token.Length > 1){bool partial = token[^1] == '*';if (partial)@@ -737,7 +737,7 @@ namespace Jellyfin.Networking.Manager}}- return index != null;+ return index is not null;}/// <summary>@@ -903,7 +903,7 @@ namespace Jellyfin.Networking.Manager{_publishedServerUrls[new IPNetAddress(IPAddress.Any)] = replacement;}- else if (TryParseInterface(parts[0], out Collection<IPObject>? addresses) && addresses != null)+ else if (TryParseInterface(parts[0], out Collection<IPObject>? addresses) && addresses is not null){foreach (IPNetAddress na in addresses){@@ -1052,7 +1052,7 @@ namespace Jellyfin.Networking.ManagerPhysicalAddress mac = adapter.GetPhysicalAddress();// populate mac list- if (adapter.NetworkInterfaceType != NetworkInterfaceType.Loopback && mac != null && mac != PhysicalAddress.None)+ if (adapter.NetworkInterfaceType != NetworkInterfaceType.Loopback && mac is not null && mac != PhysicalAddress.None){_macAddresses.Add(mac);}@@ -1245,7 +1245,7 @@ namespace Jellyfin.Networking.ManagerbindAddress = addr.Address;}- if (defaultGateway != null && bindAddress != null)+ if (defaultGateway is not null && bindAddress is not null){break;}@@ -1260,14 +1260,14 @@ namespace Jellyfin.Networking.Manager.FirstOrDefault()?.Address;}- if (bindAddress != null)+ if (bindAddress is not null){result = FormatIP6String(bindAddress);_logger.LogDebug("{Source}: GetBindInterface: Has source, found a match bind interface subnets. {Result}", source, result);return true;}- if (isInExternalSubnet && defaultGateway != null)+ if (isInExternalSubnet && defaultGateway is not null){result = FormatIP6String(defaultGateway);_logger.LogDebug("{Source}: GetBindInterface: Using first user defined external interface. {Result}", source, result);diff --git a/Jellyfin.Server.Implementations/Devices/DeviceManager.cs b/Jellyfin.Server.Implementations/Devices/DeviceManager.csindex 321a16d475..bbe33be389 100644--- a/Jellyfin.Server.Implementations/Devices/DeviceManager.cs+++ b/Jellyfin.Server.Implementations/Devices/DeviceManager.cs@@ -139,12 +139,12 @@ namespace Jellyfin.Server.Implementations.Devicesdevices = devices.Where(device => device.UserId.Equals(query.UserId.Value));}- if (query.DeviceId != null)+ if (query.DeviceId is not null){devices = devices.Where(device => device.DeviceId == query.DeviceId);}- if (query.AccessToken != null)+ if (query.AccessToken is not null){devices = devices.Where(device => device.AccessToken == query.AccessToken);}diff --git a/Jellyfin.Server.Implementations/Events/Consumers/Session/PlaybackStartLogger.cs b/Jellyfin.Server.Implementations/Events/Consumers/Session/PlaybackStartLogger.csindex bb98a6c342..aeb62e814c 100644--- a/Jellyfin.Server.Implementations/Events/Consumers/Session/PlaybackStartLogger.cs+++ b/Jellyfin.Server.Implementations/Events/Consumers/Session/PlaybackStartLogger.cs@@ -44,7 +44,7 @@ namespace Jellyfin.Server.Implementations.Events.Consumers.Sessionreturn;}- if (eventArgs.Item != null && eventArgs.Item.IsThemeMedia)+ if (eventArgs.Item is not null && eventArgs.Item.IsThemeMedia){// Don't report theme song or local trailer playbackreturn;@@ -78,7 +78,7 @@ namespace Jellyfin.Server.Implementations.Events.Consumers.Sessionname = item.SeriesName + " - " + name;}- if (item.Artists != null && item.Artists.Count > 0)+ if (item.Artists is not null && item.Artists.Count > 0){name = item.Artists[0] + " - " + name;}diff --git a/Jellyfin.Server.Implementations/Events/Consumers/Session/PlaybackStopLogger.cs b/Jellyfin.Server.Implementations/Events/Consumers/Session/PlaybackStopLogger.csindex baa957390a..dd7290fb84 100644--- a/Jellyfin.Server.Implementations/Events/Consumers/Session/PlaybackStopLogger.cs+++ b/Jellyfin.Server.Implementations/Events/Consumers/Session/PlaybackStopLogger.cs@@ -46,7 +46,7 @@ namespace Jellyfin.Server.Implementations.Events.Consumers.Sessionreturn;}- if (eventArgs.Item != null && eventArgs.Item.IsThemeMedia)+ if (eventArgs.Item is not null && eventArgs.Item.IsThemeMedia){// Don't report theme song or local trailer playbackreturn;@@ -86,7 +86,7 @@ namespace Jellyfin.Server.Implementations.Events.Consumers.Sessionname = item.SeriesName + " - " + name;}- if (item.Artists != null && item.Artists.Count > 0)+ if (item.Artists is not null && item.Artists.Count > 0){name = item.Artists[0] + " - " + name;}diff --git a/Jellyfin.Server.Implementations/Security/AuthorizationContext.cs b/Jellyfin.Server.Implementations/Security/AuthorizationContext.csindex 4d1a1b3cf8..ec5742bab0 100644--- a/Jellyfin.Server.Implementations/Security/AuthorizationContext.cs+++ b/Jellyfin.Server.Implementations/Security/AuthorizationContext.cs@@ -32,7 +32,7 @@ namespace Jellyfin.Server.Implementations.Securitypublic Task<AuthorizationInfo> GetAuthorizationInfo(HttpContext requestContext){- if (requestContext.Request.HttpContext.Items.TryGetValue("AuthorizationInfo", out var cached) && cached != null)+ if (requestContext.Request.HttpContext.Items.TryGetValue("AuthorizationInfo", out var cached) && cached is not null){return Task.FromResult((AuthorizationInfo)cached); // Cache should never contain null}@@ -72,7 +72,7 @@ namespace Jellyfin.Server.Implementations.Securitystring? version = null;string? token = null;- if (auth != null)+ if (auth is not null){auth.TryGetValue("DeviceId", out deviceId);auth.TryGetValue("Device", out deviceName);@@ -127,7 +127,7 @@ namespace Jellyfin.Server.Implementations.Security{var device = await dbContext.Devices.FirstOrDefaultAsync(d => d.AccessToken == token).ConfigureAwait(false);- if (device != null)+ if (device is not null){authInfo.IsAuthenticated = true;var updateToken = false;@@ -189,7 +189,7 @@ namespace Jellyfin.Server.Implementations.Securityelse{var key = await dbContext.ApiKeys.FirstOrDefaultAsync(apiKey => apiKey.AccessToken == token).ConfigureAwait(false);- if (key != null)+ if (key is not null){authInfo.IsAuthenticated = true;authInfo.Client = key.Name;diff --git a/Jellyfin.Server.Implementations/Users/UserManager.cs b/Jellyfin.Server.Implementations/Users/UserManager.csindex 131853aed4..ae3fcad29b 100644--- a/Jellyfin.Server.Implementations/Users/UserManager.cs+++ b/Jellyfin.Server.Implementations/Users/UserManager.cs@@ -286,7 +286,7 @@ namespace Jellyfin.Server.Implementations.Users/// <inheritdoc/>public async Task ChangeEasyPassword(User user, string newPassword, string? newPasswordSha1){- if (newPassword != null)+ if (newPassword is not null){newPasswordSha1 = _cryptoProvider.CreatePasswordHash(newPassword).ToString();}@@ -317,7 +317,7 @@ namespace Jellyfin.Server.Implementations.UsersEnableAutoLogin = user.EnableAutoLogin,LastLoginDate = user.LastLoginDate,LastActivityDate = user.LastActivityDate,- PrimaryImageTag = user.ProfileImage != null ? _imageProcessor.GetImageCacheTag(user) : null,+ PrimaryImageTag = user.ProfileImage is not null ? _imageProcessor.GetImageCacheTag(user) : null,Configuration = new UserConfiguration{SubtitleMode = user.SubtitleMode,@@ -406,7 +406,7 @@ namespace Jellyfin.Server.Implementations.Usersstring updatedUsername = authResult.Username;if (success- && authenticationProvider != null+ && authenticationProvider is not null&& authenticationProvider is not DefaultAuthenticationProvider){// Trust the username returned by the authentication provider@@ -416,18 +416,18 @@ namespace Jellyfin.Server.Implementations.Users// the authentication provider might have created ituser = Users.FirstOrDefault(i => string.Equals(username, i.Username, StringComparison.OrdinalIgnoreCase));- if (authenticationProvider is IHasNewUserPolicy hasNewUserPolicy && user != null)+ if (authenticationProvider is IHasNewUserPolicy hasNewUserPolicy && user is not null){await UpdatePolicyAsync(user.Id, hasNewUserPolicy.GetNewUserPolicy()).ConfigureAwait(false);}}}- if (success && user != null && authenticationProvider != null)+ if (success && user is not null && authenticationProvider is not null){var providerId = authenticationProvider.GetType().FullName;- if (providerId != null && !string.Equals(providerId, user.AuthenticationProviderId, StringComparison.OrdinalIgnoreCase))+ if (providerId is not null && !string.Equals(providerId, user.AuthenticationProviderId, StringComparison.OrdinalIgnoreCase)){user.AuthenticationProviderId = providerId;await UpdateUserAsync(user).ConfigureAwait(false);@@ -501,7 +501,7 @@ namespace Jellyfin.Server.Implementations.Users{var user = string.IsNullOrWhiteSpace(enteredUsername) ? null : GetUserByName(enteredUsername);- if (user != null && isInNetwork)+ if (user is not null && isInNetwork){var passwordResetProvider = GetPasswordResetProvider(user);var result = await passwordResetProviderdiff --git a/Jellyfin.Server/Filters/SecurityRequirementsOperationFilter.cs b/Jellyfin.Server/Filters/SecurityRequirementsOperationFilter.csindex 077908895f..4af670e9a0 100644--- a/Jellyfin.Server/Filters/SecurityRequirementsOperationFilter.cs+++ b/Jellyfin.Server/Filters/SecurityRequirementsOperationFilter.cs@@ -22,7 +22,7 @@ namespace Jellyfin.Server.Filtersforeach (var attribute in context.MethodInfo.GetCustomAttributes(true)){if (attribute is AuthorizeAttribute authorizeAttribute- && authorizeAttribute.Policy != null+ && authorizeAttribute.Policy is not null&& !requiredScopes.Contains(authorizeAttribute.Policy, StringComparer.Ordinal)){requiredScopes.Add(authorizeAttribute.Policy);@@ -31,12 +31,12 @@ namespace Jellyfin.Server.Filters// Add controller scopes if any.var controllerAttributes = context.MethodInfo.DeclaringType?.GetCustomAttributes(true);- if (controllerAttributes != null)+ if (controllerAttributes is not null){foreach (var attribute in controllerAttributes){if (attribute is AuthorizeAttribute authorizeAttribute- && authorizeAttribute.Policy != null+ && authorizeAttribute.Policy is not null&& !requiredScopes.Contains(authorizeAttribute.Policy, StringComparer.Ordinal)){requiredScopes.Add(authorizeAttribute.Policy);diff --git a/Jellyfin.Server/Infrastructure/SymlinkFollowingPhysicalFileResultExecutor.cs b/Jellyfin.Server/Infrastructure/SymlinkFollowingPhysicalFileResultExecutor.csindex bb264d5127..fd68975ff8 100644--- a/Jellyfin.Server/Infrastructure/SymlinkFollowingPhysicalFileResultExecutor.cs+++ b/Jellyfin.Server/Infrastructure/SymlinkFollowingPhysicalFileResultExecutor.cs@@ -72,7 +72,7 @@ namespace Jellyfin.Server.InfrastructureArgumentNullException.ThrowIfNull(context);ArgumentNullException.ThrowIfNull(result);- if (range != null && rangeLength == 0)+ if (range is not null && rangeLength == 0){return Task.CompletedTask;}@@ -85,7 +85,7 @@ namespace Jellyfin.Server.Infrastructurevar response = context.HttpContext.Response;- if (range != null)+ if (range is not null){return SendFileAsync(result.FileName,diff --git a/Jellyfin.Server/Middleware/ExceptionMiddleware.cs b/Jellyfin.Server/Middleware/ExceptionMiddleware.csindex db7877c31e..91dbce19a4 100644--- a/Jellyfin.Server/Middleware/ExceptionMiddleware.cs+++ b/Jellyfin.Server/Middleware/ExceptionMiddleware.cs@@ -105,7 +105,7 @@ namespace Jellyfin.Server.Middlewareif (ex is AggregateException agg){var inner = agg.InnerException;- if (inner != null)+ if (inner is not null){return GetActualException(inner);}diff --git a/Jellyfin.Server/Middleware/QueryStringDecodingMiddleware.cs b/Jellyfin.Server/Middleware/QueryStringDecodingMiddleware.csindex cdd86e28e6..24807ce383 100644--- a/Jellyfin.Server/Middleware/QueryStringDecodingMiddleware.cs+++ b/Jellyfin.Server/Middleware/QueryStringDecodingMiddleware.cs@@ -28,7 +28,7 @@ namespace Jellyfin.Server.Middlewarepublic async Task Invoke(HttpContext httpContext){var feature = httpContext.Features.Get<IQueryFeature>();- if (feature != null)+ if (feature is not null){httpContext.Features.Set<IQueryFeature>(new UrlDecodeQueryFeature(feature));}diff --git a/Jellyfin.Server/Program.cs b/Jellyfin.Server/Program.csindex b0455aafb3..0b922f8210 100644--- a/Jellyfin.Server/Program.cs+++ b/Jellyfin.Server/Program.cs@@ -234,7 +234,7 @@ namespace Jellyfin.Serverfinally{// Don't throw additional exception if startup failed.- if (appHost.ServiceProvider != null)+ if (appHost.ServiceProvider is not null){_logger.LogInformation("Running query planner optimizations in the database... This might take a while");// Run before disposing the application@@ -407,7 +407,7 @@ namespace Jellyfin.Serverif (string.IsNullOrEmpty(configDir)){- if (options.DataDir != null+ if (options.DataDir is not null|| Directory.Exists(Path.Combine(dataDir, "config"))|| OperatingSystem.IsWindows()){@@ -582,7 +582,7 @@ namespace Jellyfin.Server{// Use the swagger API page as the default redirect path if not hosting the web clientvar inMemoryDefaultConfig = ConfigurationOptions.DefaultConfiguration;- if (startupConfig != null && !startupConfig.HostWebClient())+ if (startupConfig is not null && !startupConfig.HostWebClient()){inMemoryDefaultConfig[DefaultRedirectKey] = "api-docs/swagger";}@@ -642,7 +642,7 @@ namespace Jellyfin.Server}string commandLineArgsString;- if (options.RestartArgs != null)+ if (options.RestartArgs is not null){commandLineArgsString = options.RestartArgs;}diff --git a/Jellyfin.Server/StartupOptions.cs b/Jellyfin.Server/StartupOptions.csindex 84ebde68c0..0a6f9bd920 100644--- a/Jellyfin.Server/StartupOptions.cs+++ b/Jellyfin.Server/StartupOptions.cs@@ -88,12 +88,12 @@ namespace Jellyfin.Serverconfig.Add(HostWebClientKey, bool.FalseString);}- if (PublishedServerUrl != null)+ if (PublishedServerUrl is not null){config.Add(AddressOverrideKey, PublishedServerUrl);}- if (FFmpegPath != null)+ if (FFmpegPath is not null){config.Add(FfmpegPathKey, FFmpegPath);}diff --git a/MediaBrowser.Common/Events/EventHelper.cs b/MediaBrowser.Common/Events/EventHelper.csindex a9cf86fbc3..0e495f4fa3 100644--- a/MediaBrowser.Common/Events/EventHelper.cs+++ b/MediaBrowser.Common/Events/EventHelper.cs@@ -19,7 +19,7 @@ namespace MediaBrowser.Common.Events/// <param name="logger">The logger.</param>public static void QueueEventIfNotNull(EventHandler? handler, object sender, EventArgs args, ILogger logger){- if (handler != null)+ if (handler is not null){Task.Run(() =>{@@ -45,7 +45,7 @@ namespace MediaBrowser.Common.Events/// <param name="logger">The logger.</param>public static void QueueEventIfNotNull<T>(EventHandler<T>? handler, object sender, T args, ILogger logger){- if (handler != null)+ if (handler is not null){Task.Run(() =>{diff --git a/MediaBrowser.Common/Net/IPHost.cs b/MediaBrowser.Common/Net/IPHost.csindex 1f125f2b1d..7cf1b8aa0b 100644--- a/MediaBrowser.Common/Net/IPHost.cs+++ b/MediaBrowser.Common/Net/IPHost.cs@@ -236,7 +236,7 @@ namespace MediaBrowser.Common.Net/// <inheritdoc/>public override bool Contains(IPAddress address){- if (address != null && !Address.Equals(IPAddress.None))+ if (address is not null && !Address.Equals(IPAddress.None)){if (address.IsIPv4MappedToIPv6){diff --git a/MediaBrowser.Common/Net/IPNetAddress.cs b/MediaBrowser.Common/Net/IPNetAddress.csindex 98d1c2d97b..ac3396a9f1 100644--- a/MediaBrowser.Common/Net/IPNetAddress.cs+++ b/MediaBrowser.Common/Net/IPNetAddress.cs@@ -214,7 +214,7 @@ namespace MediaBrowser.Common.Net/// <inheritdoc/>public override bool Equals(IPAddress ip){- if (ip != null && !ip.Equals(IPAddress.None) && !Address.Equals(IPAddress.None))+ if (ip is not null && !ip.Equals(IPAddress.None) && !Address.Equals(IPAddress.None)){return ip.Equals(Address);}diff --git a/MediaBrowser.Common/Net/IPObject.cs b/MediaBrowser.Common/Net/IPObject.csindex 37385972f7..93655234b0 100644--- a/MediaBrowser.Common/Net/IPObject.cs+++ b/MediaBrowser.Common/Net/IPObject.cs@@ -292,7 +292,7 @@ namespace MediaBrowser.Common.Net/// <returns>Equality result.</returns>public virtual bool Equals(IPAddress ip){- if (ip != null)+ if (ip is not null){if (ip.IsIPv4MappedToIPv6){@@ -312,7 +312,7 @@ namespace MediaBrowser.Common.Net/// <returns>Equality result.</returns>public virtual bool Equals(IPObject? other){- if (other != null)+ if (other is not null){return !Address.Equals(IPAddress.None) && Address.Equals(other.Address);}diff --git a/MediaBrowser.Common/Plugins/BasePluginOfT.cs b/MediaBrowser.Common/Plugins/BasePluginOfT.csindex 19db30cb8b..152fa8b4a2 100644--- a/MediaBrowser.Common/Plugins/BasePluginOfT.cs+++ b/MediaBrowser.Common/Plugins/BasePluginOfT.cs@@ -47,7 +47,7 @@ namespace MediaBrowser.Common.Pluginsvar assemblyFilePath = assembly.Location;var dataFolderPath = Path.Combine(ApplicationPaths.PluginsPath, Path.GetFileNameWithoutExtension(assemblyFilePath));- if (Version != null && !Directory.Exists(dataFolderPath))+ if (Version is not null && !Directory.Exists(dataFolderPath)){// Try again with the version number appended to the folder name.dataFolderPath += "_" + Version.ToString();diff --git a/MediaBrowser.Controller/BaseItemManager/BaseItemManager.cs b/MediaBrowser.Controller/BaseItemManager/BaseItemManager.csindex b0e394dc5a..ed7c2c2c17 100644--- a/MediaBrowser.Controller/BaseItemManager/BaseItemManager.cs+++ b/MediaBrowser.Controller/BaseItemManager/BaseItemManager.cs@@ -49,7 +49,7 @@ namespace MediaBrowser.Controller.BaseItemManagerreturn !baseItem.EnableMediaSourceDisplay;}- if (libraryTypeOptions != null)+ if (libraryTypeOptions is not null){return libraryTypeOptions.MetadataFetchers.Contains(name.AsSpan(), StringComparison.OrdinalIgnoreCase);}@@ -74,7 +74,7 @@ namespace MediaBrowser.Controller.BaseItemManagerreturn !baseItem.EnableMediaSourceDisplay;}- if (libraryTypeOptions != null)+ if (libraryTypeOptions is not null){return libraryTypeOptions.ImageFetchers.Contains(name.AsSpan(), StringComparison.OrdinalIgnoreCase);}diff --git a/MediaBrowser.Controller/Entities/AggregateFolder.cs b/MediaBrowser.Controller/Entities/AggregateFolder.csindex 4dc78ff86b..08c622cde0 100644--- a/MediaBrowser.Controller/Entities/AggregateFolder.cs+++ b/MediaBrowser.Controller/Entities/AggregateFolder.cs@@ -74,7 +74,7 @@ namespace MediaBrowser.Controller.Entitiesreturn list;}- return _childrenIds.Select(LibraryManager.GetItemById).Where(i => i != null).ToList();+ return _childrenIds.Select(LibraryManager.GetItemById).Where(i => i is not null).ToList();}}diff --git a/MediaBrowser.Controller/Entities/Audio/Audio.cs b/MediaBrowser.Controller/Entities/Audio/Audio.csindex 29f7bf92b7..c7216a3209 100644--- a/MediaBrowser.Controller/Entities/Audio/Audio.cs+++ b/MediaBrowser.Controller/Entities/Audio/Audio.cs@@ -81,8 +81,8 @@ namespace MediaBrowser.Controller.Entities.Audio/// <returns>System.String.</returns>protected override string CreateSortName(){- return (ParentIndexNumber != null ? ParentIndexNumber.Value.ToString("0000 - ", CultureInfo.InvariantCulture) : string.Empty)- + (IndexNumber != null ? IndexNumber.Value.ToString("0000 - ", CultureInfo.InvariantCulture) : string.Empty) + Name;+ return (ParentIndexNumber is not null ? ParentIndexNumber.Value.ToString("0000 - ", CultureInfo.InvariantCulture) : string.Empty)+ + (IndexNumber is not null ? IndexNumber.Value.ToString("0000 - ", CultureInfo.InvariantCulture) : string.Empty) + Name;}public override List<string> GetUserDataKeys()diff --git a/MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs b/MediaBrowser.Controller/Entities/Audio/MusicAlbum.csindex 6555de8554..2dbd513a17 100644--- a/MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs+++ b/MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs@@ -138,7 +138,7 @@ namespace MediaBrowser.Controller.Entities.Audiovar artist = GetMusicArtist(new DtoOptions(false));- if (artist != null)+ if (artist is not null){id.ArtistProviderIds = artist.ProviderIds;}diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.csindex 20f0095880..b7934bc098 100644--- a/MediaBrowser.Controller/Entities/BaseItem.cs+++ b/MediaBrowser.Controller/Entities/BaseItem.cs@@ -658,7 +658,7 @@ namespace MediaBrowser.Controller.Entities}var parent = DisplayParent;- if (parent != null)+ if (parent is not null){return parent.OfficialRatingForComparison;}@@ -679,7 +679,7 @@ namespace MediaBrowser.Controller.Entities}var parent = DisplayParent;- if (parent != null)+ if (parent is not null){return parent.CustomRatingForComparison;}@@ -976,7 +976,7 @@ namespace MediaBrowser.Controller.Entities{var parent = GetParent();- while (parent != null)+ while (parent is not null){yield return parent;@@ -1114,7 +1114,7 @@ namespace MediaBrowser.Controller.Entities}var video = item as Video;- if (video != null)+ if (video is not null){info.IsoType = video.IsoType;info.VideoType = video.VideoType;@@ -1153,7 +1153,7 @@ namespace MediaBrowser.Controller.Entitiesinfo.SupportsDirectStream = MediaSourceManager.SupportsDirectStream(info.Path, info.Protocol);}- if (video != null && video.VideoType != VideoType.VideoFile)+ if (video is not null && video.VideoType != VideoType.VideoFile){info.SupportsDirectStream = false;}@@ -1692,7 +1692,7 @@ namespace MediaBrowser.Controller.Entitiesvar itemById = LibraryManager.GetItemById(info.ItemId.Value);- if (itemById != null)+ if (itemById is not null){return itemById;}@@ -2060,7 +2060,7 @@ namespace MediaBrowser.Controller.Entities{var artist = FindParent<MusicArtist>();- if (artist != null)+ if (artist is not null){return artist.GetImages(imageType).ElementAtOrDefault(imageIndex);}@@ -2274,14 +2274,14 @@ namespace MediaBrowser.Controller.Entities{var userdata = UserDataManager.GetUserData(user, this);- return userdata != null && userdata.Played;+ return userdata is not null && userdata.Played;}public bool IsFavoriteOrLiked(User user){var userdata = UserDataManager.GetUserData(user, this);- return userdata != null && (userdata.IsFavorite || (userdata.Likes ?? false));+ return userdata is not null && (userdata.IsFavorite || (userdata.Likes ?? false));}public virtual bool IsUnplayed(User user)@@ -2565,7 +2565,7 @@ namespace MediaBrowser.Controller.Entities{return ExtraIds.Select(LibraryManager.GetItemById)- .Where(i => i != null)+ .Where(i => i is not null).OrderBy(i => i.SortName);}@@ -2578,7 +2578,7 @@ namespace MediaBrowser.Controller.Entities{return ExtraIds.Select(LibraryManager.GetItemById)- .Where(i => i != null)+ .Where(i => i is not null).Where(i => i.ExtraType.HasValue && extraTypes.Contains(i.ExtraType.Value)).OrderBy(i => i.SortName);}diff --git a/MediaBrowser.Controller/Entities/BaseItemExtensions.cs b/MediaBrowser.Controller/Entities/BaseItemExtensions.csindex dc06bf9bda..615d236c73 100644--- a/MediaBrowser.Controller/Entities/BaseItemExtensions.cs+++ b/MediaBrowser.Controller/Entities/BaseItemExtensions.cs@@ -95,7 +95,7 @@ namespace MediaBrowser.Controller.Entities}var p = destProps.Find(x => x.Name == sourceProp.Name);- if (p != null)+ if (p is not null){p.SetValue(dest, v);}diff --git a/MediaBrowser.Controller/Entities/Folder.cs b/MediaBrowser.Controller/Entities/Folder.csindex 9ef5504afb..e586205c32 100644--- a/MediaBrowser.Controller/Entities/Folder.cs+++ b/MediaBrowser.Controller/Entities/Folder.cs@@ -483,7 +483,7 @@ namespace MediaBrowser.Controller.Entities}});- if (container != null)+ if (container is not null){await RefreshAllMetadataForContainer(container, refreshOptions, innerProgress, cancellationToken).ConfigureAwait(false);}@@ -515,7 +515,7 @@ namespace MediaBrowser.Controller.Entitiesasync () =>{var series = container as Series;- if (series != null)+ if (series is not null){await series.RefreshMetadata(refreshOptions, cancellationToken).ConfigureAwait(false);}@@ -529,7 +529,7 @@ namespace MediaBrowser.Controller.Entities{var container = child as IMetadataContainer;- if (container != null)+ if (container is not null){await RefreshAllMetadataForContainer(container, refreshOptions, progress, cancellationToken).ConfigureAwait(false);}@@ -741,7 +741,7 @@ namespace MediaBrowser.Controller.EntitiesIEnumerable<BaseItem> itemsList = LibraryManager.GetItemList(query);var user = query.User;- if (user != null)+ if (user is not null){// needed for boxsetsitemsList = itemsList.Where(i => i.IsVisibleStandalone(query.User));@@ -984,7 +984,7 @@ namespace MediaBrowser.Controller.Entitiesvar user = query.User;// Check recursive - don't substitute in plain folder views- if (user != null)+ if (user is not null){items = CollapseBoxSetItemsIfNeeded(items, query, this, user, ConfigurationManager, CollectionManager);}@@ -1069,7 +1069,7 @@ namespace MediaBrowser.Controller.Entitiesif (!param.HasValue){- if (user != null && !configurationManager.Configuration.EnableGroupingIntoCollections)+ if (user is not null && !configurationManager.Configuration.EnableGroupingIntoCollections){return false;}@@ -1441,7 +1441,7 @@ namespace MediaBrowser.Controller.Entities{var child = GetLinkedChild(i);- if (child != null)+ if (child is not null){list.Add(child);}@@ -1467,7 +1467,7 @@ namespace MediaBrowser.Controller.Entitiesvar child = GetLinkedChild(i);- if (child != null && child.Id.Equals(itemId))+ if (child is not null && child.Id.Equals(itemId)){return true;}@@ -1547,7 +1547,7 @@ namespace MediaBrowser.Controller.Entities{return LinkedChildren.Select(i => new Tuple<LinkedChild, BaseItem>(i, GetLinkedChild(i)))- .Where(i => i.Item2 != null);+ .Where(i => i.Item2 is not null);}protected override async Task<bool> RefreshedOwnedItems(MetadataRefreshOptions options, IReadOnlyList<FileSystemMetadata> fileSystemChildren, CancellationToken cancellationToken)@@ -1605,7 +1605,7 @@ namespace MediaBrowser.Controller.Entitiesreturn null;}})- .Where(i => i != null)+ .Where(i => i is not null).ToList();var currentShortcutLinks = LinkedChildren.Where(i => i.Type == LinkedChildType.Shortcut).ToList();@@ -1662,7 +1662,7 @@ namespace MediaBrowser.Controller.Entities{// The querying doesn't support virtual unairedvar episode = item as Episode;- if (episode != null && episode.IsUnaired)+ if (episode is not null && episode.IsUnaired){continue;}@@ -1719,7 +1719,7 @@ namespace MediaBrowser.Controller.Entitiesreturn;}- if (itemDto != null)+ if (itemDto is not null){if (fields.ContainsField(ItemFields.RecursiveItemCount)){diff --git a/MediaBrowser.Controller/Entities/InternalItemsQuery.cs b/MediaBrowser.Controller/Entities/InternalItemsQuery.csindex fc019c0ee7..a1e5319048 100644--- a/MediaBrowser.Controller/Entities/InternalItemsQuery.cs+++ b/MediaBrowser.Controller/Entities/InternalItemsQuery.cs@@ -55,7 +55,7 @@ namespace MediaBrowser.Controller.Entitiespublic InternalItemsQuery(User? user): this(){- if (user != null)+ if (user is not null){SetUser(user);}diff --git a/MediaBrowser.Controller/Entities/Movies/Movie.cs b/MediaBrowser.Controller/Entities/Movies/Movie.csindex 3c12acd90d..81f6248fac 100644--- a/MediaBrowser.Controller/Entities/Movies/Movie.cs+++ b/MediaBrowser.Controller/Entities/Movies/Movie.cs@@ -22,7 +22,7 @@ namespace MediaBrowser.Controller.Entities.Movies/// <inheritdoc />[JsonIgnore]public IReadOnlyList<Guid> SpecialFeatureIds => GetExtras()- .Where(extra => extra.ExtraType != null && extra is Video)+ .Where(extra => extra.ExtraType is not null && extra is Video).Select(extra => extra.Id).ToArray();diff --git a/MediaBrowser.Controller/Entities/PeopleHelper.cs b/MediaBrowser.Controller/Entities/PeopleHelper.csindex 46d969ffe4..44c0e25396 100644--- a/MediaBrowser.Controller/Entities/PeopleHelper.cs+++ b/MediaBrowser.Controller/Entities/PeopleHelper.cs@@ -41,7 +41,7 @@ namespace MediaBrowser.Controller.Entities{var existing = people.FirstOrDefault(p => p.Name.Equals(person.Name, StringComparison.OrdinalIgnoreCase) && p.Type.Equals(PersonType.Actor, StringComparison.OrdinalIgnoreCase));- if (existing != null)+ if (existing is not null){existing.Type = PersonType.GuestStar;MergeExisting(existing, person);diff --git a/MediaBrowser.Controller/Entities/TV/Episode.cs b/MediaBrowser.Controller/Entities/TV/Episode.csindex 2d9cdb8d04..3f30ac5658 100644--- a/MediaBrowser.Controller/Entities/TV/Episode.cs+++ b/MediaBrowser.Controller/Entities/TV/Episode.cs@@ -155,7 +155,7 @@ namespace MediaBrowser.Controller.Entities.TVvar list = base.GetUserDataKeys();var series = Series;- if (series != null && ParentIndexNumber.HasValue && IndexNumber.HasValue)+ if (series is not null && ParentIndexNumber.HasValue && IndexNumber.HasValue){var seriesUserDataKeys = series.GetUserDataKeys();var take = seriesUserDataKeys.Count;@@ -216,7 +216,7 @@ namespace MediaBrowser.Controller.Entities.TV{var series = Series;- if (series != null && ParentIndexNumber.HasValue)+ if (series is not null && ParentIndexNumber.HasValue){var findNumber = ParentIndexNumber.Value;@@ -235,8 +235,8 @@ namespace MediaBrowser.Controller.Entities.TV/// <returns>System.String.</returns>protected override string CreateSortName(){- return (ParentIndexNumber != null ? ParentIndexNumber.Value.ToString("000 - ", CultureInfo.InvariantCulture) : string.Empty)- + (IndexNumber != null ? IndexNumber.Value.ToString("0000 - ", CultureInfo.InvariantCulture) : string.Empty) + Name;+ return (ParentIndexNumber is not null ? ParentIndexNumber.Value.ToString("000 - ", CultureInfo.InvariantCulture) : string.Empty)+ + (IndexNumber is not null ? IndexNumber.Value.ToString("0000 - ", CultureInfo.InvariantCulture) : string.Empty) + Name;}/// <summary>@@ -302,7 +302,7 @@ namespace MediaBrowser.Controller.Entities.TVvar series = Series;- if (series != null)+ if (series is not null){id.SeriesProviderIds = series.ProviderIds;id.SeriesDisplayOrder = series.DisplayOrder;diff --git a/MediaBrowser.Controller/Entities/TV/Season.cs b/MediaBrowser.Controller/Entities/TV/Season.csindex 19fe16c8f1..0a040a3c28 100644--- a/MediaBrowser.Controller/Entities/TV/Season.cs+++ b/MediaBrowser.Controller/Entities/TV/Season.cs@@ -64,7 +64,7 @@ namespace MediaBrowser.Controller.Entities.TV{var series = Series;- if (series != null)+ if (series is not null){return series.Path;}@@ -101,7 +101,7 @@ namespace MediaBrowser.Controller.Entities.TVvar list = base.GetUserDataKeys();var series = Series;- if (series != null)+ if (series is not null){var newList = series.GetUserDataKeys();var suffix = (IndexNumber ?? 0).ToString("000", CultureInfo.InvariantCulture);@@ -129,7 +129,7 @@ namespace MediaBrowser.Controller.Entities.TVif (IndexNumber.HasValue){var series = Series;- if (series != null)+ if (series is not null){return series.PresentationUniqueKey + "-" + (IndexNumber ?? 0).ToString("000", CultureInfo.InvariantCulture);}@@ -144,7 +144,7 @@ namespace MediaBrowser.Controller.Entities.TV/// <returns>System.String.</returns>protected override string CreateSortName(){- return IndexNumber != null ? IndexNumber.Value.ToString("0000", CultureInfo.InvariantCulture) : Name;+ return IndexNumber is not null ? IndexNumber.Value.ToString("0000", CultureInfo.InvariantCulture) : Name;}protected override QueryResult<BaseItem> GetItemsInternal(InternalItemsQuery query)@@ -233,7 +233,7 @@ namespace MediaBrowser.Controller.Entities.TVvar series = Series;- if (series != null)+ if (series is not null){id.SeriesProviderIds = series.ProviderIds;}diff --git a/MediaBrowser.Controller/Entities/TV/Series.cs b/MediaBrowser.Controller/Entities/TV/Series.csindex 069071ee57..02312757ce 100644--- a/MediaBrowser.Controller/Entities/TV/Series.cs+++ b/MediaBrowser.Controller/Entities/TV/Series.cs@@ -218,7 +218,7 @@ namespace MediaBrowser.Controller.Entities.TVquery.IncludeItemTypes = new[] { BaseItemKind.Season };query.OrderBy = new[] { (ItemSortBy.SortName, SortOrder.Ascending) };- if (user != null && !user.DisplayMissingEpisodes)+ if (user is not null && !user.DisplayMissingEpisodes){query.IsMissing = false;}@@ -369,7 +369,7 @@ namespace MediaBrowser.Controller.Entities.TVOrderBy = new[] { (ItemSortBy.SortName, SortOrder.Ascending) },DtoOptions = options};- if (user != null)+ if (user is not null){if (!user.DisplayMissingEpisodes){@@ -426,7 +426,7 @@ namespace MediaBrowser.Controller.Entities.TV}var season = episodeItem.Season;- return season != null && string.Equals(GetUniqueSeriesKey(season), seasonPresentationKey, StringComparison.OrdinalIgnoreCase);+ return season is not null && string.Equals(GetUniqueSeriesKey(season), seasonPresentationKey, StringComparison.OrdinalIgnoreCase);});}@@ -448,7 +448,7 @@ namespace MediaBrowser.Controller.Entities.TV{var episode = i;- if (episode != null)+ if (episode is not null){var currentSeasonNumber = episode.AiredSeasonNumber;diff --git a/MediaBrowser.Controller/Entities/UserItemData.cs b/MediaBrowser.Controller/Entities/UserItemData.csindex 50ba9ef308..ecca440f05 100644--- a/MediaBrowser.Controller/Entities/UserItemData.cs+++ b/MediaBrowser.Controller/Entities/UserItemData.cs@@ -105,7 +105,7 @@ namespace MediaBrowser.Controller.Entities{get{- if (Rating != null)+ if (Rating is not null){return Rating >= MinLikeValue;}diff --git a/MediaBrowser.Controller/Entities/UserRootFolder.cs b/MediaBrowser.Controller/Entities/UserRootFolder.csindex b19b1fa13b..69743b926c 100644--- a/MediaBrowser.Controller/Entities/UserRootFolder.cs+++ b/MediaBrowser.Controller/Entities/UserRootFolder.cs@@ -63,7 +63,7 @@ namespace MediaBrowser.Controller.Entitiesreturn list;}- return _childrenIds.Select(LibraryManager.GetItemById).Where(i => i != null).ToList();+ return _childrenIds.Select(LibraryManager.GetItemById).Where(i => i is not null).ToList();}}diff --git a/MediaBrowser.Controller/Entities/UserViewBuilder.cs b/MediaBrowser.Controller/Entities/UserViewBuilder.csindex 7ebf9e5f8b..c276ab463a 100644--- a/MediaBrowser.Controller/Entities/UserViewBuilder.cs+++ b/MediaBrowser.Controller/Entities/UserViewBuilder.cs@@ -46,7 +46,7 @@ namespace MediaBrowser.Controller.Entities{var user = query.User;- // if (query.IncludeItemTypes != null &&+ // if (query.IncludeItemTypes is not null &&// query.IncludeItemTypes.Length == 1 &&// string.Equals(query.IncludeItemTypes[0], "Playlist", StringComparison.OrdinalIgnoreCase))// {@@ -263,7 +263,7 @@ namespace MediaBrowser.Controller.Entitiesreturn null;}})- .Where(i => i != null)+ .Where(i => i is not null).Select(i => GetUserViewWithName(SpecialFolder.MovieGenre, i.SortName, parent));return GetResult(genres, query);@@ -391,7 +391,7 @@ namespace MediaBrowser.Controller.Entitiesreturn null;}})- .Where(i => i != null)+ .Where(i => i is not null).Select(i => GetUserViewWithName(SpecialFolder.TvGenre, i.SortName, parent));return GetResult(genres, query);@@ -791,7 +791,7 @@ namespace MediaBrowser.Controller.Entitiesif (query.StudioIds.Length > 0 && !query.StudioIds.Any(id =>{var studioItem = libraryManager.GetItemById(id);- return studioItem != null && item.Studios.Contains(studioItem.Name, StringComparison.OrdinalIgnoreCase);+ return studioItem is not null && item.Studios.Contains(studioItem.Name, StringComparison.OrdinalIgnoreCase);})){return false;@@ -801,7 +801,7 @@ namespace MediaBrowser.Controller.Entitiesif (query.GenreIds.Count > 0 && !query.GenreIds.Any(id =>{var genreItem = libraryManager.GetItemById(id);- return genreItem != null && item.Genres.Contains(genreItem.Name, StringComparison.OrdinalIgnoreCase);+ return genreItem is not null && item.Genres.Contains(genreItem.Name, StringComparison.OrdinalIgnoreCase);})){return false;@@ -952,7 +952,7 @@ namespace MediaBrowser.Controller.Entities{var folder = i as ICollectionFolder;- return folder != null && viewTypes.Contains(folder.CollectionType ?? string.Empty, StringComparison.OrdinalIgnoreCase);+ return folder is not null && viewTypes.Contains(folder.CollectionType ?? string.Empty, StringComparison.OrdinalIgnoreCase);}).ToArray();}@@ -961,7 +961,7 @@ namespace MediaBrowser.Controller.Entities{var folder = i as ICollectionFolder;- return folder != null && viewTypes.Contains(folder.CollectionType ?? string.Empty, StringComparison.OrdinalIgnoreCase);+ return folder is not null && viewTypes.Contains(folder.CollectionType ?? string.Empty, StringComparison.OrdinalIgnoreCase);}).ToArray();}diff --git a/MediaBrowser.Controller/Entities/Video.cs b/MediaBrowser.Controller/Entities/Video.csindex 5de2e0f50e..5b7abea10a 100644--- a/MediaBrowser.Controller/Entities/Video.cs+++ b/MediaBrowser.Controller/Entities/Video.cs@@ -373,7 +373,7 @@ namespace MediaBrowser.Controller.Entities{return LinkedAlternateVersions.Select(GetLinkedChild)- .Where(i => i != null)+ .Where(i => i is not null).OfType<Video>().OrderBy(i => i.SortName);}@@ -386,7 +386,7 @@ namespace MediaBrowser.Controller.Entities{return GetAdditionalPartIds().Select(i => LibraryManager.GetItemById(i))- .Where(i => i != null)+ .Where(i => i is not null).OfType<Video>().OrderBy(i => i.SortName);}@@ -469,7 +469,7 @@ namespace MediaBrowser.Controller.Entitiesvar localAlternates = GetLocalAlternateVersionIds().Select(i => LibraryManager.GetItemById(i))- .Where(i => i != null);+ .Where(i => i is not null);foreach (var item in localAlternates){@@ -542,7 +542,7 @@ namespace MediaBrowser.Controller.Entitiesreturn i.Item1 is Video video ? video.GetLocalAlternateVersionIds() : Enumerable.Empty<Guid>();}).Select(LibraryManager.GetItemById)- .Where(i => i != null)+ .Where(i => i is not null).ToList();list.AddRange(localAlternates.Select(i => (i, MediaSourceType.Default)));diff --git a/MediaBrowser.Controller/Library/ItemResolveArgs.cs b/MediaBrowser.Controller/Library/ItemResolveArgs.csindex f93c890fee..0424399c8e 100644--- a/MediaBrowser.Controller/Library/ItemResolveArgs.cs+++ b/MediaBrowser.Controller/Library/ItemResolveArgs.cs@@ -130,7 +130,7 @@ namespace MediaBrowser.Controller.Library{var parent = Parent;- if (parent != null)+ if (parent is not null){var item = parent as T;@@ -148,7 +148,7 @@ namespace MediaBrowser.Controller.Library}}- return item != null;+ return item is not null;}return false;@@ -287,14 +287,14 @@ namespace MediaBrowser.Controller.Library/// <returns><c>true</c> if the arguments are the same, <c>false</c> otherwise.</returns>protected bool Equals(ItemResolveArgs args){- if (args != null)+ if (args is not null){if (args.Path is null && Path is null){return true;}- return args.Path != null && BaseItem.FileSystem.AreEqual(args.Path, Path);+ return args.Path is not null && BaseItem.FileSystem.AreEqual(args.Path, Path);}return false;diff --git a/MediaBrowser.Controller/LiveTv/LiveTvProgram.cs b/MediaBrowser.Controller/LiveTv/LiveTvProgram.csindex 6c4a5ea177..514323238e 100644--- a/MediaBrowser.Controller/LiveTv/LiveTvProgram.cs+++ b/MediaBrowser.Controller/LiveTv/LiveTvProgram.cs@@ -246,7 +246,7 @@ namespace MediaBrowser.Controller.LiveTvvar listings = GetListingsProviderInfo();- if (listings != null)+ if (listings is not null){if (!string.IsNullOrEmpty(listings.MoviePrefix) && name.StartsWith(listings.MoviePrefix, StringComparison.OrdinalIgnoreCase)){diff --git a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.csindex d423a2fbe4..7264c5eed0 100644--- a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs+++ b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs@@ -682,7 +682,7 @@ namespace MediaBrowser.Controller.MediaEncodingpublic string GetGraphicalSubCanvasSize(EncodingJobInfo state){- if (state.SubtitleStream != null+ if (state.SubtitleStream is not null&& state.SubtitleDeliveryMethod == SubtitleDeliveryMethod.Encode&& !state.SubtitleStream.IsTextSubtitleStream){@@ -932,7 +932,7 @@ namespace MediaBrowser.Controller.MediaEncoding.Append(GetInputPathArgument(state));// sub2video for external graphical subtitles- if (state.SubtitleStream != null+ if (state.SubtitleStream is not null&& state.SubtitleDeliveryMethod == SubtitleDeliveryMethod.Encode&& !state.SubtitleStream.IsTextSubtitleStream&& state.SubtitleStream.IsExternal)@@ -963,7 +963,7 @@ namespace MediaBrowser.Controller.MediaEncodingarg.Append(" -i file:\"").Append(subtitlePath).Append('\"');}- if (state.AudioStream != null && state.AudioStream.IsExternal)+ if (state.AudioStream is not null && state.AudioStream.IsExternal){// Also seek the external audio stream.var seekAudioParam = GetFastSeekCommandLineParameter(state, options, segmentContainer);@@ -1231,7 +1231,7 @@ namespace MediaBrowser.Controller.MediaEncodingvar maxrate = request.MaxFramerate;- if (maxrate.HasValue && state.VideoStream != null)+ if (maxrate.HasValue && state.VideoStream is not null){var contentRate = state.VideoStream.AverageFrameRate ?? state.VideoStream.RealFrameRate;@@ -1981,7 +1981,7 @@ namespace MediaBrowser.Controller.MediaEncoding{var bitrate = request.VideoBitRate;- if (videoStream != null)+ if (videoStream is not null){var isUpscaling = request.Height.HasValue&& videoStream.Height.HasValue@@ -2130,7 +2130,7 @@ namespace MediaBrowser.Controller.MediaEncoding// Boost volume to 200% when downsampling from 6ch to 2chif (channels.HasValue&& channels.Value <= 2- && state.AudioStream != null+ && state.AudioStream is not null&& state.AudioStream.Channels.HasValue&& state.AudioStream.Channels.Value > 5&& !encodingOptions.DownMixAudioBoost.Equals(1))@@ -2139,7 +2139,7 @@ namespace MediaBrowser.Controller.MediaEncoding}var isCopyingTimestamps = state.CopyTimestamps || state.TranscodingType != TranscodingJobType.Progressive;- if (state.SubtitleStream != null && state.SubtitleStream.IsTextSubtitleStream && state.SubtitleDeliveryMethod == SubtitleDeliveryMethod.Encode && !isCopyingTimestamps)+ if (state.SubtitleStream is not null && state.SubtitleStream.IsTextSubtitleStream && state.SubtitleDeliveryMethod == SubtitleDeliveryMethod.Encode && !isCopyingTimestamps){var seconds = TimeSpan.FromTicks(state.StartTimeTicks ?? 0).TotalSeconds;@@ -2326,20 +2326,20 @@ namespace MediaBrowser.Controller.MediaEncoding}// We have media info, but we don't know the stream index- if (state.VideoStream != null && state.VideoStream.Index == -1)+ if (state.VideoStream is not null && state.VideoStream.Index == -1){return "-sn";}// We have media info, but we don't know the stream index- if (state.AudioStream != null && state.AudioStream.Index == -1)+ if (state.AudioStream is not null && state.AudioStream.Index == -1){return state.IsInputVideo ? "-sn" : string.Empty;}var args = string.Empty;- if (state.VideoStream != null)+ if (state.VideoStream is not null){int videoStreamIndex = FindIndex(state.MediaSource.MediaStreams, state.VideoStream);@@ -2354,12 +2354,12 @@ namespace MediaBrowser.Controller.MediaEncodingargs += "-vn";}- if (state.AudioStream != null)+ if (state.AudioStream is not null){int audioStreamIndex = FindIndex(state.MediaSource.MediaStreams, state.AudioStream);if (state.AudioStream.IsExternal){- bool hasExternalGraphicsSubs = state.SubtitleStream != null+ bool hasExternalGraphicsSubs = state.SubtitleStream is not null&& state.SubtitleDeliveryMethod == SubtitleDeliveryMethod.Encode&& state.SubtitleStream.IsExternal&& !state.SubtitleStream.IsTextSubtitleStream;@@ -2427,7 +2427,7 @@ namespace MediaBrowser.Controller.MediaEncoding{var stream = streams.FirstOrDefault(s => s.Index == desiredIndex.Value);- if (stream != null)+ if (stream is not null){return stream;}@@ -2875,7 +2875,7 @@ namespace MediaBrowser.Controller.MediaEncodingvar doDeintHevc = state.DeInterlace("h265", true) || state.DeInterlace("hevc", true);var doDeintH2645 = doDeintH264 || doDeintHevc;- var hasSubs = state.SubtitleStream != null && state.SubtitleDeliveryMethod == SubtitleDeliveryMethod.Encode;+ var hasSubs = state.SubtitleStream is not null && state.SubtitleDeliveryMethod == SubtitleDeliveryMethod.Encode;var hasTextSubs = hasSubs && state.SubtitleStream.IsTextSubtitleStream;var hasGraphicalSubs = hasSubs && !state.SubtitleStream.IsTextSubtitleStream;@@ -2990,7 +2990,7 @@ namespace MediaBrowser.Controller.MediaEncodingvar doDeintH2645 = doDeintH264 || doDeintHevc;var doCuTonemap = IsHwTonemapAvailable(state, options);- var hasSubs = state.SubtitleStream != null && state.SubtitleDeliveryMethod == SubtitleDeliveryMethod.Encode;+ var hasSubs = state.SubtitleStream is not null && state.SubtitleDeliveryMethod == SubtitleDeliveryMethod.Encode;var hasTextSubs = hasSubs && state.SubtitleStream.IsTextSubtitleStream;var hasGraphicalSubs = hasSubs && !state.SubtitleStream.IsTextSubtitleStream;var hasAssSubs = hasSubs@@ -3180,7 +3180,7 @@ namespace MediaBrowser.Controller.MediaEncodingvar doDeintH2645 = doDeintH264 || doDeintHevc;var doOclTonemap = IsHwTonemapAvailable(state, options);- var hasSubs = state.SubtitleStream != null && state.SubtitleDeliveryMethod == SubtitleDeliveryMethod.Encode;+ var hasSubs = state.SubtitleStream is not null && state.SubtitleDeliveryMethod == SubtitleDeliveryMethod.Encode;var hasTextSubs = hasSubs && state.SubtitleStream.IsTextSubtitleStream;var hasGraphicalSubs = hasSubs && !state.SubtitleStream.IsTextSubtitleStream;var hasAssSubs = hasSubs@@ -3402,7 +3402,7 @@ namespace MediaBrowser.Controller.MediaEncodingvar doDeintH2645 = doDeintH264 || doDeintHevc;var doOclTonemap = IsHwTonemapAvailable(state, options);- var hasSubs = state.SubtitleStream != null && state.SubtitleDeliveryMethod == SubtitleDeliveryMethod.Encode;+ var hasSubs = state.SubtitleStream is not null && state.SubtitleDeliveryMethod == SubtitleDeliveryMethod.Encode;var hasTextSubs = hasSubs && state.SubtitleStream.IsTextSubtitleStream;var hasGraphicalSubs = hasSubs && !state.SubtitleStream.IsTextSubtitleStream;var hasAssSubs = hasSubs@@ -3605,7 +3605,7 @@ namespace MediaBrowser.Controller.MediaEncodingvar doTonemap = doVaVppTonemap || doOclTonemap;var doDeintH2645 = doDeintH264 || doDeintHevc;- var hasSubs = state.SubtitleStream != null && state.SubtitleDeliveryMethod == SubtitleDeliveryMethod.Encode;+ var hasSubs = state.SubtitleStream is not null && state.SubtitleDeliveryMethod == SubtitleDeliveryMethod.Encode;var hasTextSubs = hasSubs && state.SubtitleStream.IsTextSubtitleStream;var hasGraphicalSubs = hasSubs && !state.SubtitleStream.IsTextSubtitleStream;var hasAssSubs = hasSubs@@ -3882,7 +3882,7 @@ namespace MediaBrowser.Controller.MediaEncodingvar doTonemap = doVaVppTonemap || doOclTonemap;var doDeintH2645 = doDeintH264 || doDeintHevc;- var hasSubs = state.SubtitleStream != null && state.SubtitleDeliveryMethod == SubtitleDeliveryMethod.Encode;+ var hasSubs = state.SubtitleStream is not null && state.SubtitleDeliveryMethod == SubtitleDeliveryMethod.Encode;var hasTextSubs = hasSubs && state.SubtitleStream.IsTextSubtitleStream;var hasGraphicalSubs = hasSubs && !state.SubtitleStream.IsTextSubtitleStream;var hasAssSubs = hasSubs@@ -4078,7 +4078,7 @@ namespace MediaBrowser.Controller.MediaEncodingvar doVkTonemap = IsVulkanHwTonemapAvailable(state, options);var doDeintH2645 = doDeintH264 || doDeintHevc;- var hasSubs = state.SubtitleStream != null && state.SubtitleDeliveryMethod == SubtitleDeliveryMethod.Encode;+ var hasSubs = state.SubtitleStream is not null && state.SubtitleDeliveryMethod == SubtitleDeliveryMethod.Encode;var hasTextSubs = hasSubs && state.SubtitleStream.IsTextSubtitleStream;var hasGraphicalSubs = hasSubs && !state.SubtitleStream.IsTextSubtitleStream;var hasAssSubs = hasSubs@@ -4277,7 +4277,7 @@ namespace MediaBrowser.Controller.MediaEncodingvar doDeintH2645 = doDeintH264 || doDeintHevc;var doOclTonemap = IsHwTonemapAvailable(state, options);- var hasSubs = state.SubtitleStream != null && state.SubtitleDeliveryMethod == SubtitleDeliveryMethod.Encode;+ var hasSubs = state.SubtitleStream is not null && state.SubtitleDeliveryMethod == SubtitleDeliveryMethod.Encode;var hasTextSubs = hasSubs && state.SubtitleStream.IsTextSubtitleStream;var hasGraphicalSubs = hasSubs && !state.SubtitleStream.IsTextSubtitleStream;@@ -4445,7 +4445,7 @@ namespace MediaBrowser.Controller.MediaEncodingreturn string.Empty;}- var hasSubs = state.SubtitleStream != null && state.SubtitleDeliveryMethod == SubtitleDeliveryMethod.Encode;+ var hasSubs = state.SubtitleStream is not null && state.SubtitleDeliveryMethod == SubtitleDeliveryMethod.Encode;var hasTextSubs = hasSubs && state.SubtitleStream.IsTextSubtitleStream;var hasGraphicalSubs = hasSubs && !state.SubtitleStream.IsTextSubtitleStream;@@ -4495,7 +4495,7 @@ namespace MediaBrowser.Controller.MediaEncodingif (overlayFilters?.Count > 0&& subFilters?.Count > 0- && state.SubtitleStream != null)+ && state.SubtitleStream is not null){// overlay graphical/text subtitlesvar subStr = string.Format(@@ -4582,7 +4582,7 @@ namespace MediaBrowser.Controller.MediaEncodingpublic static int GetVideoColorBitDepth(EncodingJobInfo state){var videoStream = state.VideoStream;- if (videoStream != null)+ if (videoStream is not null){if (videoStream.BitDepth.HasValue){@@ -5196,7 +5196,7 @@ namespace MediaBrowser.Controller.MediaEncoding#nullable disablepublic void TryStreamCopy(EncodingJobInfo state){- if (state.VideoStream != null && CanStreamCopyVideo(state, state.VideoStream))+ if (state.VideoStream is not null && CanStreamCopyVideo(state, state.VideoStream)){state.OutputVideoCodec = "copy";}@@ -5205,13 +5205,13 @@ namespace MediaBrowser.Controller.MediaEncodingvar user = state.User;// If the user doesn't have access to transcoding, then force stream copy, regardless of whether it will be compatible or not- if (user != null && !user.HasPermission(PermissionKind.EnableVideoPlaybackTranscoding))+ if (user is not null && !user.HasPermission(PermissionKind.EnableVideoPlaybackTranscoding)){state.OutputVideoCodec = "copy";}}- if (state.AudioStream != null+ if (state.AudioStream is not null&& CanStreamCopyAudio(state, state.AudioStream, state.SupportedAudioCodecs)){state.OutputAudioCodec = "copy";@@ -5221,7 +5221,7 @@ namespace MediaBrowser.Controller.MediaEncodingvar user = state.User;// If the user doesn't have access to transcoding, then force stream copy, regardless of whether it will be compatible or not- if (user != null && !user.HasPermission(PermissionKind.EnableAudioPlaybackTranscoding))+ if (user is not null && !user.HasPermission(PermissionKind.EnableAudioPlaybackTranscoding)){state.OutputAudioCodec = "copy";}@@ -5418,7 +5418,7 @@ namespace MediaBrowser.Controller.MediaEncodingstate.SubtitleDeliveryMethod = videoRequest.SubtitleMethod;state.AudioStream = GetMediaStream(mediaStreams, videoRequest.AudioStreamIndex, MediaStreamType.Audio);- if (state.SubtitleStream != null && !state.SubtitleStream.IsExternal)+ if (state.SubtitleStream is not null && !state.SubtitleStream.IsExternal){state.InternalSubtitleStreamOffset = mediaStreams.Where(i => i.Type == MediaStreamType.Subtitle && !i.IsExternal).ToList().IndexOf(state.SubtitleStream);}@@ -5436,7 +5436,7 @@ namespace MediaBrowser.Controller.MediaEncodingvar request = state.BaseRequest;var supportedAudioCodecs = state.SupportedAudioCodecs;- if (request != null && supportedAudioCodecs != null && supportedAudioCodecs.Length > 0)+ if (request is not null && supportedAudioCodecs is not null && supportedAudioCodecs.Length > 0){var supportedAudioCodecsList = supportedAudioCodecs.ToList();@@ -5449,7 +5449,7 @@ namespace MediaBrowser.Controller.MediaEncoding}var supportedVideoCodecs = state.SupportedVideoCodecs;- if (request != null && supportedVideoCodecs != null && supportedVideoCodecs.Length > 0)+ if (request is not null && supportedVideoCodecs is not null && supportedVideoCodecs.Length > 0){var supportedVideoCodecsList = supportedVideoCodecs.ToList();@@ -5617,7 +5617,7 @@ namespace MediaBrowser.Controller.MediaEncodingif (IsCopyCodec(videoCodec)){- if (state.VideoStream != null+ if (state.VideoStream is not null&& string.Equals(state.OutputContainer, "ts", StringComparison.OrdinalIgnoreCase)&& !string.Equals(state.VideoStream.NalLengthSize, "0", StringComparison.OrdinalIgnoreCase)){@@ -5647,7 +5647,7 @@ namespace MediaBrowser.Controller.MediaEncodingargs += keyFrameArg;- var hasGraphicalSubs = state.SubtitleStream != null && !state.SubtitleStream.IsTextSubtitleStream && state.SubtitleDeliveryMethod == SubtitleDeliveryMethod.Encode;+ var hasGraphicalSubs = state.SubtitleStream is not null && !state.SubtitleStream.IsTextSubtitleStream && state.SubtitleDeliveryMethod == SubtitleDeliveryMethod.Encode;var hasCopyTs = false;@@ -5667,7 +5667,7 @@ namespace MediaBrowser.Controller.MediaEncodingargs += " -avoid_negative_ts disabled";- if (!(state.SubtitleStream != null && state.SubtitleStream.IsExternal && !state.SubtitleStream.IsTextSubtitleStream))+ if (!(state.SubtitleStream is not null && state.SubtitleStream.IsExternal && !state.SubtitleStream.IsTextSubtitleStream)){args += " -start_at_zero";}@@ -5694,7 +5694,7 @@ namespace MediaBrowser.Controller.MediaEncodingpublic string GetProgressiveVideoAudioArguments(EncodingJobInfo state, EncodingOptions encodingOptions){// If the video doesn't have an audio stream, return a default.- if (state.AudioStream is null && state.VideoStream != null)+ if (state.AudioStream is null && state.VideoStream is not null){return string.Empty;}diff --git a/MediaBrowser.Controller/MediaEncoding/EncodingJobInfo.cs b/MediaBrowser.Controller/MediaEncoding/EncodingJobInfo.csindex 5d13cb8ed8..179cabc84a 100644--- a/MediaBrowser.Controller/MediaEncoding/EncodingJobInfo.cs+++ b/MediaBrowser.Controller/MediaEncoding/EncodingJobInfo.cs@@ -147,7 +147,7 @@ namespace MediaBrowser.Controller.MediaEncoding{get{- if (VideoStream != null && VideoStream.Width.HasValue && VideoStream.Height.HasValue)+ if (VideoStream is not null && VideoStream.Width.HasValue && VideoStream.Height.HasValue){var size = new ImageDimensions(VideoStream.Width.Value, VideoStream.Height.Value);@@ -174,7 +174,7 @@ namespace MediaBrowser.Controller.MediaEncoding{get{- if (VideoStream != null && VideoStream.Width.HasValue && VideoStream.Height.HasValue)+ if (VideoStream is not null && VideoStream.Width.HasValue && VideoStream.Height.HasValue){var size = new ImageDimensions(VideoStream.Width.Value, VideoStream.Height.Value);@@ -204,7 +204,7 @@ namespace MediaBrowser.Controller.MediaEncodingif (BaseRequest.Static|| EncodingHelper.IsCopyCodec(OutputAudioCodec)){- if (AudioStream != null)+ if (AudioStream is not null){return AudioStream.SampleRate;}@@ -227,7 +227,7 @@ namespace MediaBrowser.Controller.MediaEncodingif (BaseRequest.Static|| EncodingHelper.IsCopyCodec(OutputAudioCodec)){- if (AudioStream != null)+ if (AudioStream is not null){return AudioStream.BitDepth;}@@ -556,7 +556,7 @@ namespace MediaBrowser.Controller.MediaEncodingpublic bool DeInterlace(string videoCodec, bool forceDeinterlaceIfSourceIsInterlaced){var videoStream = VideoStream;- var isInputInterlaced = videoStream != null && videoStream.IsInterlaced;+ var isInputInterlaced = videoStream is not null && videoStream.IsInterlaced;if (!isInputInterlaced){diff --git a/MediaBrowser.Controller/Net/BasePeriodicWebSocketListener.cs b/MediaBrowser.Controller/Net/BasePeriodicWebSocketListener.csindex 2fe3a54723..fc9ea37d1e 100644--- a/MediaBrowser.Controller/Net/BasePeriodicWebSocketListener.cs+++ b/MediaBrowser.Controller/Net/BasePeriodicWebSocketListener.cs@@ -166,7 +166,7 @@ namespace MediaBrowser.Controller.Netvar data = await GetDataToSend().ConfigureAwait(false);- if (data != null)+ if (data is not null){await connection.SendAsync(new WebSocketMessage<TReturnDataType>@@ -204,7 +204,7 @@ namespace MediaBrowser.Controller.Net{var connection = _activeConnections.FirstOrDefault(c => c.Item1 == message.Connection);- if (connection != null)+ if (connection is not null){DisposeConnection(connection);}diff --git a/MediaBrowser.Controller/Playlists/Playlist.cs b/MediaBrowser.Controller/Playlists/Playlist.csindex 7ae9ff7463..e6bcc9ea85 100644--- a/MediaBrowser.Controller/Playlists/Playlist.cs+++ b/MediaBrowser.Controller/Playlists/Playlist.cs@@ -165,7 +165,7 @@ namespace MediaBrowser.Controller.Playlistspublic static List<BaseItem> GetPlaylistItems(string playlistMediaType, IEnumerable<BaseItem> inputItems, User user, DtoOptions options){- if (user != null)+ if (user is not null){inputItems = inputItems.Where(i => i.IsVisible(user));}diff --git a/MediaBrowser.Controller/Providers/MetadataRefreshOptions.cs b/MediaBrowser.Controller/Providers/MetadataRefreshOptions.csindex a38bbaf695..8a37094620 100644--- a/MediaBrowser.Controller/Providers/MetadataRefreshOptions.cs+++ b/MediaBrowser.Controller/Providers/MetadataRefreshOptions.cs@@ -32,7 +32,7 @@ namespace MediaBrowser.Controller.ProvidersSearchResult = copy.SearchResult;RemoveOldMetadata = copy.RemoveOldMetadata;- if (copy.RefreshPaths != null && copy.RefreshPaths.Length > 0)+ if (copy.RefreshPaths is not null && copy.RefreshPaths.Length > 0){RefreshPaths ??= Array.Empty<string>();@@ -58,7 +58,7 @@ namespace MediaBrowser.Controller.Providerspublic bool RefreshItem(BaseItem item){- if (RefreshPaths != null && RefreshPaths.Length > 0)+ if (RefreshPaths is not null && RefreshPaths.Length > 0){return RefreshPaths.Contains(item.Path ?? string.Empty, StringComparison.OrdinalIgnoreCase);}diff --git a/MediaBrowser.Controller/Resolvers/ItemResolver.cs b/MediaBrowser.Controller/Resolvers/ItemResolver.csindex e7bf013fa2..a6da8384e8 100644--- a/MediaBrowser.Controller/Resolvers/ItemResolver.cs+++ b/MediaBrowser.Controller/Resolvers/ItemResolver.cs@@ -46,7 +46,7 @@ namespace MediaBrowser.Controller.Resolvers{var item = Resolve(args);- if (item != null)+ if (item is not null){SetInitialItemValues(item, args);}diff --git a/MediaBrowser.Controller/Session/SessionInfo.cs b/MediaBrowser.Controller/Session/SessionInfo.csindex d30472f224..25bf23d61b 100644--- a/MediaBrowser.Controller/Session/SessionInfo.cs+++ b/MediaBrowser.Controller/Session/SessionInfo.cs@@ -357,7 +357,7 @@ namespace MediaBrowser.Controller.Session{lock (_progressLock){- if (_progressTimer != null)+ if (_progressTimer is not null){_progressTimer.Dispose();_progressTimer = null;diff --git a/MediaBrowser.Controller/SyncPlay/Queue/PlayQueueManager.cs b/MediaBrowser.Controller/SyncPlay/Queue/PlayQueueManager.csindex 3a7685f347..ddbfeb8de8 100644--- a/MediaBrowser.Controller/SyncPlay/Queue/PlayQueueManager.cs+++ b/MediaBrowser.Controller/SyncPlay/Queue/PlayQueueManager.cs@@ -180,7 +180,7 @@ namespace MediaBrowser.Controller.SyncPlay.Queue_shuffledPlaylist.Clear();LastChange = DateTime.UtcNow;- if (!clearPlayingItem && playingItem != null)+ if (!clearPlayingItem && playingItem is not null){_sortedPlaylist.Add(playingItem);if (ShuffleMode.Equals(GroupShuffleMode.Shuffle))@@ -298,7 +298,7 @@ namespace MediaBrowser.Controller.SyncPlay.QueueLastChange = DateTime.UtcNow;- if (playingItem != null)+ if (playingItem is not null){if (playlistItemIds.Contains(playingItem.PlaylistItemId)){diff --git a/MediaBrowser.LocalMetadata/Images/LocalImageProvider.cs b/MediaBrowser.LocalMetadata/Images/LocalImageProvider.csindex e92c4f83ea..894aebed4b 100644--- a/MediaBrowser.LocalMetadata/Images/LocalImageProvider.cs+++ b/MediaBrowser.LocalMetadata/Images/LocalImageProvider.cs@@ -94,7 +94,7 @@ namespace MediaBrowser.LocalMetadata.Images{var season = item as Season;var series = season?.Series;- if (series != null && series.IsFileProtocol)+ if (series is not null && series.IsFileProtocol){return true;}@@ -334,7 +334,7 @@ namespace MediaBrowser.LocalMetadata.Imagesvar extraFanartFolder = files.FirstOrDefault(i => string.Equals(i.Name, "extrafanart", StringComparison.OrdinalIgnoreCase));- if (extraFanartFolder != null)+ if (extraFanartFolder is not null){PopulateBackdropsFromExtraFanart(extraFanartFolder.FullName, images);}diff --git a/MediaBrowser.LocalMetadata/Parsers/BaseItemXmlParser.cs b/MediaBrowser.LocalMetadata/Parsers/BaseItemXmlParser.csindex 92ce14be23..46625c5c8d 100644--- a/MediaBrowser.LocalMetadata/Parsers/BaseItemXmlParser.cs+++ b/MediaBrowser.LocalMetadata/Parsers/BaseItemXmlParser.cs@@ -721,7 +721,7 @@ namespace MediaBrowser.LocalMetadata.Parsers{var child = GetShare(subReader);- if (child != null)+ if (child is not null){list.Add(child);}diff --git a/MediaBrowser.LocalMetadata/Parsers/BoxSetXmlParser.cs b/MediaBrowser.LocalMetadata/Parsers/BoxSetXmlParser.csindex 7df800971a..952ed3aacb 100644--- a/MediaBrowser.LocalMetadata/Parsers/BoxSetXmlParser.cs+++ b/MediaBrowser.LocalMetadata/Parsers/BoxSetXmlParser.cs@@ -71,7 +71,7 @@ namespace MediaBrowser.LocalMetadata.Parsers{var child = GetLinkedChild(subReader);- if (child != null)+ if (child is not null){list.Add(child);}diff --git a/MediaBrowser.LocalMetadata/Parsers/PlaylistXmlParser.cs b/MediaBrowser.LocalMetadata/Parsers/PlaylistXmlParser.csindex b84307cb20..88b190f2b4 100644--- a/MediaBrowser.LocalMetadata/Parsers/PlaylistXmlParser.cs+++ b/MediaBrowser.LocalMetadata/Parsers/PlaylistXmlParser.cs@@ -84,7 +84,7 @@ namespace MediaBrowser.LocalMetadata.Parsers{var child = GetLinkedChild(subReader);- if (child != null)+ if (child is not null){list.Add(child);}diff --git a/MediaBrowser.LocalMetadata/Savers/BaseXmlSaver.cs b/MediaBrowser.LocalMetadata/Savers/BaseXmlSaver.csindex 2d94c5de85..d92b504740 100644--- a/MediaBrowser.LocalMetadata/Savers/BaseXmlSaver.cs+++ b/MediaBrowser.LocalMetadata/Savers/BaseXmlSaver.cs@@ -126,7 +126,7 @@ namespace MediaBrowser.LocalMetadata.Saversvar baseItem = item;- if (baseItem != null)+ if (baseItem is not null){await AddCommonNodesAsync(baseItem, writer).ConfigureAwait(false);}@@ -309,7 +309,7 @@ namespace MediaBrowser.LocalMetadata.Saversawait writer.WriteElementStringAsync(null, "RunningTime", null, Math.Floor(timespan.TotalMinutes).ToString(CultureInfo.InvariantCulture)).ConfigureAwait(false);}- if (item.ProviderIds != null)+ if (item.ProviderIds is not null){foreach (var providerKey in item.ProviderIds.Keys){diff --git a/MediaBrowser.MediaEncoding/BdInfo/BdInfoDirectoryInfo.cs b/MediaBrowser.MediaEncoding/BdInfo/BdInfoDirectoryInfo.csindex 409379c355..7e026b42e3 100644--- a/MediaBrowser.MediaEncoding/BdInfo/BdInfoDirectoryInfo.cs+++ b/MediaBrowser.MediaEncoding/BdInfo/BdInfoDirectoryInfo.cs@@ -34,7 +34,7 @@ namespace MediaBrowser.MediaEncoding.BdInfoget{var parentFolder = System.IO.Path.GetDirectoryName(_impl.FullName);- if (parentFolder != null)+ if (parentFolder is not null){return new BdInfoDirectoryInfo(_fileSystem, parentFolder);}diff --git a/MediaBrowser.MediaEncoding/BdInfo/BdInfoExaminer.cs b/MediaBrowser.MediaEncoding/BdInfo/BdInfoExaminer.csindex bde3d2e847..3e53cbf29f 100644--- a/MediaBrowser.MediaEncoding/BdInfo/BdInfoExaminer.cs+++ b/MediaBrowser.MediaEncoding/BdInfo/BdInfoExaminer.cs@@ -89,7 +89,7 @@ namespace MediaBrowser.MediaEncoding.BdInfooutputStream.PlaylistName = playlist.Name;- if (playlist.StreamClips != null && playlist.StreamClips.Any())+ if (playlist.StreamClips is not null && playlist.StreamClips.Any()){// Get the files in the playlistoutputStream.Files = playlist.StreamClips.Select(i => i.StreamFile.Name).ToArray();diff --git a/MediaBrowser.MediaEncoding/Encoder/EncoderValidator.cs b/MediaBrowser.MediaEncoding/Encoder/EncoderValidator.csindex 1ae3c976dc..8479b7d50d 100644--- a/MediaBrowser.MediaEncoding/Encoder/EncoderValidator.cs+++ b/MediaBrowser.MediaEncoding/Encoder/EncoderValidator.cs@@ -188,11 +188,11 @@ namespace MediaBrowser.MediaEncoding.Encoder// Work out what the version under test isvar version = GetFFmpegVersionInternal(versionOutput);- _logger.LogInformation("Found ffmpeg version {Version}", version != null ? version.ToString() : "unknown");+ _logger.LogInformation("Found ffmpeg version {Version}", version is not null ? version.ToString() : "unknown");if (version is null){- if (MaxVersion != null) // Version is unknown+ if (MaxVersion is not null) // Version is unknown{if (MinVersion == MaxVersion){@@ -215,7 +215,7 @@ namespace MediaBrowser.MediaEncoding.Encoder_logger.LogWarning("FFmpeg validation: The minimum recommended version is {MinVersion}", MinVersion);return false;}- else if (MaxVersion != null && version > MaxVersion) // Version is above what we recommend+ else if (MaxVersion is not null && version > MaxVersion) // Version is above what we recommend{_logger.LogWarning("FFmpeg validation: The maximum recommended version is {MaxVersion}", MaxVersion);return false;diff --git a/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs b/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.csindex 9abfb91027..addaea33e3 100644--- a/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs+++ b/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs@@ -157,7 +157,7 @@ namespace MediaBrowser.MediaEncoding.Encoder_configurationManager.SaveConfiguration("encoding", options);// Only if mpeg path is set, try and set path to probe- if (_ffmpegPath != null)+ if (_ffmpegPath is not null){// Determine a probe path from the mpeg path_ffprobePath = Regex.Replace(_ffmpegPath, @"[^\/\\]+?(\.[^\/\\\n.]+)?$", @"ffprobe$1");@@ -536,7 +536,7 @@ namespace MediaBrowser.MediaEncoding.Encoderthrow new FfmpegException("ffprobe failed - streams and format are both null.");}- if (result.Streams != null)+ if (result.Streams is not null){// Normalize aspect ratio if invalidforeach (var stream in result.Streams)@@ -660,7 +660,7 @@ namespace MediaBrowser.MediaEncoding.Encodervar filters = new List<string>();// deinterlace using bwdif algorithm for video stream.- if (videoStream != null && videoStream.IsInterlaced)+ if (videoStream is not null && videoStream.IsInterlaced){filters.Add("bwdif=0:-1:0");}@@ -1017,7 +1017,7 @@ namespace MediaBrowser.MediaEncoding.Encoder{if (!_disposed){- if (Process != null)+ if (Process is not null){Process.Exited -= OnProcessExited;DisposeProcess(Process);diff --git a/MediaBrowser.MediaEncoding/Probing/FFProbeHelpers.cs b/MediaBrowser.MediaEncoding/Probing/FFProbeHelpers.csindex 205e84153b..1b5b5262a2 100644--- a/MediaBrowser.MediaEncoding/Probing/FFProbeHelpers.cs+++ b/MediaBrowser.MediaEncoding/Probing/FFProbeHelpers.cs@@ -17,17 +17,17 @@ namespace MediaBrowser.MediaEncoding.Probing{ArgumentNullException.ThrowIfNull(result);- if (result.Format?.Tags != null)+ if (result.Format?.Tags is not null){result.Format.Tags = ConvertDictionaryToCaseInsensitive(result.Format.Tags);}- if (result.Streams != null)+ if (result.Streams is not null){// Convert all dictionaries to case insensitiveforeach (var stream in result.Streams){- if (stream.Tags != null)+ if (stream.Tags is not null){stream.Tags = ConvertDictionaryToCaseInsensitive(stream.Tags);}diff --git a/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs b/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.csindex d5e90e8558..7a3462b970 100644--- a/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs+++ b/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs@@ -83,16 +83,16 @@ namespace MediaBrowser.MediaEncoding.Probingvar internalStreams = data.Streams ?? Array.Empty<MediaStreamInfo>();info.MediaStreams = internalStreams.Select(s => GetMediaStream(isAudio, s, data.Format))- .Where(i => i != null)+ .Where(i => i is not null)// Drop subtitle streams if we don't know the codec because it will just cause failures if we don't know how to handle them.Where(i => i.Type != MediaStreamType.Subtitle || !string.IsNullOrWhiteSpace(i.Codec)).ToList();info.MediaAttachments = internalStreams.Select(GetMediaAttachment)- .Where(i => i != null)+ .Where(i => i is not null).ToList();- if (data.Format != null)+ if (data.Format is not null){info.Container = NormalizeFormat(data.Format.FormatName);@@ -110,7 +110,7 @@ namespace MediaBrowser.MediaEncoding.Probingvar tagStream = data.Streams?.FirstOrDefault(i => string.Equals(i.CodecType, tagStreamType, StringComparison.OrdinalIgnoreCase));- if (tagStream?.Tags != null)+ if (tagStream?.Tags is not null){foreach (var (key, value) in tagStream.Tags){@@ -118,7 +118,7 @@ namespace MediaBrowser.MediaEncoding.Probing}}- if (data.Format?.Tags != null)+ if (data.Format?.Tags is not null){foreach (var (key, value) in data.Format.Tags){@@ -182,7 +182,7 @@ namespace MediaBrowser.MediaEncoding.ProbingFetchStudios(info, tags, "copyright");var iTunExtc = tags.GetFirstNotNullNorWhiteSpaceValue("iTunEXTC");- if (iTunExtc != null)+ if (iTunExtc is not null){var parts = iTunExtc.Split('|', StringSplitOptions.RemoveEmptyEntries);// Example@@ -199,19 +199,19 @@ namespace MediaBrowser.MediaEncoding.Probing}var iTunXml = tags.GetFirstNotNullNorWhiteSpaceValue("iTunMOVI");- if (iTunXml != null)+ if (iTunXml is not null){FetchFromItunesInfo(iTunXml, info);}- if (data.Format != null && !string.IsNullOrEmpty(data.Format.Duration))+ if (data.Format is not null && !string.IsNullOrEmpty(data.Format.Duration)){info.RunTimeTicks = TimeSpan.FromSeconds(double.Parse(data.Format.Duration, CultureInfo.InvariantCulture)).Ticks;}FetchWtvInfo(info, data);- if (data.Chapters != null)+ if (data.Chapters is not null){info.Chapters = data.Chapters.Select(GetChapterInfo).ToArray();}@@ -459,7 +459,7 @@ namespace MediaBrowser.MediaEncoding.Probingusing (var subtree = reader.ReadSubtree()){var dict = GetNameValuePair(subtree);- if (dict != null)+ if (dict is not null){pairs.Add(dict);}@@ -614,7 +614,7 @@ namespace MediaBrowser.MediaEncoding.Probingattachment.CodecTag = streamInfo.CodecTagString;}- if (streamInfo.Tags != null)+ if (streamInfo.Tags is not null){attachment.FileName = GetDictionaryValue(streamInfo.Tags, "filename");attachment.MimeType = GetDictionaryValue(streamInfo.Tags, "mimetype");@@ -680,7 +680,7 @@ namespace MediaBrowser.MediaEncoding.Probingstream.CodecTag = streamInfo.CodecTagString;}- if (streamInfo.Tags != null)+ if (streamInfo.Tags is not null){stream.Language = GetDictionaryValue(streamInfo.Tags, "language");stream.Comment = GetDictionaryValue(streamInfo.Tags, "comment");@@ -855,7 +855,7 @@ namespace MediaBrowser.MediaEncoding.Probingstream.ColorPrimaries = streamInfo.ColorPrimaries;}- if (streamInfo.SideDataList != null)+ if (streamInfo.SideDataList is not null){foreach (var data in streamInfo.SideDataList){@@ -899,7 +899,7 @@ namespace MediaBrowser.MediaEncoding.Probing// The bitrate info of FLAC musics and some videos is included in formatInfo.if (bitrate == 0- && formatInfo != null+ && formatInfo is not null&& !string.IsNullOrEmpty(formatInfo.BitRate)&& (stream.Type == MediaStreamType.Video || (isAudio && stream.Type == MediaStreamType.Audio))){@@ -934,7 +934,7 @@ namespace MediaBrowser.MediaEncoding.Probing{var durationInSeconds = GetRuntimeSecondsFromTags(streamInfo);var bytes = GetNumberOfBytesFromTags(streamInfo);- if (durationInSeconds != null && bytes != null)+ if (durationInSeconds is not null && bytes is not null){var bps = Convert.ToInt32(bytes * 8 / durationInSeconds, CultureInfo.InvariantCulture);if (bps > 0)@@ -945,7 +945,7 @@ namespace MediaBrowser.MediaEncoding.Probing}var disposition = streamInfo.Disposition;- if (disposition != null)+ if (disposition is not null){if (disposition.GetValueOrDefault("default") == 1){@@ -1294,7 +1294,7 @@ namespace MediaBrowser.MediaEncoding.Probing// Set album artistvar albumArtist = tags.GetFirstNotNullNorWhiteSpaceValue("albumartist", "album artist", "album_artist");- audio.AlbumArtists = albumArtist != null+ audio.AlbumArtists = albumArtist is not null? SplitDistinctArtists(albumArtist, _nameDelimiters, true).ToArray(): Array.Empty<string>();@@ -1489,7 +1489,7 @@ namespace MediaBrowser.MediaEncoding.Probing{var info = new ChapterInfo();- if (chapter.Tags != null && chapter.Tags.TryGetValue("title", out string name))+ if (chapter.Tags is not null && chapter.Tags.TryGetValue("title", out string name)){info.Name = name;}diff --git a/MediaBrowser.MediaEncoding/Subtitles/SubtitleEncoder.cs b/MediaBrowser.MediaEncoding/Subtitles/SubtitleEncoder.csindex 9185faf67b..4bc329a8a5 100644--- a/MediaBrowser.MediaEncoding/Subtitles/SubtitleEncoder.cs+++ b/MediaBrowser.MediaEncoding/Subtitles/SubtitleEncoder.cs@@ -174,7 +174,7 @@ namespace MediaBrowser.MediaEncoding.Subtitlesvar result = CharsetDetector.DetectFromStream(stream).Detected;stream.Position = 0;- if (result != null)+ if (result is not null){_logger.LogDebug("charset {CharSet} detected for {Path}", result.EncodingName, fileInfo.Path);diff --git a/MediaBrowser.Model/Dlna/ContainerProfile.cs b/MediaBrowser.Model/Dlna/ContainerProfile.csindex 9f7654a697..927df8e4ef 100644--- a/MediaBrowser.Model/Dlna/ContainerProfile.cs+++ b/MediaBrowser.Model/Dlna/ContainerProfile.cs@@ -36,7 +36,7 @@ namespace MediaBrowser.Model.Dlnapublic static bool ContainsContainer(string? profileContainers, string? inputContainer){var isNegativeList = false;- if (profileContainers != null && profileContainers.StartsWith('-'))+ if (profileContainers is not null && profileContainers.StartsWith('-')){isNegativeList = true;profileContainers = profileContainers.Substring(1);diff --git a/MediaBrowser.Model/Dlna/ContentFeatureBuilder.cs b/MediaBrowser.Model/Dlna/ContentFeatureBuilder.csindex 1a95763610..1d5d0b1de3 100644--- a/MediaBrowser.Model/Dlna/ContentFeatureBuilder.cs+++ b/MediaBrowser.Model/Dlna/ContentFeatureBuilder.cs@@ -192,7 +192,7 @@ namespace MediaBrowser.Model.Dlnavar orgPnValues = new List<string>();- if (mediaProfile != null && !string.IsNullOrEmpty(mediaProfile.OrgPn))+ if (mediaProfile is not null && !string.IsNullOrEmpty(mediaProfile.OrgPn)){orgPnValues.AddRange(mediaProfile.OrgPn.Split(',', StringSplitOptions.RemoveEmptyEntries));}diff --git a/MediaBrowser.Model/Dlna/ResolutionNormalizer.cs b/MediaBrowser.Model/Dlna/ResolutionNormalizer.csindex 94071b4196..ce422a2288 100644--- a/MediaBrowser.Model/Dlna/ResolutionNormalizer.cs+++ b/MediaBrowser.Model/Dlna/ResolutionNormalizer.cs@@ -39,7 +39,7 @@ namespace MediaBrowser.Model.Dlna}var resolutionConfig = GetResolutionConfiguration(outputBitrate);- if (resolutionConfig != null)+ if (resolutionConfig is not null){var originvalValue = maxWidth;diff --git a/MediaBrowser.Model/Dlna/StreamBuilder.cs b/MediaBrowser.Model/Dlna/StreamBuilder.csindex 94112ab166..a004edc6a8 100644--- a/MediaBrowser.Model/Dlna/StreamBuilder.cs+++ b/MediaBrowser.Model/Dlna/StreamBuilder.cs@@ -53,7 +53,7 @@ namespace MediaBrowser.Model.Dlnaforeach (MediaSourceInfo i in mediaSources){StreamInfo streamInfo = BuildAudioItem(i, options);- if (streamInfo != null)+ if (streamInfo is not null){streams.Add(streamInfo);}@@ -86,7 +86,7 @@ namespace MediaBrowser.Model.Dlnaforeach (MediaSourceInfo i in mediaSources){var streamInfo = BuildVideoItem(i, options);- if (streamInfo != null)+ if (streamInfo is not null){streams.Add(streamInfo);}@@ -245,7 +245,7 @@ namespace MediaBrowser.Model.Dlnavar formats = ContainerProfile.SplitValue(inputContainer);- if (profile != null)+ if (profile is not null){var playProfiles = playProfile is null ? profile.DirectPlayProfiles : new[] { playProfile };foreach (var format in formats)@@ -330,7 +330,7 @@ namespace MediaBrowser.Model.Dlna}}- if (transcodingProfile != null)+ if (transcodingProfile is not null){if (!item.SupportsTranscoding){@@ -580,7 +580,7 @@ namespace MediaBrowser.Model.Dlnavar subtitleStream = playlistItem.SubtitleStreamIndex.HasValue ? item.GetMediaStream(MediaStreamType.Subtitle, playlistItem.SubtitleStreamIndex.Value) : null;var audioStream = item.GetDefaultAudioStream(options.AudioStreamIndex ?? item.DefaultAudioStreamIndex);- if (audioStream != null)+ if (audioStream is not null){playlistItem.AudioStreamIndex = audioStream.Index;}@@ -643,7 +643,7 @@ namespace MediaBrowser.Model.Dlnaelse if (directPlay == PlayMethod.DirectStream){playlistItem.AudioStreamIndex = audioStream?.Index;- if (audioStream != null)+ if (audioStream is not null){playlistItem.AudioCodecs = ContainerProfile.SplitValue(directPlayProfile.AudioCodec);}@@ -652,7 +652,7 @@ namespace MediaBrowser.Model.DlnaBuildStreamVideoItem(playlistItem, options, item, videoStream, audioStream, candidateAudioStreams, directPlayProfile.Container, directPlayProfile.VideoCodec, directPlayProfile.AudioCodec);}- if (subtitleStream != null)+ if (subtitleStream is not null){var subtitleProfile = GetSubtitleProfile(item, subtitleStream, options.Profile.SubtitleProfiles, directPlay.Value, _transcoderSupport, directPlayProfile.Container, null);@@ -678,7 +678,7 @@ namespace MediaBrowser.Model.Dlna// Can't direct play, find the transcoding profile// If we do this for direct-stream we will overwrite the infovar transcodingProfile = GetVideoTranscodeProfile(item, options, videoStream, audioStream, candidateAudioStreams, subtitleStream, playlistItem);- if (transcodingProfile != null)+ if (transcodingProfile is not null){SetStreamInfoOptionsFromTranscodingProfile(item, playlistItem, transcodingProfile);@@ -686,7 +686,7 @@ namespace MediaBrowser.Model.DlnaplaylistItem.PlayMethod = PlayMethod.Transcode;- if (subtitleStream != null)+ if (subtitleStream is not null){var subtitleProfile = GetSubtitleProfile(item, subtitleStream, options.Profile.SubtitleProfiles, PlayMethod.Transcode, _transcoderSupport, transcodingProfile.Container, transcodingProfile.Protocol);@@ -768,7 +768,7 @@ namespace MediaBrowser.Model.Dlna// Prefer matching video codecsvar videoCodecs = ContainerProfile.SplitValue(videoCodec);var directVideoCodec = ContainerProfile.ContainsContainer(videoCodecs, videoStream?.Codec) ? videoStream?.Codec : null;- if (directVideoCodec != null)+ if (directVideoCodec is not null){// merge directVideoCodec to videoCodecsArray.Resize(ref videoCodecs, videoCodecs.Length + 1);@@ -780,12 +780,12 @@ namespace MediaBrowser.Model.Dlna// Copy video codec options as a starting point, this applies to transcode and direct-streamplaylistItem.MaxFramerate = videoStream?.AverageFrameRate;var qualifier = videoStream?.Codec;- if (videoStream?.Level != null)+ if (videoStream?.Level is not null){playlistItem.SetOption(qualifier, "level", videoStream.Level.Value.ToString(CultureInfo.InvariantCulture));}- if (videoStream?.BitDepth != null)+ if (videoStream?.BitDepth is not null){playlistItem.SetOption(qualifier, "videobitdepth", videoStream.BitDepth.Value.ToString(CultureInfo.InvariantCulture));}@@ -795,7 +795,7 @@ namespace MediaBrowser.Model.DlnaplaylistItem.SetOption(qualifier, "profile", videoStream.Profile.ToLowerInvariant());}- if (videoStream != null && videoStream.Level != 0)+ if (videoStream is not null && videoStream.Level != 0){playlistItem.SetOption(qualifier, "level", videoStream.Level.ToString());}@@ -804,7 +804,7 @@ namespace MediaBrowser.Model.Dlnavar audioCodecs = ContainerProfile.SplitValue(audioCodec);var directAudioStream = candidateAudioStreams.FirstOrDefault(stream => ContainerProfile.ContainsContainer(audioCodecs, stream.Codec));playlistItem.AudioCodecs = audioCodecs;- if (directAudioStream != null)+ if (directAudioStream is not null){audioStream = directAudioStream;playlistItem.AudioStreamIndex = audioStream.Index;@@ -982,7 +982,7 @@ namespace MediaBrowser.Model.Dlna&& audioStream.Channels.HasValue&& audioStream.Channels.Value <= targetAudioChannels.Value&& !string.IsNullOrEmpty(audioStream.Codec)- && targetAudioCodecs != null+ && targetAudioCodecs is not null&& targetAudioCodecs.Length > 0&& !Array.Exists(targetAudioCodecs, elem => string.Equals(audioStream.Codec, elem, StringComparison.OrdinalIgnoreCase))){@@ -1119,7 +1119,7 @@ namespace MediaBrowser.Model.Dlnavar audioStreamMatches = candidateAudioStreams.ToDictionary(s => s, audioStream => CheckVideoAudioStreamDirectPlay(options, mediaSource, container, audioStream));TranscodeReason subtitleProfileReasons = 0;- if (subtitleStream != null)+ if (subtitleStream is not null){var subtitleProfile = GetSubtitleProfile(mediaSource, subtitleStream, options.Profile.SubtitleProfiles, PlayMethod.DirectPlay, _transcoderSupport, container, null);@@ -1206,7 +1206,7 @@ namespace MediaBrowser.Model.Dlna{playMethod = PlayMethod.DirectPlay;}- else if (directStreamFailureReasons == 0 && isEligibleForDirectStream && mediaSource.SupportsDirectStream && directPlayProfile != null)+ else if (directStreamFailureReasons == 0 && isEligibleForDirectStream && mediaSource.SupportsDirectStream && directPlayProfile is not null){playMethod = PlayMethod.DirectStream;}@@ -1218,12 +1218,12 @@ namespace MediaBrowser.Model.Dlna.ThenByDescending(analysis => analysis.Rank).ThenBy(analysis => analysis.Order).ToArray()- .ToLookup(analysis => analysis.Result.PlayMethod != null);+ .ToLookup(analysis => analysis.Result.PlayMethod is not null);var profileMatch = analyzedProfiles[true].Select(analysis => analysis.Result).FirstOrDefault();- if (profileMatch.Profile != null)+ if (profileMatch.Profile is not null){return profileMatch;}diff --git a/MediaBrowser.Model/Dlna/StreamInfo.cs b/MediaBrowser.Model/Dlna/StreamInfo.csindex b82f233ae2..9e0536c733 100644--- a/MediaBrowser.Model/Dlna/StreamInfo.cs+++ b/MediaBrowser.Model/Dlna/StreamInfo.cs@@ -521,7 +521,7 @@ namespace MediaBrowser.Model.Dlna{var videoStream = TargetVideoStream;- if (videoStream != null && videoStream.Width.HasValue && videoStream.Height.HasValue)+ if (videoStream is not null && videoStream.Width.HasValue && videoStream.Height.HasValue){ImageDimensions size = new ImageDimensions(videoStream.Width.Value, videoStream.Height.Value);@@ -540,7 +540,7 @@ namespace MediaBrowser.Model.Dlna{var videoStream = TargetVideoStream;- if (videoStream != null && videoStream.Width.HasValue && videoStream.Height.HasValue)+ if (videoStream is not null && videoStream.Width.HasValue && videoStream.Height.HasValue){ImageDimensions size = new ImageDimensions(videoStream.Width.Value, videoStream.Height.Value);diff --git a/MediaBrowser.Model/Dto/BaseItemPerson.cs b/MediaBrowser.Model/Dto/BaseItemPerson.csindex 6b920b0efb..9c65a2308d 100644--- a/MediaBrowser.Model/Dto/BaseItemPerson.cs+++ b/MediaBrowser.Model/Dto/BaseItemPerson.cs@@ -52,6 +52,6 @@ namespace MediaBrowser.Model.Dto/// </summary>/// <value><c>true</c> if this instance has primary image; otherwise, <c>false</c>.</value>[JsonIgnore]- public bool HasPrimaryImage => PrimaryImageTag != null;+ public bool HasPrimaryImage => PrimaryImageTag is not null;}}diff --git a/MediaBrowser.Model/Notifications/NotificationOptions.cs b/MediaBrowser.Model/Notifications/NotificationOptions.csindex 8708d55f7d..804f51e166 100644--- a/MediaBrowser.Model/Notifications/NotificationOptions.cs+++ b/MediaBrowser.Model/Notifications/NotificationOptions.cs@@ -86,7 +86,7 @@ namespace MediaBrowser.Model.Notifications{NotificationOption opt = GetOptions(type);- return opt != null && opt.Enabled;+ return opt is not null && opt.Enabled;}public bool IsServiceEnabled(string service, string notificationType)@@ -101,7 +101,7 @@ namespace MediaBrowser.Model.Notifications{NotificationOption opt = GetOptions(type);- return opt != null+ return opt is not null&& opt.Enabled&& !opt.DisabledMonitorUsers.Contains(userId.ToString("N"), StringComparison.OrdinalIgnoreCase);}@@ -110,7 +110,7 @@ namespace MediaBrowser.Model.Notifications{NotificationOption opt = GetOptions(type);- if (opt != null && opt.Enabled)+ if (opt is not null && opt.Enabled){if (opt.SendToUserMode == SendToUserType.All){diff --git a/MediaBrowser.Providers/Manager/ImageSaver.cs b/MediaBrowser.Providers/Manager/ImageSaver.csindex 4632e1d511..2061d384c4 100644--- a/MediaBrowser.Providers/Manager/ImageSaver.cs+++ b/MediaBrowser.Providers/Manager/ImageSaver.cs@@ -108,7 +108,7 @@ namespace MediaBrowser.Providers.Manager{var series = season.Series;- if (series != null && series.SupportsLocalMetadata && series.IsSaveLocalMetadataEnabled())+ if (series is not null && series.SupportsLocalMetadata && series.IsSaveLocalMetadataEnabled()){saveLocally = true;}@@ -144,7 +144,7 @@ namespace MediaBrowser.Providers.Manager}var currentImage = GetCurrentImage(item, type, index);- var currentImageIsLocalFile = currentImage != null && currentImage.IsLocalFile;+ var currentImageIsLocalFile = currentImage is not null && currentImage.IsLocalFile;var currentImagePath = currentImage?.Path;var savedPaths = new List<string>();@@ -374,7 +374,7 @@ namespace MediaBrowser.Providers.Managerif (type == ImageType.Thumb && saveLocally){- if (season != null && season.IndexNumber.HasValue)+ if (season is not null && season.IndexNumber.HasValue){var seriesFolder = season.SeriesPath;@@ -397,7 +397,7 @@ namespace MediaBrowser.Providers.Managerif (type == ImageType.Banner && saveLocally){- if (season != null && season.IndexNumber.HasValue)+ if (season is not null && season.IndexNumber.HasValue){var seriesFolder = season.SeriesPath;@@ -533,7 +533,7 @@ namespace MediaBrowser.Providers.Managerreturn new[] { GetSavePathForItemInMixedFolder(item, type, "fanart", extension) };}- if (season != null && season.IndexNumber.HasValue)+ if (season is not null && season.IndexNumber.HasValue){var seriesFolder = season.SeriesPath;@@ -576,7 +576,7 @@ namespace MediaBrowser.Providers.Managerif (type == ImageType.Primary){- if (season != null && season.IndexNumber.HasValue)+ if (season is not null && season.IndexNumber.HasValue){var seriesFolder = season.SeriesPath;diff --git a/MediaBrowser.Providers/Manager/ItemImageProvider.cs b/MediaBrowser.Providers/Manager/ItemImageProvider.csindex 23e9cbd34a..a0f48840e3 100644--- a/MediaBrowser.Providers/Manager/ItemImageProvider.cs+++ b/MediaBrowser.Providers/Manager/ItemImageProvider.cs@@ -73,7 +73,7 @@ namespace MediaBrowser.Providers.Managerfor (var i = 0; i < _singularImages.Length; i++){var currentImage = item.GetImageInfo(_singularImages[i], 0);- if (currentImage != null)+ if (currentImage is not null){singular.Add(currentImage);}@@ -395,7 +395,7 @@ namespace MediaBrowser.Providers.Managervar type = _singularImages[i];var image = GetFirstLocalImageInfoByType(images, type);- if (image != null)+ if (image is not null){var currentImage = item.GetImageInfo(type, 0);diff --git a/MediaBrowser.Providers/Manager/MetadataService.cs b/MediaBrowser.Providers/Manager/MetadataService.csindex 8bd1b487dc..077bb30f4c 100644--- a/MediaBrowser.Providers/Manager/MetadataService.cs+++ b/MediaBrowser.Providers/Manager/MetadataService.cs@@ -146,7 +146,7 @@ namespace MediaBrowser.Providers.Manager{var id = itemOfType.GetLookupInfo();- if (refreshOptions.SearchResult != null)+ if (refreshOptions.SearchResult is not null){ApplySearchResult(id, refreshOptions.SearchResult);}@@ -190,7 +190,7 @@ namespace MediaBrowser.Providers.Managerif (item.IsFileProtocol){var file = TryGetFile(item.Path, refreshOptions.DirectoryService);- if (file != null)+ if (file is not null){item.DateModified = file.LastWriteTimeUtc;}@@ -243,7 +243,7 @@ namespace MediaBrowser.Providers.Managerprotected async Task SaveItemAsync(MetadataResult<TItemType> result, ItemUpdateType reason, CancellationToken cancellationToken){- if (result.Item.SupportsPeople && result.People != null)+ if (result.Item.SupportsPeople && result.People is not null){var baseItem = result.Item;@@ -815,7 +815,7 @@ namespace MediaBrowser.Providers.Managervar providerName = provider.GetType().Name;Logger.LogDebug("Running {Provider} for {Item}", providerName, logName);- if (id != null && !tmpDataMerged)+ if (id is not null && !tmpDataMerged){MergeNewData(temp.Item, id);tmpDataMerged = true;@@ -1009,7 +1009,7 @@ namespace MediaBrowser.Providers.Manager{targetResult.People = sourceResult.People;}- else if (targetResult.People != null && sourceResult.People != null)+ else if (targetResult.People is not null && sourceResult.People is not null){MergePeople(sourceResult.People, targetResult.People);}@@ -1114,7 +1114,7 @@ namespace MediaBrowser.Providers.Managervar normalizedName = person.Name.RemoveDiacritics();var personInSource = source.FirstOrDefault(i => string.Equals(i.Name.RemoveDiacritics(), normalizedName, StringComparison.OrdinalIgnoreCase));- if (personInSource != null)+ if (personInSource is not null){foreach (var providerId in personInSource.ProviderIds){diff --git a/MediaBrowser.Providers/Manager/ProviderManager.cs b/MediaBrowser.Providers/Manager/ProviderManager.csindex 07d6b2b5eb..d3ac2f6cda 100644--- a/MediaBrowser.Providers/Manager/ProviderManager.cs+++ b/MediaBrowser.Providers/Manager/ProviderManager.cs@@ -881,7 +881,7 @@ namespace MediaBrowser.Providers.Manageri.UrlFormatString,value)};- }).Where(i => i != null)+ }).Where(i => i is not null).Concat(item.GetRelatedUrls())!; // We just filtered out all the nulls}@@ -1071,7 +1071,7 @@ namespace MediaBrowser.Providers.Managervar musicArtists = albums.Select(i => i.MusicArtist)- .Where(i => i != null);+ .Where(i => i is not null);var musicArtistRefreshTasks = musicArtists.Select(i => i.ValidateChildren(new SimpleProgress<double>(), options, true, cancellationToken));diff --git a/MediaBrowser.Providers/MediaInfo/AudioFileProber.cs b/MediaBrowser.Providers/MediaInfo/AudioFileProber.csindex 3699e8f497..74210b1f22 100644--- a/MediaBrowser.Providers/MediaInfo/AudioFileProber.cs+++ b/MediaBrowser.Providers/MediaInfo/AudioFileProber.cs@@ -149,7 +149,7 @@ namespace MediaBrowser.Providers.MediaInfotags = file.GetTag(TagTypes.Id3v1);}- if (tags != null)+ if (tags is not null){if (audio.SupportsPeople && !audio.LockedFields.Contains(MetadataField.Cast)){diff --git a/MediaBrowser.Providers/MediaInfo/EmbeddedImageProvider.cs b/MediaBrowser.Providers/MediaInfo/EmbeddedImageProvider.csindex a326de18f7..fed23df152 100644--- a/MediaBrowser.Providers/MediaInfo/EmbeddedImageProvider.cs+++ b/MediaBrowser.Providers/MediaInfo/EmbeddedImageProvider.cs@@ -138,7 +138,7 @@ namespace MediaBrowser.Providers.MediaInfo.FirstOrDefault(attachment => !string.IsNullOrEmpty(attachment.FileName)&& imageFileNames.Any(name => attachment.FileName.Contains(name, StringComparison.OrdinalIgnoreCase)));- if (attachmentStream != null)+ if (attachmentStream is not null){return await ExtractAttachment(item, attachmentStream, mediaSource, cancellationToken);}diff --git a/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs b/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.csindex 5bd0c90cea..58b23a36df 100644--- a/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs+++ b/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs@@ -180,7 +180,7 @@ namespace MediaBrowser.Providers.MediaInfovar startIndex = mediaStreams.Count == 0 ? 0 : (mediaStreams.Max(i => i.Index) + 1);- if (mediaInfo != null)+ if (mediaInfo is not null){foreach (var mediaStream in mediaInfo.MediaStreams){@@ -218,7 +218,7 @@ namespace MediaBrowser.Providers.MediaInfovideo.Container = mediaInfo.Container;chapters = mediaInfo.Chapters ?? Array.Empty<ChapterInfo>();- if (blurayInfo != null)+ if (blurayInfo is not null){FetchBdInfo(video, ref chapters, mediaStreams, blurayInfo);}@@ -241,7 +241,7 @@ namespace MediaBrowser.Providers.MediaInfovar libraryOptions = _libraryManager.GetLibraryOptions(video);- if (mediaInfo != null)+ if (mediaInfo is not null){FetchEmbeddedInfo(video, mediaInfo, options, libraryOptions);FetchPeople(video, mediaInfo, options);@@ -288,7 +288,7 @@ namespace MediaBrowser.Providers.MediaInfoNormalizeChapterNames(chapters);var extractDuringScan = false;- if (libraryOptions != null)+ if (libraryOptions is not null){extractDuringScan = libraryOptions.ExtractChapterImagesDuringLibraryScan;}@@ -333,7 +333,7 @@ namespace MediaBrowser.Providers.MediaInfovar videoStream = mediaStreams.FirstOrDefault(s => s.Type == MediaStreamType.Video);// Grab the values that ffprobe recorded- if (videoStream != null)+ if (videoStream is not null){currentBitRate = videoStream.BitRate;currentWidth = videoStream.Width;@@ -349,7 +349,7 @@ namespace MediaBrowser.Providers.MediaInfovideo.RunTimeTicks = blurayInfo.RunTimeTicks;}- if (blurayInfo.Chapters != null)+ if (blurayInfo.Chapters is not null){double[] brChapter = blurayInfo.Chapters;chapters = new ChapterInfo[brChapter.Length];@@ -365,7 +365,7 @@ namespace MediaBrowser.Providers.MediaInfovideoStream = mediaStreams.FirstOrDefault(s => s.Type == MediaStreamType.Video);// Use the ffprobe values if these are empty- if (videoStream != null)+ if (videoStream is not null){videoStream.BitRate = IsEmpty(videoStream.BitRate) ? currentBitRate : videoStream.BitRate;videoStream.Width = IsEmpty(videoStream.Width) ? currentWidth : videoStream.Width;@@ -693,7 +693,7 @@ namespace MediaBrowser.Providers.MediaInfobyte? titleNumber = null;- if (primaryTitle != null)+ if (primaryTitle is not null){titleNumber = primaryTitle.VideoTitleSetNumber;item.RunTimeTicks = GetRuntime(primaryTitle);diff --git a/MediaBrowser.Providers/MediaInfo/MediaInfoResolver.cs b/MediaBrowser.Providers/MediaInfo/MediaInfoResolver.csindex bb2d584c10..909cbb9b9c 100644--- a/MediaBrowser.Providers/MediaInfo/MediaInfoResolver.cs+++ b/MediaBrowser.Providers/MediaInfo/MediaInfoResolver.cs@@ -199,7 +199,7 @@ namespace MediaBrowser.Providers.MediaInfo{var externalPathInfo = _externalPathParser.ParseFile(file, fileNameWithoutExtension[prefix.Length..].ToString());- if (externalPathInfo != null)+ if (externalPathInfo is not null){externalPathInfos.Add(externalPathInfo);}diff --git a/MediaBrowser.Providers/MediaInfo/ProbeProvider.cs b/MediaBrowser.Providers/MediaInfo/ProbeProvider.csindex 3bdc927964..2800219552 100644--- a/MediaBrowser.Providers/MediaInfo/ProbeProvider.cs+++ b/MediaBrowser.Providers/MediaInfo/ProbeProvider.cs@@ -115,7 +115,7 @@ namespace MediaBrowser.Providers.MediaInfoif (!string.IsNullOrWhiteSpace(path) && item.IsFileProtocol){var file = directoryService.GetFile(path);- if (file != null && file.LastWriteTimeUtc != item.DateModified)+ if (file is not null && file.LastWriteTimeUtc != item.DateModified){_logger.LogDebug("Refreshing {ItemPath} due to date modified timestamp change.", path);return true;@@ -123,7 +123,7 @@ namespace MediaBrowser.Providers.MediaInfo}}- if (item.SupportsLocalMetadata && video != null && !video.IsPlaceHolder+ if (item.SupportsLocalMetadata && video is not null && !video.IsPlaceHolder&& !video.SubtitleFiles.SequenceEqual(_subtitleResolver.GetExternalFiles(video, directoryService, false).Select(info => info.Path).ToList(),@@ -133,7 +133,7 @@ namespace MediaBrowser.Providers.MediaInforeturn true;}- if (item.SupportsLocalMetadata && video != null && !video.IsPlaceHolder+ if (item.SupportsLocalMetadata && video is not null && !video.IsPlaceHolder&& !video.AudioFiles.SequenceEqual(_audioResolver.GetExternalFiles(video, directoryService, false).Select(info => info.Path).ToList(),diff --git a/MediaBrowser.Providers/MediaInfo/SubtitleDownloader.cs b/MediaBrowser.Providers/MediaInfo/SubtitleDownloader.csindex b2b93940a8..20fb4dab9c 100644--- a/MediaBrowser.Providers/MediaInfo/SubtitleDownloader.cs+++ b/MediaBrowser.Providers/MediaInfo/SubtitleDownloader.cs@@ -192,7 +192,7 @@ namespace MediaBrowser.Providers.MediaInfovar result = searchResults.FirstOrDefault();- if (result != null)+ if (result is not null){await _subtitleManager.DownloadSubtitles(video, result.Id, cancellationToken).ConfigureAwait(false);diff --git a/MediaBrowser.Providers/Playlists/PlaylistItemsProvider.cs b/MediaBrowser.Providers/Playlists/PlaylistItemsProvider.csindex fe9986d424..db4c5f436e 100644--- a/MediaBrowser.Providers/Playlists/PlaylistItemsProvider.cs+++ b/MediaBrowser.Providers/Playlists/PlaylistItemsProvider.cs@@ -157,7 +157,7 @@ namespace MediaBrowser.Providers.Playlistsif (!string.IsNullOrWhiteSpace(path) && item.IsFileProtocol){var file = directoryService.GetFile(path);- if (file != null && file.LastWriteTimeUtc != item.DateModified)+ if (file is not null && file.LastWriteTimeUtc != item.DateModified){_logger.LogDebug("Refreshing {0} due to date modified timestamp change.", path);return true;diff --git a/MediaBrowser.Providers/Plugins/AudioDb/AudioDbAlbumImageProvider.cs b/MediaBrowser.Providers/Plugins/AudioDb/AudioDbAlbumImageProvider.csindex ad0247fb2e..7fb438d8a0 100644--- a/MediaBrowser.Providers/Plugins/AudioDb/AudioDbAlbumImageProvider.cs+++ b/MediaBrowser.Providers/Plugins/AudioDb/AudioDbAlbumImageProvider.cs@@ -63,7 +63,7 @@ namespace MediaBrowser.Providers.Plugins.AudioDbawait using FileStream jsonStream = AsyncFile.OpenRead(path);var obj = await JsonSerializer.DeserializeAsync<AudioDbAlbumProvider.RootObject>(jsonStream, _jsonOptions, cancellationToken).ConfigureAwait(false);- if (obj != null && obj.album != null && obj.album.Count > 0)+ if (obj is not null && obj.album is not null && obj.album.Count > 0){return GetImages(obj.album[0]);}diff --git a/MediaBrowser.Providers/Plugins/AudioDb/AudioDbAlbumProvider.cs b/MediaBrowser.Providers/Plugins/AudioDb/AudioDbAlbumProvider.csindex 43f30824b8..b92f1f59f7 100644--- a/MediaBrowser.Providers/Plugins/AudioDb/AudioDbAlbumProvider.cs+++ b/MediaBrowser.Providers/Plugins/AudioDb/AudioDbAlbumProvider.cs@@ -71,7 +71,7 @@ namespace MediaBrowser.Providers.Plugins.AudioDbawait using FileStream jsonStream = AsyncFile.OpenRead(path);var obj = await JsonSerializer.DeserializeAsync<RootObject>(jsonStream, _jsonOptions, cancellationToken).ConfigureAwait(false);- if (obj != null && obj.album != null && obj.album.Count > 0)+ if (obj is not null && obj.album is not null && obj.album.Count > 0){result.Item = new MusicAlbum();result.HasMetadata = true;diff --git a/MediaBrowser.Providers/Plugins/AudioDb/AudioDbArtistImageProvider.cs b/MediaBrowser.Providers/Plugins/AudioDb/AudioDbArtistImageProvider.csindex 9c24476608..6d67ad634a 100644--- a/MediaBrowser.Providers/Plugins/AudioDb/AudioDbArtistImageProvider.cs+++ b/MediaBrowser.Providers/Plugins/AudioDb/AudioDbArtistImageProvider.cs@@ -65,7 +65,7 @@ namespace MediaBrowser.Providers.Plugins.AudioDbawait using FileStream jsonStream = AsyncFile.OpenRead(path);var obj = await JsonSerializer.DeserializeAsync<AudioDbArtistProvider.RootObject>(jsonStream, _jsonOptions, cancellationToken).ConfigureAwait(false);- if (obj != null && obj.artists != null && obj.artists.Count > 0)+ if (obj is not null && obj.artists is not null && obj.artists.Count > 0){return GetImages(obj.artists[0]);}diff --git a/MediaBrowser.Providers/Plugins/AudioDb/AudioDbArtistProvider.cs b/MediaBrowser.Providers/Plugins/AudioDb/AudioDbArtistProvider.csindex 538dc67c42..40c4898852 100644--- a/MediaBrowser.Providers/Plugins/AudioDb/AudioDbArtistProvider.cs+++ b/MediaBrowser.Providers/Plugins/AudioDb/AudioDbArtistProvider.cs@@ -70,7 +70,7 @@ namespace MediaBrowser.Providers.Plugins.AudioDbawait using FileStream jsonStream = AsyncFile.OpenRead(path);var obj = await JsonSerializer.DeserializeAsync<RootObject>(jsonStream, _jsonOptions, cancellationToken).ConfigureAwait(false);- if (obj != null && obj.artists != null && obj.artists.Count > 0)+ if (obj is not null && obj.artists is not null && obj.artists.Count > 0){result.Item = new MusicArtist();result.HasMetadata = true;diff --git a/MediaBrowser.Providers/Plugins/MusicBrainz/MusicBrainzAlbumProvider.cs b/MediaBrowser.Providers/Plugins/MusicBrainz/MusicBrainzAlbumProvider.csindex 2b0c43d05f..34f45f0d57 100644--- a/MediaBrowser.Providers/Plugins/MusicBrainz/MusicBrainzAlbumProvider.cs+++ b/MediaBrowser.Providers/Plugins/MusicBrainz/MusicBrainzAlbumProvider.cs@@ -188,7 +188,7 @@ public class MusicBrainzAlbumProvider : IRemoteMetadataProvider<MusicAlbum, Albu// TODO: Actually try to match the release. Simply taking the first result is stupid.var releaseGroup = await _musicBrainzQuery.LookupReleaseGroupAsync(new Guid(releaseGroupId), Include.None, null, cancellationToken).ConfigureAwait(false);var release = releaseGroup.Releases?.Count > 0 ? releaseGroup.Releases[0] : null;- if (release != null)+ if (release is not null){releaseId = release.Id.ToString();result.HasMetadata = true;@@ -214,7 +214,7 @@ public class MusicBrainzAlbumProvider : IRemoteMetadataProvider<MusicAlbum, AlbureleaseResult = releaseSearchResults.Results.Count > 0 ? releaseSearchResults.Results[0].Item : null;}- if (releaseResult != null)+ if (releaseResult is not null){releaseId = releaseResult.Id.ToString();diff --git a/MediaBrowser.Providers/Plugins/MusicBrainz/MusicBrainzArtistProvider.cs b/MediaBrowser.Providers/Plugins/MusicBrainz/MusicBrainzArtistProvider.csindex 2b15154265..718b5a1c46 100644--- a/MediaBrowser.Providers/Plugins/MusicBrainz/MusicBrainzArtistProvider.cs+++ b/MediaBrowser.Providers/Plugins/MusicBrainz/MusicBrainzArtistProvider.cs@@ -133,7 +133,7 @@ public class MusicBrainzArtistProvider : IRemoteMetadataProvider<MusicArtist, Arvar singleResult = searchResults.FirstOrDefault();- if (singleResult != null)+ if (singleResult is not null){musicBrainzId = singleResult.GetProviderId(MetadataProvider.MusicBrainzArtist);result.Item.Overview = singleResult.Overview;diff --git a/MediaBrowser.Providers/Plugins/Omdb/OmdbItemProvider.cs b/MediaBrowser.Providers/Plugins/Omdb/OmdbItemProvider.csindex e5753b2b59..3ef94ca93b 100644--- a/MediaBrowser.Providers/Plugins/Omdb/OmdbItemProvider.cs+++ b/MediaBrowser.Providers/Plugins/Omdb/OmdbItemProvider.cs@@ -90,7 +90,7 @@ namespace MediaBrowser.Providers.Plugins.Omdbvar imdbId = searchInfo.GetProviderId(MetadataProvider.Imdb);var urlQuery = new StringBuilder("plot=full&r=json");- if (episodeSearchInfo != null)+ if (episodeSearchInfo is not null){episodeSearchInfo.SeriesProviderIds.TryGetValue(MetadataProvider.Imdb.ToString(), out imdbId);if (searchInfo.IndexNumber.HasValue)@@ -142,7 +142,7 @@ namespace MediaBrowser.Providers.Plugins.Omdbif (isSearch){var searchResultList = await JsonSerializer.DeserializeAsync<SearchResultList>(stream, _jsonOptions, cancellationToken).ConfigureAwait(false);- if (searchResultList?.Search != null)+ if (searchResultList?.Search is not null){var resultCount = searchResultList.Search.Count;var result = new RemoteSearchResult[resultCount];diff --git a/MediaBrowser.Providers/Plugins/Omdb/OmdbProvider.cs b/MediaBrowser.Providers/Plugins/Omdb/OmdbProvider.csindex d3e5c9ee0a..6cd1d49b09 100644--- a/MediaBrowser.Providers/Plugins/Omdb/OmdbProvider.cs+++ b/MediaBrowser.Providers/Plugins/Omdb/OmdbProvider.cs@@ -540,10 +540,10 @@ namespace MediaBrowser.Providers.Plugins.Omdbpublic float? GetRottenTomatoScore(){- if (Ratings != null)+ if (Ratings is not null){var rating = Ratings.FirstOrDefault(i => string.Equals(i.Source, "Rotten Tomatoes", StringComparison.OrdinalIgnoreCase));- if (rating?.Value != null)+ if (rating?.Value is not null){var value = rating.Value.TrimEnd('%');if (float.TryParse(value, NumberStyles.Any, CultureInfo.InvariantCulture, out var score))diff --git a/MediaBrowser.Providers/Plugins/Tmdb/BoxSets/TmdbBoxSetProvider.cs b/MediaBrowser.Providers/Plugins/Tmdb/BoxSets/TmdbBoxSetProvider.csindex 0a85832051..1cce7fc35a 100644--- a/MediaBrowser.Providers/Plugins/Tmdb/BoxSets/TmdbBoxSetProvider.cs+++ b/MediaBrowser.Providers/Plugins/Tmdb/BoxSets/TmdbBoxSetProvider.cs@@ -62,7 +62,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.BoxSetsSearchProviderName = Name};- if (collection.Images != null)+ if (collection.Images is not null){result.ImageUrl = _tmdbClientManager.GetPosterUrl(collection.PosterPath);}@@ -104,7 +104,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.BoxSetsvar cleanedName = TmdbUtils.CleanName(parsedName.Name);var searchResults = await _tmdbClientManager.SearchCollectionAsync(cleanedName, language, cancellationToken).ConfigureAwait(false);- if (searchResults != null && searchResults.Count > 0)+ if (searchResults is not null && searchResults.Count > 0){tmdbId = searchResults[0].Id;}@@ -116,7 +116,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.BoxSets{var collection = await _tmdbClientManager.GetCollectionAsync(tmdbId, language, TmdbUtils.GetImageLanguagesParam(language), cancellationToken).ConfigureAwait(false);- if (collection != null)+ if (collection is not null){var item = new BoxSet{diff --git a/MediaBrowser.Providers/Plugins/Tmdb/Movies/TmdbMovieImageProvider.cs b/MediaBrowser.Providers/Plugins/Tmdb/Movies/TmdbMovieImageProvider.csindex 55e96f1fe5..01b8bca397 100644--- a/MediaBrowser.Providers/Plugins/Tmdb/Movies/TmdbMovieImageProvider.cs+++ b/MediaBrowser.Providers/Plugins/Tmdb/Movies/TmdbMovieImageProvider.cs@@ -74,7 +74,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.Movies}var movieResult = await _tmdbClientManager.FindByExternalIdAsync(movieImdbId, FindExternalSource.Imdb, language, cancellationToken).ConfigureAwait(false);- if (movieResult?.MovieResults != null && movieResult.MovieResults.Count > 0)+ if (movieResult?.MovieResults is not null && movieResult.MovieResults.Count > 0){movieTmdbId = movieResult.MovieResults[0].Id;}diff --git a/MediaBrowser.Providers/Plugins/Tmdb/Movies/TmdbMovieProvider.cs b/MediaBrowser.Providers/Plugins/Tmdb/Movies/TmdbMovieProvider.csindex 4f9dfb3efd..9eced93fa5 100644--- a/MediaBrowser.Providers/Plugins/Tmdb/Movies/TmdbMovieProvider.cs+++ b/MediaBrowser.Providers/Plugins/Tmdb/Movies/TmdbMovieProvider.cs@@ -72,7 +72,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.MoviesOverview = movie.Overview};- if (movie.ReleaseDate != null)+ if (movie.ReleaseDate is not null){var releaseDate = movie.ReleaseDate.Value.ToUniversalTime();remoteResult.PremiereDate = releaseDate;@@ -199,7 +199,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.Moviesmovie.SetProviderId(MetadataProvider.Tmdb, tmdbId);movie.SetProviderId(MetadataProvider.Imdb, movieResult.ImdbId);- if (movieResult.BelongsToCollection != null)+ if (movieResult.BelongsToCollection is not null){movie.SetProviderId(MetadataProvider.TmdbCollection, movieResult.BelongsToCollection.Id.ToString(CultureInfo.InvariantCulture));movie.CollectionName = movieResult.BelongsToCollection.Name;@@ -207,18 +207,18 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.Moviesmovie.CommunityRating = Convert.ToSingle(movieResult.VoteAverage);- if (movieResult.Releases?.Countries != null)+ if (movieResult.Releases?.Countries is not null){var releases = movieResult.Releases.Countries.Where(i => !string.IsNullOrWhiteSpace(i.Certification)).ToList();var ourRelease = releases.FirstOrDefault(c => string.Equals(c.Iso_3166_1, info.MetadataCountryCode, StringComparison.OrdinalIgnoreCase));var usRelease = releases.FirstOrDefault(c => string.Equals(c.Iso_3166_1, "US", StringComparison.OrdinalIgnoreCase));- if (ourRelease != null)+ if (ourRelease is not null){movie.OfficialRating = TmdbUtils.BuildParentalRating(ourRelease.Iso_3166_1, ourRelease.Certification);}- else if (usRelease != null)+ else if (usRelease is not null){movie.OfficialRating = usRelease.Certification;}@@ -227,7 +227,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.Moviesmovie.PremiereDate = movieResult.ReleaseDate;movie.ProductionYear = movieResult.ReleaseDate?.Year;- if (movieResult.ProductionCompanies != null)+ if (movieResult.ProductionCompanies is not null){movie.SetStudios(movieResult.ProductionCompanies.Select(c => c.Name));}@@ -239,7 +239,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.Moviesmovie.AddGenre(genre);}- if (movieResult.Keywords?.Keywords != null)+ if (movieResult.Keywords?.Keywords is not null){for (var i = 0; i < movieResult.Keywords.Keywords.Count; i++){@@ -247,7 +247,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.Movies}}- if (movieResult.Credits?.Cast != null)+ if (movieResult.Credits?.Cast is not null){foreach (var actor in movieResult.Credits.Cast.OrderBy(a => a.Order).Take(Plugin.Instance.Configuration.MaxCastMembers)){@@ -273,7 +273,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.Movies}}- if (movieResult.Credits?.Crew != null)+ if (movieResult.Credits?.Crew is not null){var keepTypes = new[]{@@ -314,7 +314,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.Movies}}- if (movieResult.Videos?.Results != null)+ if (movieResult.Videos?.Results is not null){var trailers = new List<MediaUrl>();for (var i = 0; i < movieResult.Videos.Results.Count; i++)diff --git a/MediaBrowser.Providers/Plugins/Tmdb/People/TmdbPersonProvider.cs b/MediaBrowser.Providers/Plugins/Tmdb/People/TmdbPersonProvider.csindex d760ad1426..b3709baf58 100644--- a/MediaBrowser.Providers/Plugins/Tmdb/People/TmdbPersonProvider.cs+++ b/MediaBrowser.Providers/Plugins/Tmdb/People/TmdbPersonProvider.cs@@ -43,7 +43,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.People{var personResult = await _tmdbClientManager.GetPersonAsync(int.Parse(personTmdbId, CultureInfo.InvariantCulture), searchInfo.MetadataLanguage, cancellationToken).ConfigureAwait(false);- if (personResult != null)+ if (personResult is not null){var result = new RemoteSearchResult{@@ -52,7 +52,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.PeopleOverview = personResult.Biography};- if (personResult.Images?.Profiles != null && personResult.Images.Profiles.Count > 0)+ if (personResult.Images?.Profiles is not null && personResult.Images.Profiles.Count > 0){result.ImageUrl = _tmdbClientManager.GetProfileUrl(personResult.Images.Profiles[0].FilePath);}diff --git a/MediaBrowser.Providers/Plugins/Tmdb/TV/TmdbEpisodeProvider.cs b/MediaBrowser.Providers/Plugins/Tmdb/TV/TmdbEpisodeProvider.csindex d003017ffc..35e304a2ac 100644--- a/MediaBrowser.Providers/Plugins/Tmdb/TV/TmdbEpisodeProvider.cs+++ b/MediaBrowser.Providers/Plugins/Tmdb/TV/TmdbEpisodeProvider.cs@@ -149,7 +149,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.TVitem.SetProviderId(MetadataProvider.TvRage, externalIds.TvrageId);}- if (episodeResult.Videos?.Results != null)+ if (episodeResult.Videos?.Results is not null){foreach (var video in episodeResult.Videos.Results){@@ -162,7 +162,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.TVvar credits = episodeResult.Credits;- if (credits?.Cast != null)+ if (credits?.Cast is not null){foreach (var actor in credits.Cast.OrderBy(a => a.Order).Take(Plugin.Instance.Configuration.MaxCastMembers)){@@ -176,7 +176,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.TV}}- if (credits?.GuestStars != null)+ if (credits?.GuestStars is not null){foreach (var guest in credits.GuestStars.OrderBy(a => a.Order).Take(Plugin.Instance.Configuration.MaxCastMembers)){@@ -191,7 +191,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.TV}// and the rest from crew- if (credits?.Crew != null)+ if (credits?.Crew is not null){foreach (var person in credits.Crew){diff --git a/MediaBrowser.Providers/Plugins/Tmdb/TV/TmdbSeasonProvider.cs b/MediaBrowser.Providers/Plugins/Tmdb/TV/TmdbSeasonProvider.csindex e38af68a63..3cb72b89b5 100644--- a/MediaBrowser.Providers/Plugins/Tmdb/TV/TmdbSeasonProvider.cs+++ b/MediaBrowser.Providers/Plugins/Tmdb/TV/TmdbSeasonProvider.cs@@ -79,7 +79,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.TV// TODO why was this disabled?var credits = seasonResult.Credits;- if (credits?.Cast != null)+ if (credits?.Cast is not null){var cast = credits.Cast.OrderBy(c => c.Order).Take(Plugin.Instance.Configuration.MaxCastMembers).ToList();for (var i = 0; i < cast.Count; i++)@@ -94,7 +94,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.TV}}- if (credits?.Crew != null)+ if (credits?.Crew is not null){foreach (var person in credits.Crew){diff --git a/MediaBrowser.Providers/Plugins/Tmdb/TV/TmdbSeriesProvider.cs b/MediaBrowser.Providers/Plugins/Tmdb/TV/TmdbSeriesProvider.csindex 4e8fdf0ee8..9590882105 100644--- a/MediaBrowser.Providers/Plugins/Tmdb/TV/TmdbSeriesProvider.cs+++ b/MediaBrowser.Providers/Plugins/Tmdb/TV/TmdbSeriesProvider.cs@@ -61,7 +61,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.TV.GetSeriesAsync(Convert.ToInt32(tmdbId, CultureInfo.InvariantCulture), searchInfo.MetadataLanguage, searchInfo.MetadataLanguage, cancellationToken).ConfigureAwait(false);- if (series != null)+ if (series is not null){var remoteResult = MapTvShowToRemoteSearchResult(series);@@ -76,7 +76,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.TV.ConfigureAwait(false);var tvResults = findResult?.TvResults;- if (tvResults != null)+ if (tvResults is not null){var imdbIdResults = new RemoteSearchResult[tvResults.Count];for (var i = 0; i < tvResults.Count; i++)@@ -97,7 +97,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.TV.ConfigureAwait(false);var tvResults = findResult?.TvResults;- if (tvResults != null)+ if (tvResults is not null){var tvIdResults = new RemoteSearchResult[tvResults.Count];for (var i = 0; i < tvResults.Count; i++)@@ -134,7 +134,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.TV};remoteResult.SetProviderId(MetadataProvider.Tmdb, series.Id.ToString(CultureInfo.InvariantCulture));- if (series.ExternalIds != null)+ if (series.ExternalIds is not null){if (!string.IsNullOrEmpty(series.ExternalIds.ImdbId)){@@ -233,7 +233,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.TVresult.AddPerson(person);}- result.HasMetadata = result.Item != null;+ result.HasMetadata = result.Item is not null;return result;}@@ -252,17 +252,17 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.TVseries.Overview = seriesResult.Overview;- if (seriesResult.Networks != null)+ if (seriesResult.Networks is not null){series.Studios = seriesResult.Networks.Select(i => i.Name).ToArray();}- if (seriesResult.Genres != null)+ if (seriesResult.Genres is not null){series.Genres = seriesResult.Genres.Select(i => i.Name).ToArray();}- if (seriesResult.Keywords?.Results != null)+ if (seriesResult.Keywords?.Results is not null){for (var i = 0; i < seriesResult.Keywords.Results.Count; i++){@@ -288,7 +288,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.TVseries.PremiereDate = seriesResult.FirstAirDate;var ids = seriesResult.ExternalIds;- if (ids != null)+ if (ids is not null){if (!string.IsNullOrWhiteSpace(ids.ImdbId)){@@ -312,20 +312,20 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.TVvar usRelease = contentRatings.FirstOrDefault(c => string.Equals(c.Iso_3166_1, "US", StringComparison.OrdinalIgnoreCase));var minimumRelease = contentRatings.FirstOrDefault();- if (ourRelease != null)+ if (ourRelease is not null){series.OfficialRating = TmdbUtils.BuildParentalRating(ourRelease.Iso_3166_1, ourRelease.Rating);}- else if (usRelease != null)+ else if (usRelease is not null){series.OfficialRating = usRelease.Rating;}- else if (minimumRelease != null)+ else if (minimumRelease is not null){series.OfficialRating = minimumRelease.Rating;}- if (seriesResult.Videos?.Results != null)+ if (seriesResult.Videos?.Results is not null){foreach (var video in seriesResult.Videos.Results){@@ -341,7 +341,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.TVprivate IEnumerable<PersonInfo> GetPersons(TvShow seriesResult){- if (seriesResult.Credits?.Cast != null)+ if (seriesResult.Credits?.Cast is not null){foreach (var actor in seriesResult.Credits.Cast.OrderBy(a => a.Order).Take(Plugin.Instance.Configuration.MaxCastMembers)){@@ -363,7 +363,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.TV}}- if (seriesResult.Credits?.Crew != null)+ if (seriesResult.Credits?.Crew is not null){var keepTypes = new[]{diff --git a/MediaBrowser.Providers/Plugins/Tmdb/TmdbClientManager.cs b/MediaBrowser.Providers/Plugins/Tmdb/TmdbClientManager.csindex 7f943a7b6f..b56c0d7482 100644--- a/MediaBrowser.Providers/Plugins/Tmdb/TmdbClientManager.cs+++ b/MediaBrowser.Providers/Plugins/Tmdb/TmdbClientManager.cs@@ -73,7 +73,7 @@ namespace MediaBrowser.Providers.Plugins.TmdbextraMethods,cancellationToken).ConfigureAwait(false);- if (movie != null)+ if (movie is not null){_memoryCache.Set(key, movie, TimeSpan.FromHours(CacheDurationInHours));}@@ -106,7 +106,7 @@ namespace MediaBrowser.Providers.Plugins.TmdbCollectionMethods.Images,cancellationToken).ConfigureAwait(false);- if (collection != null)+ if (collection is not null){_memoryCache.Set(key, collection, TimeSpan.FromHours(CacheDurationInHours));}@@ -145,7 +145,7 @@ namespace MediaBrowser.Providers.Plugins.TmdbextraMethods: extraMethods,cancellationToken: cancellationToken).ConfigureAwait(false);- if (series != null)+ if (series is not null){_memoryCache.Set(key, series, TimeSpan.FromHours(CacheDurationInHours));}@@ -200,7 +200,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdblanguage: TmdbUtils.NormalizeLanguage(language),cancellationToken: cancellationToken).ConfigureAwait(false);- if (group != null)+ if (group is not null){_memoryCache.Set(key, group, TimeSpan.FromHours(CacheDurationInHours));}@@ -235,7 +235,7 @@ namespace MediaBrowser.Providers.Plugins.TmdbextraMethods: TvSeasonMethods.Credits | TvSeasonMethods.Images | TvSeasonMethods.ExternalIds | TvSeasonMethods.Videos,cancellationToken: cancellationToken).ConfigureAwait(false);- if (season != null)+ if (season is not null){_memoryCache.Set(key, season, TimeSpan.FromHours(CacheDurationInHours));}@@ -265,12 +265,12 @@ namespace MediaBrowser.Providers.Plugins.Tmdbawait EnsureClientConfigAsync().ConfigureAwait(false);var group = await GetSeriesGroupAsync(tvShowId, displayOrder, language, imageLanguages, cancellationToken).ConfigureAwait(false);- if (group != null)+ if (group is not null){var season = group.Groups.Find(s => s.Order == seasonNumber);// Episode order starts at 0var ep = season?.Episodes.Find(e => e.Order == episodeNumber - 1);- if (ep != null)+ if (ep is not null){seasonNumber = ep.SeasonNumber;episodeNumber = ep.EpisodeNumber;@@ -286,7 +286,7 @@ namespace MediaBrowser.Providers.Plugins.TmdbextraMethods: TvEpisodeMethods.Credits | TvEpisodeMethods.Images | TvEpisodeMethods.ExternalIds | TvEpisodeMethods.Videos,cancellationToken: cancellationToken).ConfigureAwait(false);- if (episode != null)+ if (episode is not null){_memoryCache.Set(key, episode, TimeSpan.FromHours(CacheDurationInHours));}@@ -317,7 +317,7 @@ namespace MediaBrowser.Providers.Plugins.TmdbPersonMethods.TvCredits | PersonMethods.MovieCredits | PersonMethods.Images | PersonMethods.ExternalIds,cancellationToken).ConfigureAwait(false);- if (person != null)+ if (person is not null){_memoryCache.Set(key, person, TimeSpan.FromHours(CacheDurationInHours));}@@ -353,7 +353,7 @@ namespace MediaBrowser.Providers.Plugins.TmdbTmdbUtils.NormalizeLanguage(language),cancellationToken).ConfigureAwait(false);- if (result != null)+ if (result is not null){_memoryCache.Set(key, result, TimeSpan.FromHours(CacheDurationInHours));}diff --git a/MediaBrowser.Providers/Subtitles/SubtitleManager.cs b/MediaBrowser.Providers/Subtitles/SubtitleManager.csindex d0e229b23d..1aeffb65fc 100644--- a/MediaBrowser.Providers/Subtitles/SubtitleManager.cs+++ b/MediaBrowser.Providers/Subtitles/SubtitleManager.cs@@ -65,11 +65,11 @@ namespace MediaBrowser.Providers.Subtitles/// <inheritdoc />public async Task<RemoteSubtitleInfo[]> SearchSubtitles(SubtitleSearchRequest request, CancellationToken cancellationToken){- if (request.Language != null)+ if (request.Language is not null){var culture = _localization.FindLanguageInfo(request.Language);- if (culture != null)+ if (culture is not null){request.TwoLetterISOLanguageName = culture.TwoLetterISOLanguageName;}@@ -271,7 +271,7 @@ namespace MediaBrowser.Providers.Subtitlesstream.Position = 0;}- if (exs != null)+ if (exs is not null){throw new AggregateException(exs);}diff --git a/MediaBrowser.XbmcMetadata/Parsers/BaseNfoParser.cs b/MediaBrowser.XbmcMetadata/Parsers/BaseNfoParser.csindex d31c07d144..6a144365c9 100644--- a/MediaBrowser.XbmcMetadata/Parsers/BaseNfoParser.cs+++ b/MediaBrowser.XbmcMetadata/Parsers/BaseNfoParser.cs@@ -373,7 +373,7 @@ namespace MediaBrowser.XbmcMetadata.Parsers{var val = reader.ReadElementContentAsBoolean();- if (userData != null)+ if (userData is not null){userData.Played = val;}@@ -384,7 +384,7 @@ namespace MediaBrowser.XbmcMetadata.Parserscase "playcount":{var val = reader.ReadElementContentAsString();- if (!string.IsNullOrWhiteSpace(val) && userData != null)+ if (!string.IsNullOrWhiteSpace(val) && userData is not null){if (int.TryParse(val, NumberStyles.Integer, CultureInfo.InvariantCulture, out var count)){@@ -398,7 +398,7 @@ namespace MediaBrowser.XbmcMetadata.Parserscase "lastplayed":{var val = reader.ReadElementContentAsString();- if (!string.IsNullOrWhiteSpace(val) && userData != null)+ if (!string.IsNullOrWhiteSpace(val) && userData is not null){if (DateTime.TryParse(val, CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal | DateTimeStyles.AdjustToUniversal, out var added)){@@ -633,7 +633,7 @@ namespace MediaBrowser.XbmcMetadata.Parsersvar val = reader.ReadElementContentAsString();var hasDisplayOrder = item as IHasDisplayOrder;- if (hasDisplayOrder != null)+ if (hasDisplayOrder is not null){if (!string.IsNullOrWhiteSpace(val)){@@ -1018,7 +1018,7 @@ namespace MediaBrowser.XbmcMetadata.Parsersvar video = item as Video;- if (video != null)+ if (video is not null){if (string.Equals("HSBS", val, StringComparison.OrdinalIgnoreCase)){@@ -1198,7 +1198,7 @@ namespace MediaBrowser.XbmcMetadata.Parsersif (float.TryParse(val, NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out var ratingValue)){// if ratingName contains tomato --> assume critic rating- if (ratingName != null &&+ if (ratingName is not null &&ratingName.Contains("tomato", StringComparison.OrdinalIgnoreCase) &&!ratingName.Contains("audience", StringComparison.OrdinalIgnoreCase)){diff --git a/MediaBrowser.XbmcMetadata/Parsers/MovieNfoParser.cs b/MediaBrowser.XbmcMetadata/Parsers/MovieNfoParser.csindex e510557253..ecfed6873c 100644--- a/MediaBrowser.XbmcMetadata/Parsers/MovieNfoParser.cs+++ b/MediaBrowser.XbmcMetadata/Parsers/MovieNfoParser.cs@@ -82,14 +82,14 @@ namespace MediaBrowser.XbmcMetadata.Parsersvar movie = item as Movie;var tmdbcolid = reader.GetAttribute("tmdbcolid");- if (!string.IsNullOrWhiteSpace(tmdbcolid) && movie != null)+ if (!string.IsNullOrWhiteSpace(tmdbcolid) && movie is not null){movie.SetProviderId(MetadataProvider.TmdbCollection, tmdbcolid);}var val = reader.ReadInnerXml();- if (!string.IsNullOrWhiteSpace(val) && movie != null)+ if (!string.IsNullOrWhiteSpace(val) && movie is not null){// TODO Handle this better laterif (!val.Contains('<', StringComparison.Ordinal))diff --git a/MediaBrowser.XbmcMetadata/Providers/BaseVideoNfoProvider.cs b/MediaBrowser.XbmcMetadata/Providers/BaseVideoNfoProvider.csindex 8574be3f3a..9954424a4c 100644--- a/MediaBrowser.XbmcMetadata/Providers/BaseVideoNfoProvider.cs+++ b/MediaBrowser.XbmcMetadata/Providers/BaseVideoNfoProvider.cs@@ -55,7 +55,7 @@ namespace MediaBrowser.XbmcMetadata.Providersresult.Images = tmpItem.Images;result.RemoteImages = tmpItem.RemoteImages;- if (tmpItem.UserDataList != null)+ if (tmpItem.UserDataList is not null){result.UserDataList = tmpItem.UserDataList;}@@ -66,7 +66,7 @@ namespace MediaBrowser.XbmcMetadata.Providers{return MovieNfoSaver.GetMovieSavePaths(info).Select(directoryService.GetFile)- .FirstOrDefault(i => i != null);+ .FirstOrDefault(i => i is not null);}}}diff --git a/MediaBrowser.XbmcMetadata/Savers/BaseNfoSaver.cs b/MediaBrowser.XbmcMetadata/Savers/BaseNfoSaver.csindex 9eae87b3b4..130d0bfe40 100644--- a/MediaBrowser.XbmcMetadata/Savers/BaseNfoSaver.cs+++ b/MediaBrowser.XbmcMetadata/Savers/BaseNfoSaver.cs@@ -257,7 +257,7 @@ namespace MediaBrowser.XbmcMetadata.Saversvar baseItem = item;- if (baseItem != null)+ if (baseItem is not null){AddCommonNodes(baseItem, writer, LibraryManager, UserManager, UserDataManager, ConfigurationManager);}@@ -748,7 +748,7 @@ namespace MediaBrowser.XbmcMetadata.SaverswrittenProviderIds.Add(MetadataProvider.TvRage.ToString());}- if (item.ProviderIds != null)+ if (item.ProviderIds is not null){foreach (var providerKey in item.ProviderIds.Keys){@@ -832,7 +832,7 @@ namespace MediaBrowser.XbmcMetadata.Saversvar image = item.GetImageInfo(ImageType.Primary, 0);- if (image != null)+ if (image is not null){writer.WriteElementString("poster", GetImagePathToSave(image, libraryManager));}@@ -947,7 +947,7 @@ namespace MediaBrowser.XbmcMetadata.Saversvar personEntity = libraryManager.GetPerson(person.Name);var image = personEntity.GetImageInfo(ImageType.Primary, 0);- if (image != null)+ if (image is not null){writer.WriteElementString("thumb",diff --git a/src/Jellyfin.MediaEncoding.Hls/Cache/CacheDecorator.cs b/src/Jellyfin.MediaEncoding.Hls/Cache/CacheDecorator.csindex 09816c9607..360a962909 100644--- a/src/Jellyfin.MediaEncoding.Hls/Cache/CacheDecorator.cs+++ b/src/Jellyfin.MediaEncoding.Hls/Cache/CacheDecorator.cs@@ -87,7 +87,7 @@ public class CacheDecorator : IKeyframeExtractor{var bytes = File.ReadAllBytes(cachePath);cachedResult = JsonSerializer.Deserialize<KeyframeData>(bytes, _jsonOptions);- return cachedResult != null;+ return cachedResult is not null;}cachedResult = null;diff --git a/tests/Jellyfin.Api.Tests/TestHelpers.cs b/tests/Jellyfin.Api.Tests/TestHelpers.csindex f9bca41465..5eab3ae6f9 100644--- a/tests/Jellyfin.Api.Tests/TestHelpers.cs+++ b/tests/Jellyfin.Api.Tests/TestHelpers.cs@@ -36,7 +36,7 @@ namespace Jellyfin.Api.Testsuser.SetPermission(PermissionKind.IsAdministrator, role.Equals(UserRoles.Administrator, StringComparison.OrdinalIgnoreCase));// Add access schedules if set.- if (accessSchedules != null)+ if (accessSchedules is not null){foreach (var accessSchedule in accessSchedules){diff --git a/tests/Jellyfin.Model.Tests/Dlna/StreamBuilderTests.cs b/tests/Jellyfin.Model.Tests/Dlna/StreamBuilderTests.csindex a36c3b7c19..5e11a7232d 100644--- a/tests/Jellyfin.Model.Tests/Dlna/StreamBuilderTests.cs+++ b/tests/Jellyfin.Model.Tests/Dlna/StreamBuilderTests.cs@@ -323,7 +323,7 @@ namespace Jellyfin.Model.Testsvar val = builder.BuildVideoItem(options);Assert.NotNull(val);- if (playMethod != null)+ if (playMethod is not null){Assert.Equal(playMethod, val.PlayMethod);}@@ -490,7 +490,7 @@ namespace Jellyfin.Model.Testsusing (var stream = File.OpenRead(path)){var value = await JsonSerializer.DeserializeAsync<T>(stream, JsonDefaults.Options);- if (value != null)+ if (value is not null){return value;}diff --git a/tests/Jellyfin.Naming.Tests/TV/SeasonFolderTests.cs b/tests/Jellyfin.Naming.Tests/TV/SeasonFolderTests.csindex b7b5b54ec8..55af33836c 100644--- a/tests/Jellyfin.Naming.Tests/TV/SeasonFolderTests.cs+++ b/tests/Jellyfin.Naming.Tests/TV/SeasonFolderTests.cs@@ -27,7 +27,7 @@ namespace Jellyfin.Naming.Tests.TV{var result = SeasonPathParser.Parse(path, true, true);- Assert.Equal(result.SeasonNumber != null, result.Success);+ Assert.Equal(result.SeasonNumber is not null, result.Success);Assert.Equal(result.SeasonNumber, seasonNumber);Assert.Equal(isSeasonDirectory, result.IsSeasonFolder);}diff --git a/tests/Jellyfin.Naming.Tests/Video/MultiVersionTests.cs b/tests/Jellyfin.Naming.Tests/Video/MultiVersionTests.csindex 0ebcf5d81d..287d881a83 100644--- a/tests/Jellyfin.Naming.Tests/Video/MultiVersionTests.cs+++ b/tests/Jellyfin.Naming.Tests/Video/MultiVersionTests.cs@@ -26,7 +26,7 @@ namespace Jellyfin.Naming.Tests.Video_namingOptions).ToList();Assert.Single(result.Where(v => v.ExtraType is null));- Assert.Single(result.Where(v => v.ExtraType != null));+ Assert.Single(result.Where(v => v.ExtraType is not null));}[Fact]@@ -45,7 +45,7 @@ namespace Jellyfin.Naming.Tests.Video_namingOptions).ToList();Assert.Single(result.Where(v => v.ExtraType is null));- Assert.Single(result.Where(v => v.ExtraType != null));+ Assert.Single(result.Where(v => v.ExtraType is not null));Assert.Equal(2, result[0].AlternateVersions.Count);}diff --git a/tests/Jellyfin.Networking.Tests/NetworkParseTests.cs b/tests/Jellyfin.Networking.Tests/NetworkParseTests.csindex 166bc0513a..8174632bb4 100644--- a/tests/Jellyfin.Networking.Tests/NetworkParseTests.cs+++ b/tests/Jellyfin.Networking.Tests/NetworkParseTests.cs@@ -332,7 +332,7 @@ namespace Jellyfin.Networking.Tests// Check to see if dns resolution is working. If not, skip test._ = IPHost.TryParse(source, out var host);- if (resultObj != null && host?.HasAddress == true)+ if (resultObj is not null && host?.HasAddress == true){result = ((IPNetAddress)resultObj[0]).ToString(true);var intf = nm.GetBindInterface(source, out _);@@ -390,7 +390,7 @@ namespace Jellyfin.Networking.Testsusing var nm = new NetworkManager(GetMockConfig(conf), new NullLogger<NetworkManager>());NetworkManager.MockNetworkSettings = string.Empty;- if (nm.TryParseInterface(result, out Collection<IPObject>? resultObj) && resultObj != null)+ if (nm.TryParseInterface(result, out Collection<IPObject>? resultObj) && resultObj is not null){// Parse out IPAddresses so we can do a string comparison. (Ignore subnet masks).result = ((IPNetAddress)resultObj[0]).ToString(true);diff --git a/tests/Jellyfin.Providers.Tests/Manager/MetadataServiceTests.cs b/tests/Jellyfin.Providers.Tests/Manager/MetadataServiceTests.csindex f94d6717bd..e18faa422d 100644--- a/tests/Jellyfin.Providers.Tests/Manager/MetadataServiceTests.cs+++ b/tests/Jellyfin.Providers.Tests/Manager/MetadataServiceTests.cs@@ -91,7 +91,7 @@ namespace Jellyfin.Providers.Tests.Manager// Use type Series to hit DisplayOrderAssert.False(TestMergeBaseItemData<Series, SeriesInfo>(propName, oldValue, newValue, null, false, out _));- if (lockField != null)+ if (lockField is not null){Assert.False(TestMergeBaseItemData<Series, SeriesInfo>(propName, oldValue, newValue, lockField, true, out _));Assert.False(TestMergeBaseItemData<Series, SeriesInfo>(propName, null, newValue, lockField, false, out _));@@ -120,7 +120,7 @@ namespace Jellyfin.Providers.Tests.Manager// Use type Audio to hit AlbumArtistsAssert.False(TestMergeBaseItemData<Audio, SongInfo>(propName, oldValue, newValue, null, false, out _));- if (lockField != null)+ if (lockField is not null){Assert.False(TestMergeBaseItemData<Audio, SongInfo>(propName, oldValue, newValue, lockField, true, out _));Assert.False(TestMergeBaseItemData<Audio, SongInfo>(propName, Array.Empty<string>(), newValue, lockField, false, out _));diff --git a/tests/Jellyfin.Providers.Tests/Manager/ProviderManagerTests.cs b/tests/Jellyfin.Providers.Tests/Manager/ProviderManagerTests.csindex c1f2f5f711..5ca59f0ede 100644--- a/tests/Jellyfin.Providers.Tests/Manager/ProviderManagerTests.cs+++ b/tests/Jellyfin.Providers.Tests/Manager/ProviderManagerTests.cs@@ -423,7 +423,7 @@ namespace Jellyfin.Providers.Tests.Managerwhere TProviderType : class, IImageProvider{Mock<IHasOrder>? hasOrder = null;- if (order != null)+ if (order is not null){hasOrder = new Mock<IHasOrder>(MockBehavior.Strict);hasOrder.Setup(i => i.Order)@@ -471,7 +471,7 @@ namespace Jellyfin.Providers.Tests.Manager}Mock<IHasOrder>? hasOrder = null;- if (order != null)+ if (order is not null){hasOrder = forcedProvider is null ? new Mock<IHasOrder>() : forcedProvider.As<IHasOrder>();hasOrder.Setup(i => i.Order)@@ -499,7 +499,7 @@ namespace Jellyfin.Providers.Tests.Manager};// only create type options if populating it with something- if (imageFetcherOrder != null || metadataFetcherOrder != null)+ if (imageFetcherOrder is not null || metadataFetcherOrder is not null){imageFetcherOrder ??= Array.Empty<string>();metadataFetcherOrder ??= Array.Empty<string>();@@ -527,7 +527,7 @@ namespace Jellyfin.Providers.Tests.Managervar serverConfiguration = new ServerConfiguration();// only create type options if populating it with something- if (imageFetcherOrder != null || localMetadataReaderOrder != null || metadataFetcherOrder != null)+ if (imageFetcherOrder is not null || localMetadataReaderOrder is not null || metadataFetcherOrder is not null){imageFetcherOrder ??= Array.Empty<string>();localMetadataReaderOrder ??= Array.Empty<string>();diff --git a/tests/Jellyfin.Providers.Tests/MediaInfo/VideoImageProviderTests.cs b/tests/Jellyfin.Providers.Tests/MediaInfo/VideoImageProviderTests.csindex 6b2a052419..7ea6f7d9cb 100644--- a/tests/Jellyfin.Providers.Tests/MediaInfo/VideoImageProviderTests.cs+++ b/tests/Jellyfin.Providers.Tests/MediaInfo/VideoImageProviderTests.cs@@ -110,7 +110,7 @@ namespace Jellyfin.Providers.Tests.MediaInfoprivate static IMediaSourceManager GetMediaSourceManager(Video item, MediaStream? defaultStream, List<MediaStream> mediaStreams){var defaultStreamList = new List<MediaStream>();- if (defaultStream != null)+ if (defaultStream is not null){defaultStreamList.Add(defaultStream);}diff --git a/tests/Jellyfin.Server.Integration.Tests/Controllers/EncoderController.cs b/tests/Jellyfin.Server.Integration.Tests/Controllers/EncoderController.csindex 1a720c2f62..3d4c27c95c 100644--- a/tests/Jellyfin.Server.Integration.Tests/Controllers/EncoderController.cs+++ b/tests/Jellyfin.Server.Integration.Tests/Controllers/EncoderController.cs@@ -22,7 +22,7 @@ namespace Jellyfin.Server.Integration.Tests.Controllers{return new ContentResult(){- Content = (@params != null && @params.Count > 0)+ Content = (@params is not null && @params.Count > 0)? string.Join("&", @params.Select(x => x.Key + "=" + x.Value)): string.Empty,ContentType = "text/plain; charset=utf-8",@@ -42,7 +42,7 @@ namespace Jellyfin.Server.Integration.Tests.Controllers{return new ContentResult(){- Content = (@params != null && @params.Count > 0)+ Content = (@params is not null && @params.Count > 0)? string.Join("&", @params.Select(x => x.Key + "=" + string.Join(',', x.Value))): string.Empty,ContentType = "text/plain; charset=utf-8",