The Free Software Media System - Server Backend & API
Replace == null with is null
Bond_009c7d50d640e61
diff --git a/Emby.Dlna/Didl/DidlBuilder.cs b/Emby.Dlna/Didl/DidlBuilder.csindex 8e3a335c66..e2e3b2d8b6 100644--- a/Emby.Dlna/Didl/DidlBuilder.cs+++ b/Emby.Dlna/Didl/DidlBuilder.cs@@ -191,7 +191,7 @@ namespace Emby.Dlna.Didlprivate void AddVideoResource(XmlWriter writer, BaseItem video, string deviceId, Filter filter, StreamInfo streamInfo = null){- if (streamInfo == null)+ if (streamInfo is null){var sources = _mediaSourceManager.GetStaticMediaSources(video, true, _user);@@ -263,7 +263,7 @@ namespace Emby.Dlna.Didl.FirstOrDefault(i => string.Equals(info.Format, i.Format, StringComparison.OrdinalIgnoreCase)&& i.Method == SubtitleDeliveryMethod.External);- if (subtitleProfile == null)+ if (subtitleProfile is null){return false;}@@ -392,7 +392,7 @@ namespace Emby.Dlna.Didlvar filename = url.Substring(0, url.IndexOf('?', StringComparison.Ordinal));- var mimeType = mediaProfile == null || string.IsNullOrEmpty(mediaProfile.MimeType)+ var mimeType = mediaProfile is null || string.IsNullOrEmpty(mediaProfile.MimeType)? MimeTypes.GetMimeType(filename): mediaProfile.MimeType;@@ -533,7 +533,7 @@ namespace Emby.Dlna.Didl{writer.WriteStartElement(string.Empty, "res", NsDidl);- if (streamInfo == null)+ if (streamInfo is null){var sources = _mediaSourceManager.GetStaticMediaSources(audio, true, _user);@@ -598,7 +598,7 @@ namespace Emby.Dlna.Didlvar filename = url.Substring(0, url.IndexOf('?', StringComparison.Ordinal));- var mimeType = mediaProfile == null || string.IsNullOrEmpty(mediaProfile.MimeType)+ var mimeType = mediaProfile is null || string.IsNullOrEmpty(mediaProfile.MimeType)? MimeTypes.GetMimeType(filename): mediaProfile.MimeType;@@ -695,7 +695,7 @@ namespace Emby.Dlna.Didl}// Not a samsung device- if (secAttribute == null)+ if (secAttribute is null){return;}@@ -909,7 +909,7 @@ namespace Emby.Dlna.DidlAddValue(writer, "dc", "creator", artist, NsDc);// If it doesn't support album artists (musicvideo), then tag as both- if (hasAlbumArtists == null)+ if (hasAlbumArtists is null){AddAlbumArtist(writer, artist);}@@ -973,7 +973,7 @@ namespace Emby.Dlna.Didl{ImageDownloadInfo imageInfo = GetImageInfo(item);- if (imageInfo == null)+ if (imageInfo is null){return;}@@ -1036,7 +1036,7 @@ namespace Emby.Dlna.Didl{var imageInfo = GetImageInfo(item);- if (imageInfo == null)+ if (imageInfo is null){return;}@@ -1116,7 +1116,7 @@ namespace Emby.Dlna.Didlprivate BaseItem GetFirstParentWithImageBelowUserRoot(BaseItem item){- if (item == null)+ if (item is null){return null;}diff --git a/Emby.Dlna/DlnaManager.cs b/Emby.Dlna/DlnaManager.csindex 2ea2c130f2..31b999f64c 100644--- a/Emby.Dlna/DlnaManager.cs+++ b/Emby.Dlna/DlnaManager.cs@@ -107,7 +107,7 @@ namespace Emby.Dlnavar profile = GetProfiles().FirstOrDefault(i => i.Identification != null && IsMatch(deviceInfo, i.Identification));- if (profile == null)+ if (profile is null){_logger.LogInformation("No matching device profile found. The default will need to be used. \n{@Profile}", deviceInfo);}@@ -172,7 +172,7 @@ namespace Emby.DlnaArgumentNullException.ThrowIfNull(headers);var profile = GetProfiles().FirstOrDefault(i => i.Identification != null && IsMatch(headers, i.Identification));- if (profile == null)+ if (profile is null){_logger.LogDebug("No matching device profile found. {@Headers}", headers);}@@ -272,7 +272,7 @@ namespace Emby.Dlnavar info = GetProfileInfosInternal().FirstOrDefault(i => string.Equals(i.Info.Id, id, StringComparison.OrdinalIgnoreCase));- if (info == null)+ if (info is null){return null;}@@ -470,7 +470,7 @@ namespace Emby.Dlnavar resource = GetType().Namespace + ".Images." + filename.ToLowerInvariant();var stream = _assembly.GetManifestResourceStream(resource);- if (stream == null)+ if (stream is null){return null;}diff --git a/Emby.Dlna/Main/DlnaEntryPoint.cs b/Emby.Dlna/Main/DlnaEntryPoint.csindex 15021c19d6..bcd7ece085 100644--- a/Emby.Dlna/Main/DlnaEntryPoint.cs+++ b/Emby.Dlna/Main/DlnaEntryPoint.cs@@ -199,7 +199,7 @@ namespace Emby.Dlna.Main{try{- if (_communicationsServer == null)+ if (_communicationsServer is null){var enableMultiSocketBinding = OperatingSystem.IsWindows() ||OperatingSystem.IsLinux();diff --git a/Emby.Dlna/PlayTo/Device.cs b/Emby.Dlna/PlayTo/Device.csindex 34981bd3f4..1c7730187b 100644--- a/Emby.Dlna/PlayTo/Device.cs+++ b/Emby.Dlna/PlayTo/Device.cs@@ -220,14 +220,14 @@ namespace Emby.Dlna.PlayTovar rendererCommands = await GetRenderingProtocolAsync(cancellationToken).ConfigureAwait(false);var command = rendererCommands?.ServiceActions.FirstOrDefault(c => c.Name == "SetMute");- if (command == null)+ if (command is null){return false;}var service = GetServiceRenderingControl();- if (service == null)+ if (service is null){return false;}@@ -260,14 +260,14 @@ namespace Emby.Dlna.PlayTovar rendererCommands = await GetRenderingProtocolAsync(cancellationToken).ConfigureAwait(false);var command = rendererCommands?.ServiceActions.FirstOrDefault(c => c.Name == "SetVolume");- if (command == null)+ if (command is null){return;}var service = GetServiceRenderingControl();- if (service == null)+ if (service is null){throw new InvalidOperationException("Unable to find service");}@@ -291,14 +291,14 @@ namespace Emby.Dlna.PlayTovar avCommands = await GetAVProtocolAsync(cancellationToken).ConfigureAwait(false);var command = avCommands?.ServiceActions.FirstOrDefault(c => c.Name == "Seek");- if (command == null)+ if (command is null){return;}var service = GetAvTransportService();- if (service == null)+ if (service is null){throw new InvalidOperationException("Unable to find service");}@@ -324,7 +324,7 @@ namespace Emby.Dlna.PlayTo_logger.LogDebug("{0} - SetAvTransport Uri: {1} DlnaHeaders: {2}", Properties.Name, url, header);var command = avCommands?.ServiceActions.FirstOrDefault(c => c.Name == "SetAVTransportURI");- if (command == null)+ if (command is null){return;}@@ -337,7 +337,7 @@ namespace Emby.Dlna.PlayTovar service = GetAvTransportService();- if (service == null)+ if (service is null){throw new InvalidOperationException("Unable to find service");}@@ -381,7 +381,7 @@ namespace Emby.Dlna.PlayTo_logger.LogDebug("{PropertyName} - SetNextAvTransport Uri: {Url} DlnaHeaders: {Header}", Properties.Name, url, header);var command = avCommands.ServiceActions.FirstOrDefault(c => string.Equals(c.Name, "SetNextAVTransportURI", StringComparison.OrdinalIgnoreCase));- if (command == null)+ if (command is null){return;}@@ -394,7 +394,7 @@ namespace Emby.Dlna.PlayTovar service = GetAvTransportService();- if (service == null)+ if (service is null){throw new InvalidOperationException("Unable to find service");}@@ -418,13 +418,13 @@ namespace Emby.Dlna.PlayToprivate Task SetPlay(TransportCommands avCommands, CancellationToken cancellationToken){var command = avCommands.ServiceActions.FirstOrDefault(c => c.Name == "Play");- if (command == null)+ if (command is null){return Task.CompletedTask;}var service = GetAvTransportService();- if (service == null)+ if (service is null){throw new InvalidOperationException("Unable to find service");}@@ -440,7 +440,7 @@ namespace Emby.Dlna.PlayTopublic async Task SetPlay(CancellationToken cancellationToken){var avCommands = await GetAVProtocolAsync(cancellationToken).ConfigureAwait(false);- if (avCommands == null)+ if (avCommands is null){return;}@@ -455,7 +455,7 @@ namespace Emby.Dlna.PlayTovar avCommands = await GetAVProtocolAsync(cancellationToken).ConfigureAwait(false);var command = avCommands?.ServiceActions.FirstOrDefault(c => c.Name == "Stop");- if (command == null)+ if (command is null){return;}@@ -479,7 +479,7 @@ namespace Emby.Dlna.PlayTovar avCommands = await GetAVProtocolAsync(cancellationToken).ConfigureAwait(false);var command = avCommands?.ServiceActions.FirstOrDefault(c => c.Name == "Pause");- if (command == null)+ if (command is null){return;}@@ -513,7 +513,7 @@ namespace Emby.Dlna.PlayTovar avCommands = await GetAVProtocolAsync(cancellationToken).ConfigureAwait(false);- if (avCommands == null)+ if (avCommands is null){return;}@@ -538,7 +538,7 @@ namespace Emby.Dlna.PlayTovar currentObject = tuple.Track;- if (tuple.Success && currentObject == null)+ if (tuple.Success && currentObject is null){currentObject = await GetMediaInfo(avCommands, cancellationToken).ConfigureAwait(false);}@@ -607,14 +607,14 @@ namespace Emby.Dlna.PlayTovar rendererCommands = await GetRenderingProtocolAsync(cancellationToken).ConfigureAwait(false);var command = rendererCommands?.ServiceActions.FirstOrDefault(c => c.Name == "GetVolume");- if (command == null)+ if (command is null){return;}var service = GetServiceRenderingControl();- if (service == null)+ if (service is null){return;}@@ -626,7 +626,7 @@ namespace Emby.Dlna.PlayTorendererCommands.BuildPost(command, service.ServiceType),cancellationToken: cancellationToken).ConfigureAwait(false);- if (result == null || result.Document == null)+ if (result is null || result.Document is null){return;}@@ -657,14 +657,14 @@ namespace Emby.Dlna.PlayTovar rendererCommands = await GetRenderingProtocolAsync(cancellationToken).ConfigureAwait(false);var command = rendererCommands?.ServiceActions.FirstOrDefault(c => c.Name == "GetMute");- if (command == null)+ if (command is null){return;}var service = GetServiceRenderingControl();- if (service == null)+ if (service is null){return;}@@ -676,7 +676,7 @@ namespace Emby.Dlna.PlayTorendererCommands.BuildPost(command, service.ServiceType),cancellationToken: cancellationToken).ConfigureAwait(false);- if (result == null || result.Document == null)+ if (result is null || result.Document is null){return;}@@ -691,13 +691,13 @@ namespace Emby.Dlna.PlayToprivate async Task<TransportState?> GetTransportInfo(TransportCommands avCommands, CancellationToken cancellationToken){var command = avCommands.ServiceActions.FirstOrDefault(c => c.Name == "GetTransportInfo");- if (command == null)+ if (command is null){return null;}var service = GetAvTransportService();- if (service == null)+ if (service is null){return null;}@@ -709,7 +709,7 @@ namespace Emby.Dlna.PlayToavCommands.BuildPost(command, service.ServiceType),cancellationToken: cancellationToken).ConfigureAwait(false);- if (result == null || result.Document == null)+ if (result is null || result.Document is null){return null;}@@ -731,19 +731,19 @@ namespace Emby.Dlna.PlayToprivate async Task<UBaseObject> GetMediaInfo(TransportCommands avCommands, CancellationToken cancellationToken){var command = avCommands.ServiceActions.FirstOrDefault(c => c.Name == "GetMediaInfo");- if (command == null)+ if (command is null){return null;}var service = GetAvTransportService();- if (service == null)+ if (service is null){throw new InvalidOperationException("Unable to find service");}var rendererCommands = await GetRenderingProtocolAsync(cancellationToken).ConfigureAwait(false);- if (rendererCommands == null)+ if (rendererCommands is null){return null;}@@ -755,14 +755,14 @@ namespace Emby.Dlna.PlayTorendererCommands.BuildPost(command, service.ServiceType),cancellationToken: cancellationToken).ConfigureAwait(false);- if (result == null || result.Document == null)+ if (result is null || result.Document is null){return null;}var track = result.Document.Descendants("CurrentURIMetaData").FirstOrDefault();- if (track == null)+ if (track is null){return null;}@@ -778,7 +778,7 @@ namespace Emby.Dlna.PlayTotrack = result.Document.Descendants("CurrentURI").FirstOrDefault();- if (track == null)+ if (track is null){return null;}@@ -801,21 +801,21 @@ namespace Emby.Dlna.PlayToprivate async Task<(bool Success, UBaseObject Track)> GetPositionInfo(TransportCommands avCommands, CancellationToken cancellationToken){var command = avCommands.ServiceActions.FirstOrDefault(c => c.Name == "GetPositionInfo");- if (command == null)+ if (command is null){return (false, null);}var service = GetAvTransportService();- if (service == null)+ if (service is null){throw new InvalidOperationException("Unable to find service");}var rendererCommands = await GetRenderingProtocolAsync(cancellationToken).ConfigureAwait(false);- if (rendererCommands == null)+ if (rendererCommands is null){return (false, null);}@@ -827,7 +827,7 @@ namespace Emby.Dlna.PlayTorendererCommands.BuildPost(command, service.ServiceType),cancellationToken: cancellationToken).ConfigureAwait(false);- if (result == null || result.Document == null)+ if (result is null || result.Document is null){return (false, null);}@@ -858,7 +858,7 @@ namespace Emby.Dlna.PlayTovar track = result.Document.Descendants("TrackMetaData").FirstOrDefault();- if (track == null)+ if (track is null){// If track is null, some vendors do this, use GetMediaInfo instead.return (true, null);@@ -882,7 +882,7 @@ namespace Emby.Dlna.PlayTo_logger.LogError(ex, "Uncaught exception while parsing xml");}- if (uPnpResponse == null)+ if (uPnpResponse is null){_logger.LogError("Failed to parse xml: \n {Xml}", trackString);return (true, null);@@ -985,7 +985,7 @@ namespace Emby.Dlna.PlayTo}var avService = GetAvTransportService();- if (avService == null)+ if (avService is null){return null;}@@ -995,7 +995,7 @@ namespace Emby.Dlna.PlayTovar httpClient = new DlnaHttpClient(_logger, _httpClientFactory);var document = await httpClient.GetDataAsync(url, cancellationToken).ConfigureAwait(false);- if (document == null)+ if (document is null){return null;}@@ -1017,7 +1017,7 @@ namespace Emby.Dlna.PlayTo}var avService = GetServiceRenderingControl();- if (avService == null)+ if (avService is null){throw new ArgumentException("Device AvService is null");}@@ -1027,7 +1027,7 @@ namespace Emby.Dlna.PlayTovar httpClient = new DlnaHttpClient(_logger, _httpClientFactory);_logger.LogDebug("Dlna Device.GetRenderingProtocolAsync");var document = await httpClient.GetDataAsync(url, cancellationToken).ConfigureAwait(false);- if (document == null)+ if (document is null){return null;}@@ -1062,7 +1062,7 @@ namespace Emby.Dlna.PlayTovar ssdpHttpClient = new DlnaHttpClient(logger, httpClientFactory);var document = await ssdpHttpClient.GetDataAsync(url.ToString(), cancellationToken).ConfigureAwait(false);- if (document == null)+ if (document is null){return null;}@@ -1149,13 +1149,13 @@ namespace Emby.Dlna.PlayToforeach (var services in document.Descendants(UPnpNamespaces.Ud.GetName("serviceList"))){- if (services == null)+ if (services is null){continue;}var servicesList = services.Descendants(UPnpNamespaces.Ud.GetName("service"));- if (servicesList == null)+ if (servicesList is null){continue;}@@ -1212,14 +1212,14 @@ namespace Emby.Dlna.PlayTovar previousMediaInfo = CurrentMediaInfo;CurrentMediaInfo = mediaInfo;- if (mediaInfo == null)+ if (mediaInfo is null){if (previousMediaInfo != null){OnPlaybackStop(previousMediaInfo);}}- else if (previousMediaInfo == null)+ else if (previousMediaInfo is null){if (state != TransportState.STOPPED){diff --git a/Emby.Dlna/PlayTo/PlayToController.cs b/Emby.Dlna/PlayTo/PlayToController.csindex 65367e24f2..fca5fc2a0d 100644--- a/Emby.Dlna/PlayTo/PlayToController.cs+++ b/Emby.Dlna/PlayTo/PlayToController.cs@@ -164,7 +164,7 @@ namespace Emby.Dlna.PlayTo}streamInfo = StreamParams.ParseFromUrl(e.NewMediaInfo.Url, _libraryManager, _mediaSourceManager);- if (streamInfo.Item == null)+ if (streamInfo.Item is null){return;}@@ -199,7 +199,7 @@ namespace Emby.Dlna.PlayTo{var streamInfo = StreamParams.ParseFromUrl(e.MediaInfo.Url, _libraryManager, _mediaSourceManager);- if (streamInfo.Item == null)+ if (streamInfo.Item is null){return;}@@ -210,7 +210,7 @@ namespace Emby.Dlna.PlayTovar mediaSource = await streamInfo.GetMediaSource(CancellationToken.None).ConfigureAwait(false);- var duration = mediaSource == null+ var duration = mediaSource is null? _device.Duration?.Ticks: mediaSource.RunTimeTicks;@@ -865,7 +865,7 @@ namespace Emby.Dlna.PlayTothrow new ObjectDisposedException(GetType().Name);}- if (_device == null)+ if (_device is null){return Task.CompletedTask;}diff --git a/Emby.Dlna/PlayTo/PlayToManager.cs b/Emby.Dlna/PlayTo/PlayToManager.csindex 294bda5b6a..f4a9a90af4 100644--- a/Emby.Dlna/PlayTo/PlayToManager.cs+++ b/Emby.Dlna/PlayTo/PlayToManager.cs@@ -176,10 +176,10 @@ namespace Emby.Dlna.PlayTovar controller = sessionInfo.SessionControllers.OfType<PlayToController>().FirstOrDefault();- if (controller == null)+ if (controller is null){var device = await Device.CreateuPnpDeviceAsync(uri, _httpClientFactory, _logger, cancellationToken).ConfigureAwait(false);- if (device == null)+ if (device is null){_logger.LogError("Ignoring device as xml response is invalid.");return;diff --git a/Emby.Dlna/Ssdp/DeviceDiscovery.cs b/Emby.Dlna/Ssdp/DeviceDiscovery.csindex 391dda1479..bb58a5d1b6 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 == null && _commsServer != null)+ if (_listenerCount > 0 && _deviceLocator is null && _commsServer != null){_deviceLocator = new SsdpDeviceLocator(_commsServer);@@ -97,7 +97,7 @@ namespace Emby.Dlna.Ssdp{var originalHeaders = e.DiscoveredDevice.ResponseHeaders;- var headerDict = originalHeaders == null ? new Dictionary<string, KeyValuePair<string, IEnumerable<string>>>() : originalHeaders.ToDictionary(i => i.Key, StringComparer.OrdinalIgnoreCase);+ var headerDict = originalHeaders is null ? new Dictionary<string, KeyValuePair<string, IEnumerable<string>>>() : originalHeaders.ToDictionary(i => i.Key, StringComparer.OrdinalIgnoreCase);var headers = headerDict.ToDictionary(i => i.Key, i => i.Value.Value.FirstOrDefault(), StringComparer.OrdinalIgnoreCase);@@ -116,7 +116,7 @@ namespace Emby.Dlna.Ssdp{var originalHeaders = e.DiscoveredDevice.ResponseHeaders;- var headerDict = originalHeaders == null ? new Dictionary<string, KeyValuePair<string, IEnumerable<string>>>() : originalHeaders.ToDictionary(i => i.Key, StringComparer.OrdinalIgnoreCase);+ var headerDict = originalHeaders is null ? new Dictionary<string, KeyValuePair<string, IEnumerable<string>>>() : originalHeaders.ToDictionary(i => i.Key, StringComparer.OrdinalIgnoreCase);var headers = headerDict.ToDictionary(i => i.Key, i => i.Value.Value.FirstOrDefault(), StringComparer.OrdinalIgnoreCase);diff --git a/Emby.Drawing/ImageProcessor.cs b/Emby.Drawing/ImageProcessor.csindex 11256dafde..d2c430415a 100644--- a/Emby.Drawing/ImageProcessor.cs+++ b/Emby.Drawing/ImageProcessor.cs@@ -436,7 +436,7 @@ namespace Emby.Drawing/// <inheritdoc />public string? GetImageCacheTag(User user){- if (user.ProfileImage == null)+ if (user.ProfileImage is null){return null;}diff --git a/Emby.Naming/AudioBook/AudioBookListResolver.cs b/Emby.Naming/AudioBook/AudioBookListResolver.csindex 6e491185d8..7a241aab2b 100644--- a/Emby.Naming/AudioBook/AudioBookListResolver.cs+++ b/Emby.Naming/AudioBook/AudioBookListResolver.cs@@ -75,7 +75,7 @@ namespace Emby.Naming.AudioBookforeach (var group in groupedBy){- if (group.Key.ChapterNumber == null && group.Key.PartNumber == null)+ if (group.Key.ChapterNumber is null && group.Key.PartNumber is null){if (group.Count() > 1 || haveChaptersOrPages){diff --git a/Emby.Naming/AudioBook/AudioBookNameParser.cs b/Emby.Naming/AudioBook/AudioBookNameParser.csindex 120482bc2c..97b34199e0 100644--- a/Emby.Naming/AudioBook/AudioBookNameParser.cs+++ b/Emby.Naming/AudioBook/AudioBookNameParser.cs@@ -33,7 +33,7 @@ namespace Emby.Naming.AudioBookvar match = new Regex(expression, RegexOptions.IgnoreCase).Match(name);if (match.Success){- if (result.Name == null)+ if (result.Name is null){var value = match.Groups["name"];if (value.Success)diff --git a/Emby.Naming/ExternalFiles/ExternalPathParser.cs b/Emby.Naming/ExternalFiles/ExternalPathParser.csindex 1fa4fa5371..cfe3256e3d 100644--- a/Emby.Naming/ExternalFiles/ExternalPathParser.cs+++ b/Emby.Naming/ExternalFiles/ExternalPathParser.cs@@ -94,7 +94,7 @@ namespace Emby.Naming.ExternalFiles// Try to translate to three character codevar culture = _localizationManager.FindLanguageInfo(currentSliceWithoutSeparator);- if (culture != null && pathInfo.Language == null)+ if (culture != null && pathInfo.Language is null){pathInfo.Language = culture.ThreeLetterISOLanguageName;extraString = extraString.Replace(currentSlice, string.Empty, StringComparison.OrdinalIgnoreCase);diff --git a/Emby.Naming/Video/VideoListResolver.cs b/Emby.Naming/Video/VideoListResolver.csindex 11f82525f3..1366bdb2c3 100644--- a/Emby.Naming/Video/VideoListResolver.cs+++ b/Emby.Naming/Video/VideoListResolver.cs@@ -26,7 +26,7 @@ namespace Emby.Naming.Video// Filter out all extras, otherwise they could cause stacks to not be resolved// See the unit test TestStackedWithTrailervar nonExtras = videoInfos- .Where(i => i.ExtraType == null)+ .Where(i => i.ExtraType is null).Select(i => new FileSystemMetadata { FullName = i.Path, IsDirectory = i.IsDirectory });var stackResult = StackResolver.Resolve(nonExtras, namingOptions).ToList();@@ -42,7 +42,7 @@ namespace Emby.Naming.Videocontinue;}- if (current.ExtraType == null)+ if (current.ExtraType is null){standaloneMedia.Add(current);}diff --git a/Emby.Naming/Video/VideoResolver.cs b/Emby.Naming/Video/VideoResolver.csindex de8e177d8b..858e9dd2f5 100644--- a/Emby.Naming/Video/VideoResolver.cs+++ b/Emby.Naming/Video/VideoResolver.cs@@ -87,7 +87,7 @@ namespace Emby.Naming.Videoname = cleanDateTimeResult.Name;year = cleanDateTimeResult.Year;- if (extraResult.ExtraType == null+ if (extraResult.ExtraType is null&& TryCleanString(name, namingOptions, out var newName)){name = newName;diff --git a/Emby.Notifications/NotificationEntryPoint.cs b/Emby.Notifications/NotificationEntryPoint.csindex 668c059b47..3763b1e922 100644--- a/Emby.Notifications/NotificationEntryPoint.cs+++ b/Emby.Notifications/NotificationEntryPoint.cs@@ -141,7 +141,7 @@ namespace Emby.Notificationslock (_libraryChangedSyncLock){- if (_libraryUpdateTimer == null)+ if (_libraryUpdateTimer is null){_libraryUpdateTimer = new Timer(LibraryUpdateTimerCallback,diff --git a/Emby.Notifications/NotificationManager.cs b/Emby.Notifications/NotificationManager.csindex ac90cc8ec5..2b9d2c5774 100644--- a/Emby.Notifications/NotificationManager.cs+++ b/Emby.Notifications/NotificationManager.cs@@ -68,7 +68,7 @@ namespace Emby.Notificationsvar users = GetUserIds(request, options).Select(i => _userManager.GetUserById(i))- .Where(i => relatedItem == null || relatedItem.IsVisibleStandalone(i))+ .Where(i => relatedItem is null || relatedItem.IsVisibleStandalone(i)).ToArray();var title = request.Name;diff --git a/Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs b/Emby.Server.Implementations/AppBase/BaseConfigurationManager.csindex 26b4649dd8..5876c9b4c6 100644--- a/Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs+++ b/Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs@@ -144,7 +144,7 @@ namespace Emby.Server.Implementations.AppBase{IConfigurationFactory factory = Activator.CreateInstance<T>();- if (_configurationFactories == null)+ if (_configurationFactories is null){_configurationFactories = new[] { factory };}@@ -306,7 +306,7 @@ namespace Emby.Server.Implementations.AppBaseconfigurationManager._configurationStores,i => string.Equals(i.Key, k, StringComparison.OrdinalIgnoreCase));- if (configurationInfo == null)+ if (configurationInfo is null){throw new ResourceNotFoundException("Configuration with key " + k + " not found.");}diff --git a/Emby.Server.Implementations/AppBase/ConfigurationHelper.cs b/Emby.Server.Implementations/AppBase/ConfigurationHelper.csindex f923e59efb..1c84776059 100644--- a/Emby.Server.Implementations/AppBase/ConfigurationHelper.cs+++ b/Emby.Server.Implementations/AppBase/ConfigurationHelper.cs@@ -43,7 +43,7 @@ namespace Emby.Server.Implementations.AppBaseSpan<byte> newBytes = stream.GetBuffer().AsSpan(0, (int)stream.Length);// If the file didn't exist before, or if something has changed, re-save- if (buffer == null || !newBytes.SequenceEqual(buffer))+ if (buffer is null || !newBytes.SequenceEqual(buffer)){var directory = Path.GetDirectoryName(path) ?? throw new ArgumentException($"Provided path ({path}) is not valid.", nameof(path));diff --git a/Emby.Server.Implementations/Channels/ChannelManager.cs b/Emby.Server.Implementations/Channels/ChannelManager.csindex 6837cce5cc..d7eb7e3aca 100644--- a/Emby.Server.Implementations/Channels/ChannelManager.cs+++ b/Emby.Server.Implementations/Channels/ChannelManager.cs@@ -129,7 +129,7 @@ namespace Emby.Server.Implementations.Channelspublic Task DeleteItem(BaseItem item){var internalChannel = _libraryManager.GetItemById(item.ChannelId);- if (internalChannel == null)+ if (internalChannel is null){throw new ArgumentException(nameof(item.ChannelId));}@@ -253,7 +253,7 @@ namespace Emby.Server.Implementations.Channelsif (query.StartIndex.HasValue || query.Limit.HasValue){int startIndex = query.StartIndex ?? 0;- int count = query.Limit == null ? totalCount - startIndex : Math.Min(query.Limit.Value, totalCount - startIndex);+ int count = query.Limit is null ? totalCount - startIndex : Math.Min(query.Limit.Value, totalCount - startIndex);all = all.GetRange(startIndex, count);}@@ -355,7 +355,7 @@ namespace Emby.Server.Implementations.Channels{var path = Path.Combine(item.GetInternalMetadataPath(), "channelmediasourceinfos.json");- if (mediaSources == null || mediaSources.Count == 0)+ if (mediaSources is null || mediaSources.Count == 0){try{@@ -447,7 +447,7 @@ namespace Emby.Server.Implementations.Channelsvar item = _libraryManager.GetItemById(id) as Channel;- if (item == null)+ if (item is null){item = new Channel{@@ -861,7 +861,7 @@ namespace Emby.Server.Implementations.Channelsvar result = await channel.GetChannelItems(query, cancellationToken).ConfigureAwait(false);- if (result == null)+ if (result is null){throw new InvalidOperationException("Channel returned a null result from GetChannelItems");}@@ -955,7 +955,7 @@ namespace Emby.Server.Implementations.Channels_logger.LogError(ex, "Error retrieving channel item from database");}- if (item == null)+ if (item is null){item = new T();isNew = true;@@ -1193,7 +1193,7 @@ namespace Emby.Server.Implementations.Channelsvar result = GetAllChannels().FirstOrDefault(i => GetInternalChannelId(i.Name).Equals(channel.ChannelId) || string.Equals(i.Name, channel.Name, StringComparison.OrdinalIgnoreCase));- if (result == null)+ if (result is null){throw new ResourceNotFoundException("No channel provider found for channel " + channel.Name);}@@ -1206,7 +1206,7 @@ namespace Emby.Server.Implementations.Channelsvar result = GetAllChannels().FirstOrDefault(i => internalChannelId.Equals(GetInternalChannelId(i.Name)));- if (result == null)+ if (result is null){throw new ResourceNotFoundException("No channel provider found for channel id " + internalChannelId);}diff --git a/Emby.Server.Implementations/Collections/CollectionManager.cs b/Emby.Server.Implementations/Collections/CollectionManager.csindex 187e0c9b3b..701c7b61dc 100644--- a/Emby.Server.Implementations/Collections/CollectionManager.cs+++ b/Emby.Server.Implementations/Collections/CollectionManager.cs@@ -121,7 +121,7 @@ namespace Emby.Server.Implementations.Collections{var folder = GetCollectionsFolder(false).GetAwaiter().GetResult();- return folder == null+ return folder is null? Enumerable.Empty<BoxSet>(): folder.GetChildren(user, true).OfType<BoxSet>();}@@ -138,7 +138,7 @@ namespace Emby.Server.Implementations.Collectionsvar parentFolder = await GetCollectionsFolder(true).ConfigureAwait(false);- if (parentFolder == null)+ if (parentFolder is null){throw new ArgumentException(nameof(parentFolder));}@@ -216,7 +216,7 @@ namespace Emby.Server.Implementations.Collections{var item = _libraryManager.GetItemById(id);- if (item == null)+ if (item is null){throw new ArgumentException("No item exists with the supplied Id");}@@ -267,7 +267,7 @@ namespace Emby.Server.Implementations.Collectionsvar child = collection.LinkedChildren.FirstOrDefault(i => (i.ItemId.HasValue && i.ItemId.Value.Equals(guidId)) || (childItem != null && string.Equals(childItem.Path, i.Path, StringComparison.OrdinalIgnoreCase)));- if (child == null)+ if (child is null){_logger.LogWarning("No collection title exists with the supplied Id");continue;diff --git a/Emby.Server.Implementations/Data/SqliteExtensions.cs b/Emby.Server.Implementations/Data/SqliteExtensions.csindex 736b8125d7..4055b0ba17 100644--- a/Emby.Server.Implementations/Data/SqliteExtensions.cs+++ b/Emby.Server.Implementations/Data/SqliteExtensions.cs@@ -253,7 +253,7 @@ namespace Emby.Server.Implementations.Data{if (statement.BindParameters.TryGetValue(name, out IBindParameter bindParam)){- if (value == null)+ if (value is null){bindParam.BindNull();}diff --git a/Emby.Server.Implementations/Data/SqliteItemRepository.cs b/Emby.Server.Implementations/Data/SqliteItemRepository.csindex 9d44fd9d18..36fdfc8f27 100644--- a/Emby.Server.Implementations/Data/SqliteItemRepository.cs+++ b/Emby.Server.Implementations/Data/SqliteItemRepository.cs@@ -691,7 +691,7 @@ namespace Emby.Server.Implementations.Dataprivate string GetPathToSave(string path){- if (path == null)+ if (path is null){return null;}@@ -890,7 +890,7 @@ namespace Emby.Server.Implementations.DatasaveItemStatement.TryBind("@UnratedType", item.GetBlockUnratedType().ToString());- if (topParent == null)+ if (topParent is null){saveItemStatement.TryBindNull("@TopParentId");}@@ -1414,7 +1414,7 @@ namespace Emby.Server.Implementations.Datavar type = _typeMapper.GetType(typeString);- if (type == null)+ if (type is null){return null;}@@ -1433,7 +1433,7 @@ namespace Emby.Server.Implementations.Data}}- if (item == null)+ if (item is null){try{@@ -1444,7 +1444,7 @@ namespace Emby.Server.Implementations.Data}}- if (item == null)+ if (item is null){return null;}@@ -2151,7 +2151,7 @@ namespace Emby.Server.Implementations.Dataprivate static bool EnableJoinUserData(InternalItemsQuery query){- if (query.User == null)+ if (query.User is null){return false;}@@ -2497,7 +2497,7 @@ namespace Emby.Server.Implementations.Data{var item = query.SimilarTo;- if (item == null)+ if (item is null){return;}@@ -4522,7 +4522,7 @@ namespace Emby.Server.Implementations.Dataif (query.ExcludeInheritedTags.Length > 0){var paramName = "@ExcludeInheritedTags";- if (statement == null)+ if (statement is null){int index = 0;string excludedTags = string.Join(',', query.ExcludeInheritedTags.Select(_ => paramName + index++));@@ -4732,7 +4732,7 @@ namespace Emby.Server.Implementations.Datareturn false;}- if (query.User == null)+ if (query.User is null){return false;}diff --git a/Emby.Server.Implementations/Dto/DtoService.cs b/Emby.Server.Implementations/Dto/DtoService.csindex f6d37421a8..e0e3366b4f 100644--- a/Emby.Server.Implementations/Dto/DtoService.cs+++ b/Emby.Server.Implementations/Dto/DtoService.cs@@ -235,14 +235,14 @@ namespace Emby.Server.Implementations.Dtoif (options.ContainsField(ItemFields.CanDelete)){- dto.CanDelete = user == null+ dto.CanDelete = user is null? item.CanDelete(): item.CanDelete(user);}if (options.ContainsField(ItemFields.CanDownload)){- dto.CanDownload = user == null+ dto.CanDownload = user is null? item.CanDownload(): item.CanDownload(user);}@@ -571,7 +571,7 @@ namespace Emby.Server.Implementations.Dtoreturn null;}}).Where(i => i != null)- .Where(i => user == null ?+ .Where(i => user is null ?true :i.IsVisible(user)).GroupBy(i => i.Name, StringComparer.OrdinalIgnoreCase)@@ -1143,7 +1143,7 @@ namespace Emby.Server.Implementations.Dtoif (episodeSeries != null){dto.SeriesPrimaryImageTag = GetTagAndFillBlurhash(dto, episodeSeries, ImageType.Primary);- if (dto.ImageTags == null || !dto.ImageTags.ContainsKey(ImageType.Primary))+ if (dto.ImageTags is null || !dto.ImageTags.ContainsKey(ImageType.Primary)){AttachPrimaryImageAspectRatio(dto, episodeSeries);}@@ -1193,7 +1193,7 @@ namespace Emby.Server.Implementations.Dtoif (series != null){dto.SeriesPrimaryImageTag = GetTagAndFillBlurhash(dto, series, ImageType.Primary);- if (dto.ImageTags == null || !dto.ImageTags.ContainsKey(ImageType.Primary))+ if (dto.ImageTags is null || !dto.ImageTags.ContainsKey(ImageType.Primary)){AttachPrimaryImageAspectRatio(dto, series);}@@ -1276,7 +1276,7 @@ namespace Emby.Server.Implementations.Dtovar parent = currentItem.DisplayParent ?? currentItem.GetOwner() ?? currentItem.GetParent();- if (parent == null && originalItem is not UserRootFolder && originalItem is not UserView && originalItem is not AggregateFolder && originalItem is not ICollectionFolder && originalItem is not Channel)+ if (parent is null && originalItem is not UserRootFolder && originalItem is not UserView && originalItem is not AggregateFolder && originalItem is not ICollectionFolder && originalItem is not Channel){parent = _libraryManager.GetCollectionFolders(originalItem).FirstOrDefault();}@@ -1315,7 +1315,7 @@ namespace Emby.Server.Implementations.Dto|| parent is Series){parent ??= isFirst ? GetImageDisplayParent(item, item) ?? owner : parent;- if (parent == null)+ if (parent is null){break;}@@ -1403,7 +1403,7 @@ namespace Emby.Server.Implementations.Dto{var imageInfo = item.GetImageInfo(ImageType.Primary, 0);- if (imageInfo == null)+ if (imageInfo is null){return null;}diff --git a/Emby.Server.Implementations/EntryPoints/LibraryChangedNotifier.cs b/Emby.Server.Implementations/EntryPoints/LibraryChangedNotifier.csindex d5e4a636ef..fb6f52332f 100644--- a/Emby.Server.Implementations/EntryPoints/LibraryChangedNotifier.cs+++ b/Emby.Server.Implementations/EntryPoints/LibraryChangedNotifier.cs@@ -191,7 +191,7 @@ namespace Emby.Server.Implementations.EntryPointslock (_libraryChangedSyncLock){- if (LibraryUpdateTimer == null)+ if (LibraryUpdateTimer is null){LibraryUpdateTimer = new Timer(LibraryUpdateTimerCallback,@@ -227,7 +227,7 @@ namespace Emby.Server.Implementations.EntryPointslock (_libraryChangedSyncLock){- if (LibraryUpdateTimer == null)+ if (LibraryUpdateTimer is null){LibraryUpdateTimer = new Timer(LibraryUpdateTimerCallback, null, LibraryUpdateDuration, Timeout.Infinite);}@@ -254,7 +254,7 @@ namespace Emby.Server.Implementations.EntryPointslock (_libraryChangedSyncLock){- if (LibraryUpdateTimer == null)+ if (LibraryUpdateTimer is null){LibraryUpdateTimer = new Timer(LibraryUpdateTimerCallback, null, LibraryUpdateDuration, Timeout.Infinite);}diff --git a/Emby.Server.Implementations/EntryPoints/UserDataChangeNotifier.cs b/Emby.Server.Implementations/EntryPoints/UserDataChangeNotifier.csindex 82c8d3ab6d..ce81f9e42f 100644--- a/Emby.Server.Implementations/EntryPoints/UserDataChangeNotifier.cs+++ b/Emby.Server.Implementations/EntryPoints/UserDataChangeNotifier.cs@@ -51,7 +51,7 @@ namespace Emby.Server.Implementations.EntryPointslock (_syncLock){- if (_updateTimer == null)+ if (_updateTimer is null){_updateTimer = new Timer(UpdateTimerCallback,diff --git a/Emby.Server.Implementations/HttpServer/WebSocketConnection.cs b/Emby.Server.Implementations/HttpServer/WebSocketConnection.csindex d095248fab..b1a99853ad 100644--- a/Emby.Server.Implementations/HttpServer/WebSocketConnection.cs+++ b/Emby.Server.Implementations/HttpServer/WebSocketConnection.cs@@ -164,7 +164,7 @@ namespace Emby.Server.Implementations.HttpServerReadResult result = await reader.ReadAsync().ConfigureAwait(false);ReadOnlySequence<byte> buffer = result.Buffer;- if (OnReceive == null)+ if (OnReceive is null){// Tell the PipeReader how much of the buffer we have consumedreader.AdvanceTo(buffer.End);@@ -185,7 +185,7 @@ namespace Emby.Server.Implementations.HttpServerreturn;}- if (stub == null)+ if (stub is null){_logger.LogError("Error processing web socket message");return;diff --git a/Emby.Server.Implementations/IO/FileRefresher.cs b/Emby.Server.Implementations/IO/FileRefresher.csindex 6326208f71..6337952c12 100644--- a/Emby.Server.Implementations/IO/FileRefresher.cs+++ b/Emby.Server.Implementations/IO/FileRefresher.cs@@ -80,7 +80,7 @@ namespace Emby.Server.Implementations.IOreturn;}- if (_timer == null)+ if (_timer is null){_timer = new Timer(OnTimerCallback, null, TimeSpan.FromSeconds(_configurationManager.Configuration.LibraryMonitorDelay), TimeSpan.FromMilliseconds(-1));}@@ -178,7 +178,7 @@ namespace Emby.Server.Implementations.IO{BaseItem? item = null;- while (item == null && !string.IsNullOrEmpty(path))+ while (item is null && !string.IsNullOrEmpty(path)){item = _libraryManager.FindByPath(path, null);@@ -192,7 +192,7 @@ namespace Emby.Server.Implementations.IO{item = item.GetOwner() ?? item.GetParent();- if (item == null)+ if (item is null){break;}diff --git a/Emby.Server.Implementations/Library/LibraryManager.cs b/Emby.Server.Implementations/Library/LibraryManager.csindex b688af5286..e8f6d2d236 100644--- a/Emby.Server.Implementations/Library/LibraryManager.cs+++ b/Emby.Server.Implementations/Library/LibraryManager.cs@@ -176,7 +176,7 @@ namespace Emby.Server.Implementations.Library{get{- if (_rootFolder == null)+ if (_rootFolder is null){lock (_rootFolderSyncLock){@@ -656,7 +656,7 @@ namespace Emby.Server.Implementations.Libraryif (parent != null){- var multiItemResolvers = resolvers == null ? MultiItemResolvers : resolvers.OfType<IMultiItemResolver>().ToArray();+ var multiItemResolvers = resolvers is null ? MultiItemResolvers : resolvers.OfType<IMultiItemResolver>().ToArray();foreach (var resolver in multiItemResolvers){@@ -770,11 +770,11 @@ namespace Emby.Server.Implementations.Librarypublic Folder GetUserRootFolder(){- if (_userRootFolder == null)+ if (_userRootFolder is null){lock (_userRootFolderSyncLock){- if (_userRootFolder == null)+ if (_userRootFolder is null){var userRootPath = _configurationManager.ApplicationPaths.DefaultUserViewsPath;@@ -792,7 +792,7 @@ namespace Emby.Server.Implementations.Library_logger.LogError(ex, "Error creating UserRootFolder {Path}", newItemId);}- if (tmpItem == null)+ if (tmpItem is null){_logger.LogDebug("Creating new userRootFolder with DeepCopy");tmpItem = ((Folder)ResolvePath(_fileSystem.GetDirectoryInfo(userRootPath))).DeepCopy<Folder, UserRootFolder>();@@ -961,7 +961,7 @@ namespace Emby.Server.Implementations.Libraryvar path = getPathFn(name);var id = GetItemByNameId<T>(path);var item = GetItemById(id) as T;- if (item == null)+ if (item is null){item = new T{@@ -1627,7 +1627,7 @@ namespace Emby.Server.Implementations.Library// Get an existing item by Idvideo = GetItemById(info.ItemId.Value) as Video;- if (video == null)+ if (video is null){_logger.LogError("Unable to locate item with Id {ID}.", info.ItemId.Value);}@@ -1639,7 +1639,7 @@ namespace Emby.Server.Implementations.Library// Try to resolve the path into a videovideo = ResolvePath(_fileSystem.GetFileSystemInfo(info.Path)) as Video;- if (video == null)+ if (video is null){_logger.LogError("Intro resolver returned null for {Path}.", info.Path);}@@ -1711,7 +1711,7 @@ namespace Emby.Server.Implementations.Libraryforeach (var (name, sortOrder) in orderBy){var comparer = GetComparer(name, user);- if (comparer == null)+ if (comparer is null){continue;}@@ -2010,7 +2010,7 @@ namespace Emby.Server.Implementations.Library{var parent = item.GetParent();- if (parent == null || parent is AggregateFolder)+ if (parent is null || parent is AggregateFolder){break;}@@ -2018,7 +2018,7 @@ namespace Emby.Server.Implementations.Libraryitem = parent;}- if (item == null)+ if (item is null){return new List<Folder>();}@@ -2032,7 +2032,7 @@ namespace Emby.Server.Implementations.Library{var parent = item.GetParent();- if (parent == null || parent is AggregateFolder)+ if (parent is null || parent is AggregateFolder){break;}@@ -2040,7 +2040,7 @@ namespace Emby.Server.Implementations.Libraryitem = parent;}- if (item == null)+ if (item is null){return new List<Folder>();}@@ -2064,7 +2064,7 @@ namespace Emby.Server.Implementations.Library.Find(folder => folder is CollectionFolder) as CollectionFolder;}- return collectionFolder == null ? new LibraryOptions() : collectionFolder.GetLibraryOptions();+ return collectionFolder is null ? new LibraryOptions() : collectionFolder.GetLibraryOptions();}public string GetContentType(BaseItem item)@@ -2129,7 +2129,7 @@ namespace Emby.Server.Implementations.Libraryprivate string GetTopFolderContentType(BaseItem item){- if (item == null)+ if (item is null){return null;}@@ -2137,7 +2137,7 @@ namespace Emby.Server.Implementations.Librarywhile (!item.ParentId.Equals(default)){var parent = item.GetParent();- if (parent == null || parent is AggregateFolder)+ if (parent is null || parent is AggregateFolder){break;}@@ -2177,7 +2177,7 @@ namespace Emby.Server.Implementations.Libraryvar refresh = false;- if (item == null || !string.Equals(item.Path, path, StringComparison.OrdinalIgnoreCase))+ if (item is null || !string.Equals(item.Path, path, StringComparison.OrdinalIgnoreCase)){Directory.CreateDirectory(path);@@ -2225,7 +2225,7 @@ namespace Emby.Server.Implementations.Libraryvar isNew = false;- if (item == null)+ if (item is null){Directory.CreateDirectory(path);@@ -2289,7 +2289,7 @@ namespace Emby.Server.Implementations.Libraryvar isNew = false;- if (item == null)+ if (item is null){Directory.CreateDirectory(path);@@ -2362,7 +2362,7 @@ namespace Emby.Server.Implementations.Libraryvar isNew = false;- if (item == null)+ if (item is null){Directory.CreateDirectory(path);@@ -2459,7 +2459,7 @@ namespace Emby.Server.Implementations.LibraryepisodeInfo = resolver.Resolve(episode.Path, isFolder, null, null, isAbsoluteNaming);// Resolve from parent folder if it's not the Season foldervar parent = episode.GetParent();- if (episodeInfo == null && parent.GetType() == typeof(Folder))+ if (episodeInfo is null && parent.GetType() == typeof(Folder)){episodeInfo = resolver.Resolve(parent.Path, true, null, null, isAbsoluteNaming);if (episodeInfo != null)@@ -2620,7 +2620,7 @@ namespace Emby.Server.Implementations.Librarypublic IEnumerable<BaseItem> FindExtras(BaseItem owner, IReadOnlyList<FileSystemMetadata> fileSystemChildren, IDirectoryService directoryService){var ownerVideoInfo = VideoResolver.Resolve(owner.Path, owner.IsFolder, _namingOptions);- if (ownerVideoInfo == null)+ if (ownerVideoInfo is null){yield break;}@@ -2754,7 +2754,7 @@ namespace Emby.Server.Implementations.Library}}).Where(i => i != null)- .Where(i => query.User == null ?+ .Where(i => query.User is null ?true :i.IsVisible(query.User)).ToList();diff --git a/Emby.Server.Implementations/Library/LiveStreamHelper.cs b/Emby.Server.Implementations/Library/LiveStreamHelper.csindex 20624cc7ae..1010335512 100644--- a/Emby.Server.Implementations/Library/LiveStreamHelper.cs+++ b/Emby.Server.Implementations/Library/LiveStreamHelper.cs@@ -60,7 +60,7 @@ namespace Emby.Server.Implementations.Library}}- if (mediaInfo == null)+ if (mediaInfo is null){if (addProbeDelay){@@ -130,7 +130,7 @@ namespace Emby.Server.Implementations.Libraryvar audioStream = mediaStreams.FirstOrDefault(i => i.Type == MediaStreamType.Audio);- if (audioStream == null || audioStream.Index == -1)+ if (audioStream is null || audioStream.Index == -1){mediaSource.DefaultAudioStreamIndex = null;}diff --git a/Emby.Server.Implementations/Library/MediaSourceManager.cs b/Emby.Server.Implementations/Library/MediaSourceManager.csindex bfccc7db72..e2474f5081 100644--- a/Emby.Server.Implementations/Library/MediaSourceManager.cs+++ b/Emby.Server.Implementations/Library/MediaSourceManager.cs@@ -383,7 +383,7 @@ namespace Emby.Server.Implementations.Libraryvar preferredSubs = NormalizeLanguage(user.SubtitleLanguagePreference);var defaultAudioIndex = source.DefaultAudioStreamIndex;- var audioLangage = defaultAudioIndex == null+ var audioLangage = defaultAudioIndex is null? null: source.MediaStreams.Where(i => i.Type == MediaStreamType.Audio && i.Index == defaultAudioIndex).Select(i => i.Language).FirstOrDefault();@@ -417,13 +417,13 @@ namespace Emby.Server.Implementations.Librarypublic void SetDefaultAudioAndSubtitleStreamIndexes(BaseItem item, MediaSourceInfo source, User user){// Item would only be null if the app didn't supply ItemId as part of the live stream open request- var mediaType = item == null ? MediaType.Video : item.MediaType;+ var mediaType = item is null ? MediaType.Video : item.MediaType;if (string.Equals(mediaType, MediaType.Video, StringComparison.OrdinalIgnoreCase)){- var userData = item == null ? new UserItemData() : _userDataManager.GetUserData(user, item);+ var userData = item is null ? new UserItemData() : _userDataManager.GetUserData(user, item);- var allowRememberingSelection = item == null || item.EnableRememberingTrackSelections;+ var allowRememberingSelection = item is null || item.EnableRememberingTrackSelections;SetDefaultAudioStreamIndex(source, userData, user, allowRememberingSelection);SetDefaultSubtitleStreamIndex(source, userData, user, allowRememberingSelection);@@ -543,7 +543,7 @@ namespace Emby.Server.Implementations.Libraryvar audioStream = mediaSource.MediaStreams.FirstOrDefault(i => i.Type == MediaStreamType.Audio);- if (audioStream == null || audioStream.Index == -1)+ if (audioStream is null || audioStream.Index == -1){mediaSource.DefaultAudioStreamIndex = null;}@@ -638,7 +638,7 @@ namespace Emby.Server.Implementations.Library}}- if (mediaInfo == null)+ if (mediaInfo is null){if (addProbeDelay){@@ -713,7 +713,7 @@ namespace Emby.Server.Implementations.Libraryvar audioStream = mediaStreams.FirstOrDefault(i => i.Type == MediaStreamType.Audio);- if (audioStream == null || audioStream.Index == -1)+ if (audioStream is null || audioStream.Index == -1){mediaSource.DefaultAudioStreamIndex = null;}diff --git a/Emby.Server.Implementations/Library/ResolverHelper.cs b/Emby.Server.Implementations/Library/ResolverHelper.csindex 4100a74a58..590d37b926 100644--- a/Emby.Server.Implementations/Library/ResolverHelper.cs+++ b/Emby.Server.Implementations/Library/ResolverHelper.cs@@ -43,7 +43,7 @@ namespace Emby.Server.Implementations.Library// Make sure DateCreated and DateModified have valuesvar fileInfo = directoryService.GetFile(item.Path);- if (fileInfo == null)+ if (fileInfo is null){return false;}diff --git a/Emby.Server.Implementations/Library/Resolvers/Audio/AudioResolver.cs b/Emby.Server.Implementations/Library/Resolvers/Audio/AudioResolver.csindex 7a6aea9c1f..bc1f5d08a8 100644--- a/Emby.Server.Implementations/Library/Resolvers/Audio/AudioResolver.cs+++ b/Emby.Server.Implementations/Library/Resolvers/Audio/AudioResolver.cs@@ -116,7 +116,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Audio// Use regular audio type for mixed libraries, owned items and musicif (isMixedCollectionType ||- args.Parent == null ||+ args.Parent is null ||isMusicCollectionType){item = new MediaBrowser.Controller.Entities.Audio.Audio();@@ -144,7 +144,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Audio// TODO: Allow GetMultiDiscMovie in herevar result = ResolveMultipleAudio(args.Parent, args.GetActualFileSystemChildren(), parseName);- if (result == null || result.Items.Count != 1 || result.Items[0] is not AudioBook item)+ if (result is null || result.Items.Count != 1 || result.Items[0] is not AudioBook item){return null;}diff --git a/Emby.Server.Implementations/Library/Resolvers/BaseVideoResolver.cs b/Emby.Server.Implementations/Library/Resolvers/BaseVideoResolver.csindex b2a7abb1bd..cb377136ad 100644--- a/Emby.Server.Implementations/Library/Resolvers/BaseVideoResolver.cs+++ b/Emby.Server.Implementations/Library/Resolvers/BaseVideoResolver.cs@@ -79,7 +79,7 @@ namespace Emby.Server.Implementations.Library.ResolversvideoType = VideoType.Dvd;}- if (videoType == null)+ if (videoType is null){continue;}@@ -93,7 +93,7 @@ namespace Emby.Server.Implementations.Library.ResolversvideoInfo = VideoResolver.Resolve(args.Path, false, NamingOptions, parseName);}- if (videoInfo == null || (!videoInfo.IsStub && !VideoResolver.IsVideoFile(args.Path, NamingOptions)))+ if (videoInfo is null || (!videoInfo.IsStub && !VideoResolver.IsVideoFile(args.Path, NamingOptions))){return null;}diff --git a/Emby.Server.Implementations/Library/Resolvers/ExtraResolver.cs b/Emby.Server.Implementations/Library/Resolvers/ExtraResolver.csindex 408e640f9d..30c52e19d3 100644--- a/Emby.Server.Implementations/Library/Resolvers/ExtraResolver.cs+++ b/Emby.Server.Implementations/Library/Resolvers/ExtraResolver.cs@@ -48,7 +48,7 @@ namespace Emby.Server.Implementations.Library.Resolverspublic bool TryGetExtraTypeForOwner(string path, VideoFileInfo ownerVideoFileInfo, [NotNullWhen(true)] out ExtraType? extraType){var extraResult = GetExtraInfo(path, _namingOptions);- if (extraResult.ExtraType == null)+ if (extraResult.ExtraType is null){extraType = null;return false;diff --git a/Emby.Server.Implementations/Library/Resolvers/GenericFolderResolver.cs b/Emby.Server.Implementations/Library/Resolvers/GenericFolderResolver.csindex 0799622825..1c2de912aa 100644--- a/Emby.Server.Implementations/Library/Resolvers/GenericFolderResolver.cs+++ b/Emby.Server.Implementations/Library/Resolvers/GenericFolderResolver.cs@@ -22,7 +22,7 @@ namespace Emby.Server.Implementations.Library.Resolvers{base.SetInitialItemValues(item, args);- item.IsRoot = args.Parent == null;+ item.IsRoot = args.Parent is null;}}}diff --git a/Emby.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs b/Emby.Server.Implementations/Library/Resolvers/Movies/MovieResolver.csindex 84d4688aff..6b18ad237f 100644--- a/Emby.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs+++ b/Emby.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs@@ -108,7 +108,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Moviesif (string.IsNullOrEmpty(collectionType)){// Owned items will be caught by the video extra resolver- if (args.Parent == null)+ if (args.Parent is null){return null;}@@ -127,10 +127,10 @@ namespace Emby.Server.Implementations.Library.Resolvers.Movies}// ignore extras- return movie?.ExtraType == null ? movie : null;+ return movie?.ExtraType is null ? movie : null;}- if (args.Parent == null)+ if (args.Parent is null){return base.Resolve(args);}@@ -205,7 +205,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Moviesif (string.IsNullOrEmpty(collectionType)){// Owned items should just use the plain video type- if (parent == null)+ if (parent is null){return ResolveVideos<Video>(parent, files, false, collectionType, false);}diff --git a/Emby.Server.Implementations/Library/Resolvers/TV/EpisodeResolver.cs b/Emby.Server.Implementations/Library/Resolvers/TV/EpisodeResolver.csindex 9ba079edfd..2e2b793418 100644--- a/Emby.Server.Implementations/Library/Resolvers/TV/EpisodeResolver.cs+++ b/Emby.Server.Implementations/Library/Resolvers/TV/EpisodeResolver.cs@@ -34,7 +34,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.TV{var parent = args.Parent;- if (parent == null)+ if (parent is null){return null;}@@ -53,7 +53,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.TVvar episode = ResolveVideo<Episode>(args, false);// Ignore extras- if (episode == null || episode.ExtraType != null)+ if (episode is null || episode.ExtraType != null){return null;}@@ -73,7 +73,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.TV}// Assume season 1 if there's no season folder and a season number could not be determined- if (season == null && !episode.ParentIndexNumber.HasValue && (episode.IndexNumber.HasValue || episode.PremiereDate.HasValue))+ if (season is null && !episode.ParentIndexNumber.HasValue && (episode.IndexNumber.HasValue || episode.PremiereDate.HasValue)){episode.ParentIndexNumber = 1;}diff --git a/Emby.Server.Implementations/Library/UserViewManager.cs b/Emby.Server.Implementations/Library/UserViewManager.csindex ec411aa3ba..c294a63db6 100644--- a/Emby.Server.Implementations/Library/UserViewManager.cs+++ b/Emby.Server.Implementations/Library/UserViewManager.cs@@ -47,7 +47,7 @@ namespace Emby.Server.Implementations.Library{var user = _userManager.GetUserById(query.UserId);- if (user == null)+ if (user is null){throw new ArgumentException("User Id specified in the query does not exist.", nameof(query));}@@ -208,7 +208,7 @@ namespace Emby.Server.Implementations.Library// Only grab the index container for mediavar container = item.IsFolder || !request.GroupItems ? null : item.LatestItemsIndexContainer;- if (container == null)+ if (container is null){list.Add(new Tuple<BaseItem, List<BaseItem>>(null, new List<BaseItem> { item }));}diff --git a/Emby.Server.Implementations/Library/Validators/CollectionPostScanTask.cs b/Emby.Server.Implementations/Library/Validators/CollectionPostScanTask.csindex 88b93a2115..df45793c3a 100644--- a/Emby.Server.Implementations/Library/Validators/CollectionPostScanTask.cs+++ b/Emby.Server.Implementations/Library/Validators/CollectionPostScanTask.cs@@ -118,7 +118,7 @@ namespace Emby.Server.Implementations.Library.Validatorstry{var boxSet = boxSets.FirstOrDefault(b => b?.Name == collectionName) as BoxSet;- if (boxSet == null)+ if (boxSet is null){// won't automatically create collection if only one movie in itif (movieIds.Count >= 2)diff --git a/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.csindex cf9be5a54a..2f4854a6dd 100644--- a/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs+++ b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs@@ -295,7 +295,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV}var program = GetProgramInfoFromCache(timer);- if (program == null)+ if (program is null){OnTimerOutOfDate(timer);continue;@@ -642,7 +642,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTVprogramInfo = GetProgramInfoFromCache(info);}- if (programInfo == null)+ if (programInfo is null){_logger.LogInformation("Unable to find program with Id {0}. Will search using start date", info.ProgramId);programInfo = GetProgramInfoFromCache(info.ChannelId, info.StartDate);@@ -744,7 +744,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV{var existingTimer = _timerProvider.GetTimer(updatedTimer.Id);- if (existingTimer == null)+ if (existingTimer is null){throw new ResourceNotFoundException();}@@ -912,7 +912,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTVvar epgChannel = await GetEpgChannelFromTunerChannel(provider.Item1, provider.Item2, channel, cancellationToken).ConfigureAwait(false);- if (epgChannel == null)+ if (epgChannel is null){_logger.LogDebug("EPG channel not found for tuner channel {0}-{1} from {2}-{3}", channel.Number, channel.Name, provider.Item1.Name, provider.Item2.ListingsId ?? string.Empty);continue;@@ -945,7 +945,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV{var provider = _liveTvManager.ListingProviders.FirstOrDefault(l => string.Equals(l.Type, i.Type, StringComparison.OrdinalIgnoreCase));- return provider == null ? null : new Tuple<IListingsProvider, ListingsProviderInfo>(provider, i);+ return provider is null ? null : new Tuple<IListingsProvider, ListingsProviderInfo>(provider, i);}).Where(i => i != null).ToList();@@ -1232,7 +1232,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTVprogramInfo = GetProgramInfoFromCache(timer);}- if (programInfo == null)+ if (programInfo is null){_logger.LogInformation("Unable to find program with Id {0}. Will search using start date", timer.ProgramId);programInfo = GetProgramInfoFromCache(timer.ChannelId, timer.StartDate);@@ -1437,7 +1437,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTVvar parentPath = Path.GetDirectoryName(path);- while (item == null && !string.IsNullOrEmpty(path))+ while (item is null && !string.IsNullOrEmpty(path)){item = _libraryManager.FindByPath(path, null);@@ -1474,7 +1474,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTVvar seriesTimerId = timer.SeriesTimerId;var seriesTimer = _seriesTimerProvider.GetAll().FirstOrDefault(i => string.Equals(i.Id, seriesTimerId, StringComparison.OrdinalIgnoreCase));- if (seriesTimer == null || seriesTimer.KeepUpTo <= 0)+ if (seriesTimer is null || seriesTimer.KeepUpTo <= 0){return;}@@ -1695,7 +1695,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV_ => null};- if (imageSaveFilenameWithoutExtension == null)+ if (imageSaveFilenameWithoutExtension is null){return;}@@ -1782,7 +1782,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV}).FirstOrDefault() as LiveTvProgram;// dummy this up- if (program == null)+ if (program is null){program = new LiveTvProgram{@@ -2240,7 +2240,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV? null: _timerProvider.GetTimerByProgramId(timer.ProgramId));- if (existingTimer == null)+ if (existingTimer is null){if (ShouldCancelTimerForSeriesTimer(seriesTimer, timer)){diff --git a/Emby.Server.Implementations/LiveTv/EmbyTV/ItemDataProvider.cs b/Emby.Server.Implementations/LiveTv/EmbyTV/ItemDataProvider.csindex 58b798ce67..80e3e5233f 100644--- a/Emby.Server.Implementations/LiveTv/EmbyTV/ItemDataProvider.cs+++ b/Emby.Server.Implementations/LiveTv/EmbyTV/ItemDataProvider.cs@@ -49,7 +49,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV{var bytes = File.ReadAllBytes(_dataPath);_items = JsonSerializer.Deserialize<T[]>(bytes, _jsonOptions);- if (_items == null)+ if (_items is null){Logger.LogError("Error deserializing {Path}, data was null", _dataPath);_items = Array.Empty<T>();diff --git a/Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs b/Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.csindex b981ad81a7..69670e8110 100644--- a/Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs+++ b/Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs@@ -111,7 +111,7 @@ namespace Emby.Server.Implementations.LiveTv.Listingsusing var response = await Send(options, true, info, cancellationToken).ConfigureAwait(false);await using var responseStream = await response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false);var dailySchedules = await JsonSerializer.DeserializeAsync<IReadOnlyList<DayDto>>(responseStream, _jsonOptions, cancellationToken).ConfigureAwait(false);- if (dailySchedules == null)+ if (dailySchedules is null){return Array.Empty<ProgramInfo>();}@@ -127,7 +127,7 @@ namespace Emby.Server.Implementations.LiveTv.Listingsusing var innerResponse = await Send(programRequestOptions, true, info, cancellationToken).ConfigureAwait(false);await using var innerResponseStream = await innerResponse.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false);var programDetails = await JsonSerializer.DeserializeAsync<IReadOnlyList<ProgramDetailsDto>>(innerResponseStream, _jsonOptions, cancellationToken).ConfigureAwait(false);- if (programDetails == null)+ if (programDetails is null){return Array.Empty<ProgramInfo>();}@@ -228,7 +228,7 @@ namespace Emby.Server.Implementations.LiveTv.Listingsprivate ProgramInfo GetProgram(string channelId, ProgramDto programInfo, ProgramDetailsDto details){- if (programInfo.AirDateTime == null)+ if (programInfo.AirDateTime is null){return null;}@@ -283,7 +283,7 @@ namespace Emby.Server.Implementations.LiveTv.ListingsEpisodeTitle = episodeTitle,Audio = audioType,// IsNew = programInfo.@new ?? false,- IsRepeat = programInfo.New == null,+ IsRepeat = programInfo.New is null,IsSeries = string.Equals(details.EntityType, "episode", StringComparison.OrdinalIgnoreCase),ImageUrl = details.PrimaryImage,ThumbImageUrl = details.ThumbImage,@@ -407,7 +407,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings.ThenByDescending(i => GetSizeOrder(i)).FirstOrDefault();- if (match == null)+ if (match is null){return null;}@@ -785,7 +785,7 @@ namespace Emby.Server.Implementations.LiveTv.Listingsusing var httpResponse = await Send(options, true, info, cancellationToken).ConfigureAwait(false);await using var stream = await httpResponse.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false);var root = await JsonSerializer.DeserializeAsync<ChannelDto>(stream, _jsonOptions, cancellationToken).ConfigureAwait(false);- if (root == null)+ if (root is null){return new List<ChannelInfo>();}diff --git a/Emby.Server.Implementations/LiveTv/Listings/XmlTvListingsProvider.cs b/Emby.Server.Implementations/LiveTv/Listings/XmlTvListingsProvider.csindex 264eec947a..1b72a44b4b 100644--- a/Emby.Server.Implementations/LiveTv/Listings/XmlTvListingsProvider.cs+++ b/Emby.Server.Implementations/LiveTv/Listings/XmlTvListingsProvider.cs@@ -162,7 +162,7 @@ namespace Emby.Server.Implementations.LiveTv.ListingsHasImage = !string.IsNullOrEmpty(program.Icon?.Source),OfficialRating = string.IsNullOrEmpty(program.Rating?.Value) ? null : program.Rating.Value,CommunityRating = program.StarRating,- SeriesId = program.Episode == null ? null : program.Title?.GetMD5().ToString("N", CultureInfo.InvariantCulture)+ SeriesId = program.Episode is null ? null : program.Title?.GetMD5().ToString("N", CultureInfo.InvariantCulture)};if (string.IsNullOrWhiteSpace(program.ProgramId))diff --git a/Emby.Server.Implementations/LiveTv/LiveTvDtoService.cs b/Emby.Server.Implementations/LiveTv/LiveTvDtoService.csindex c09f9cf8d0..a92b473b5d 100644--- a/Emby.Server.Implementations/LiveTv/LiveTvDtoService.cs+++ b/Emby.Server.Implementations/LiveTv/LiveTvDtoService.cs@@ -150,7 +150,7 @@ namespace Emby.Server.Implementations.LiveTvdto.ProgramId = GetInternalProgramId(info.ProgramId).ToString("N", CultureInfo.InvariantCulture);}- dto.DayPattern = info.Days == null ? null : GetDayPattern(info.Days.ToArray());+ dto.DayPattern = info.Days is null ? null : GetDayPattern(info.Days.ToArray());FillImages(dto, info.Name, info.SeriesId);@@ -228,7 +228,7 @@ namespace Emby.Server.Implementations.LiveTv}}- if (dto.ParentBackdropImageTags == null || dto.ParentBackdropImageTags.Length == 0)+ if (dto.ParentBackdropImageTags is null || dto.ParentBackdropImageTags.Length == 0){image = program.GetImageInfo(ImageType.Backdrop, 0);if (image != null)@@ -305,7 +305,7 @@ namespace Emby.Server.Implementations.LiveTvDtoOptions = new DtoOptions(false)}).FirstOrDefault();- if (program == null)+ if (program is null){program = _libraryManager.GetItemList(new InternalItemsQuery{@@ -334,7 +334,7 @@ namespace Emby.Server.Implementations.LiveTv}}- if (dto.ParentBackdropImageTags == null || dto.ParentBackdropImageTags.Length == 0)+ if (dto.ParentBackdropImageTags is null || dto.ParentBackdropImageTags.Length == 0){image = program.GetImageInfo(ImageType.Backdrop, 0);if (image != null)diff --git a/Emby.Server.Implementations/LiveTv/LiveTvManager.cs b/Emby.Server.Implementations/LiveTv/LiveTvManager.csindex 97c2e6e306..ea26a2227f 100644--- a/Emby.Server.Implementations/LiveTv/LiveTvManager.cs+++ b/Emby.Server.Implementations/LiveTv/LiveTvManager.cs@@ -434,7 +434,7 @@ namespace Emby.Server.Implementations.LiveTvvar item = _libraryManager.GetItemById(id) as LiveTvChannel;- if (item == null)+ if (item is null){item = new LiveTvChannel{@@ -948,7 +948,7 @@ namespace Emby.Server.Implementations.LiveTvvar channel = _libraryManager.GetItemById(program.ChannelId);- if (channel == null)+ if (channel is null){return score;}@@ -1314,7 +1314,7 @@ namespace Emby.Server.Implementations.LiveTvprivate QueryResult<BaseItem> GetEmbyRecordings(RecordingQuery query, DtoOptions dtoOptions, User user){- if (user == null)+ if (user is null){return new QueryResult<BaseItem>();}@@ -1702,7 +1702,7 @@ namespace Emby.Server.Implementations.LiveTv{var timer = await GetTimer(id, CancellationToken.None).ConfigureAwait(false);- if (timer == null)+ if (timer is null){throw new ResourceNotFoundException(string.Format(CultureInfo.InvariantCulture, "Timer with Id {0} not found", id));}@@ -1721,7 +1721,7 @@ namespace Emby.Server.Implementations.LiveTv{var timer = await GetSeriesTimer(id, CancellationToken.None).ConfigureAwait(false);- if (timer == null)+ if (timer is null){throw new ResourceNotFoundException(string.Format(CultureInfo.InvariantCulture, "SeriesTimer with Id {0} not found", id));}@@ -1834,7 +1834,7 @@ namespace Emby.Server.Implementations.LiveTv{var internalChannelId = _tvDtoService.GetInternalChannelId(i.Item2.Name, i.Item1.ChannelId);var channel = _libraryManager.GetItemById(internalChannelId);- channelName = channel == null ? null : channel.Name;+ channelName = channel is null ? null : channel.Name;}return _tvDtoService.GetSeriesTimerInfoDto(i.Item1, i.Item2, channelName);@@ -2147,7 +2147,7 @@ namespace Emby.Server.Implementations.LiveTvvar service = _services.FirstOrDefault(i => string.Equals(i.GetType().FullName.GetMD5().ToString("N", CultureInfo.InvariantCulture), parts[0], StringComparison.OrdinalIgnoreCase));- if (service == null)+ if (service is null){throw new ArgumentException("Service not found.");}@@ -2178,7 +2178,7 @@ namespace Emby.Server.Implementations.LiveTvvar provider = _tunerHosts.FirstOrDefault(i => string.Equals(info.Type, i.Type, StringComparison.OrdinalIgnoreCase));- if (provider == null)+ if (provider is null){throw new ResourceNotFoundException();}@@ -2222,7 +2222,7 @@ namespace Emby.Server.Implementations.LiveTvvar provider = _listingProviders.FirstOrDefault(i => string.Equals(info.Type, i.Type, StringComparison.OrdinalIgnoreCase));- if (provider == null)+ if (provider is null){throw new ResourceNotFoundException(string.Format(@@ -2334,7 +2334,7 @@ namespace Emby.Server.Implementations.LiveTv{var provider = _listingProviders.FirstOrDefault(i => string.Equals(providerType, i.Type, StringComparison.OrdinalIgnoreCase));- if (provider == null)+ if (provider is null){throw new ResourceNotFoundException();}@@ -2347,7 +2347,7 @@ namespace Emby.Server.Implementations.LiveTvvar provider = _listingProviders.FirstOrDefault(i => string.Equals(info.Type, i.Type, StringComparison.OrdinalIgnoreCase));- if (provider == null)+ if (provider is null){throw new ResourceNotFoundException();}diff --git a/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs b/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.csindex e0eaa8e585..04d64e5006 100644--- a/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs+++ b/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs@@ -302,7 +302,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerunvar hdHomerunChannelInfo = channels.FirstOrDefault() as HdHomerunChannelInfo;- if (hdHomerunChannelInfo == null || hdHomerunChannelInfo.IsLegacyTuner)+ if (hdHomerunChannelInfo is null || hdHomerunChannelInfo.IsLegacyTuner){return await GetTunerInfosUdp(info, cancellationToken).ConfigureAwait(false);}diff --git a/Emby.Server.Implementations/Localization/LocalizationManager.cs b/Emby.Server.Implementations/Localization/LocalizationManager.csindex b771681266..8f15a155ed 100644--- a/Emby.Server.Implementations/Localization/LocalizationManager.cs+++ b/Emby.Server.Implementations/Localization/LocalizationManager.cs@@ -329,14 +329,14 @@ namespace Emby.Server.Implementations.Localization{await using var stream = _assembly.GetManifestResourceStream(resourcePath);// If a Culture doesn't have a translation the stream will be null and it defaults to en-us further up the chain- if (stream == null)+ if (stream is null){_logger.LogError("Missing translation/culture resource: {ResourcePath}", resourcePath);return;}var dict = await JsonSerializer.DeserializeAsync<Dictionary<string, string>>(stream, _jsonOptions).ConfigureAwait(false);- if (dict == null)+ if (dict is null){throw new InvalidOperationException($"Resource contains invalid data: '{stream}'");}diff --git a/Emby.Server.Implementations/Playlists/PlaylistManager.cs b/Emby.Server.Implementations/Playlists/PlaylistManager.csindex 9e7035cb31..d8d4629c1f 100644--- a/Emby.Server.Implementations/Playlists/PlaylistManager.cs+++ b/Emby.Server.Implementations/Playlists/PlaylistManager.cs@@ -70,7 +70,7 @@ namespace Emby.Server.Implementations.Playlistsvar folderName = _fileSystem.GetValidFilename(name);var parentFolder = GetPlaylistsFolder(Guid.Empty);- if (parentFolder == null)+ if (parentFolder is null){throw new ArgumentException(nameof(parentFolder));}@@ -81,7 +81,7 @@ namespace Emby.Server.Implementations.Playlists{var item = _libraryManager.GetItemById(itemId);- if (item == null)+ if (item is null){throw new ArgumentException("No item exists with the supplied Id");}diff --git a/Emby.Server.Implementations/Playlists/PlaylistsFolder.cs b/Emby.Server.Implementations/Playlists/PlaylistsFolder.csindex 8ec9f61616..e2f2e436f2 100644--- a/Emby.Server.Implementations/Playlists/PlaylistsFolder.cs+++ b/Emby.Server.Implementations/Playlists/PlaylistsFolder.cs@@ -39,7 +39,7 @@ namespace Emby.Server.Implementations.Playlistsprotected override QueryResult<BaseItem> GetItemsInternal(InternalItemsQuery query){- if (query.User == null)+ if (query.User is null){query.Recursive = false;return base.GetItemsInternal(query);diff --git a/Emby.Server.Implementations/Plugins/PluginManager.cs b/Emby.Server.Implementations/Plugins/PluginManager.csindex 3f7d46822e..c1a38d23ca 100644--- a/Emby.Server.Implementations/Plugins/PluginManager.cs+++ b/Emby.Server.Implementations/Plugins/PluginManager.cs@@ -174,7 +174,7 @@ namespace Emby.Server.Implementations.Pluginsforeach (var pluginServiceRegistrator in _appHost.GetExportTypes<IPluginServiceRegistrator>()){var plugin = GetPluginByAssembly(pluginServiceRegistrator.Assembly);- if (plugin == null)+ if (plugin is null){_logger.LogError("Unable to find plugin in assembly {Assembly}", pluginServiceRegistrator.Assembly.FullName);continue;@@ -263,7 +263,7 @@ namespace Emby.Server.Implementations.Plugins{LocalPlugin? plugin;- if (version == null)+ if (version is null){// If no version is given, return the current instance.var plugins = _plugins.Where(p => p.Id.Equals(id)).ToList();@@ -320,7 +320,7 @@ namespace Emby.Server.Implementations.PluginsArgumentNullException.ThrowIfNull(assembly);var plugin = _plugins.FirstOrDefault(p => p.DllFiles.Contains(assembly.Location));- if (plugin == null)+ if (plugin is null){// A plugin's assembly didn't cause this issue, so ignore it.return;@@ -442,7 +442,7 @@ namespace Emby.Server.Implementations.Plugins_logger.LogDebug("Creating instance of {Type}", type);// _appHost.ServiceProvider is already assigned when we create the pluginsvar instance = (IPlugin)ActivatorUtilities.CreateInstance(_appHost.ServiceProvider!, type);- if (plugin == null)+ if (plugin is null){// Create a dummy record for the providers.// TODO: remove this code once all provided have been released as separate plugins.@@ -711,7 +711,7 @@ namespace Emby.Server.Implementations.Plugins&& p.IsEnabledAndSupported&& p.Version != plugin.Version);- if (previousVersion == null)+ if (previousVersion is null){// This value is memory only - so that the web will show restart required.plugin.Manifest.Status = PluginStatus.Restart;diff --git a/Emby.Server.Implementations/ScheduledTasks/ScheduledTaskWorker.cs b/Emby.Server.Implementations/ScheduledTasks/ScheduledTaskWorker.csindex b370e06efa..25515f7787 100644--- a/Emby.Server.Implementations/ScheduledTasks/ScheduledTaskWorker.cs+++ b/Emby.Server.Implementations/ScheduledTasks/ScheduledTaskWorker.cs@@ -128,7 +128,7 @@ namespace Emby.Server.Implementations.ScheduledTaskslock (_lastExecutionResultSyncLock){- if (_lastExecutionResult == null && !_readFromFile)+ if (_lastExecutionResult is null && !_readFromFile){if (File.Exists(path)){diff --git a/Emby.Server.Implementations/ScheduledTasks/TaskManager.cs b/Emby.Server.Implementations/ScheduledTasks/TaskManager.csindex 0431858fca..63f0beb105 100644--- a/Emby.Server.Implementations/ScheduledTasks/TaskManager.cs+++ b/Emby.Server.Implementations/ScheduledTasks/TaskManager.cs@@ -94,7 +94,7 @@ namespace Emby.Server.Implementations.ScheduledTasks{var scheduledTask = ScheduledTasks.FirstOrDefault(t => t.ScheduledTask.GetType() == typeof(T));- if (scheduledTask == null)+ if (scheduledTask is null){_logger.LogError("Unable to find scheduled task of type {0} in QueueScheduledTask.", typeof(T).Name);}@@ -126,7 +126,7 @@ namespace Emby.Server.Implementations.ScheduledTasks{var scheduledTask = ScheduledTasks.FirstOrDefault(t => t.ScheduledTask.GetType() == typeof(T));- if (scheduledTask == null)+ if (scheduledTask is null){_logger.LogError("Unable to find scheduled task of type {0} in Execute.", typeof(T).Name);}@@ -155,7 +155,7 @@ namespace Emby.Server.Implementations.ScheduledTasks{var scheduledTask = ScheduledTasks.FirstOrDefault(t => t.ScheduledTask.GetType() == task.GetType());- if (scheduledTask == null)+ if (scheduledTask is null){_logger.LogError("Unable to find scheduled task of type {0} in QueueScheduledTask.", task.GetType().Name);}diff --git a/Emby.Server.Implementations/ScheduledTasks/Triggers/IntervalTrigger.cs b/Emby.Server.Implementations/ScheduledTasks/Triggers/IntervalTrigger.csindex 3eb800199d..e9b8a8257f 100644--- a/Emby.Server.Implementations/ScheduledTasks/Triggers/IntervalTrigger.cs+++ b/Emby.Server.Implementations/ScheduledTasks/Triggers/IntervalTrigger.cs@@ -50,7 +50,7 @@ namespace Emby.Server.Implementations.ScheduledTasks.TriggersDateTime triggerDate;- if (lastResult == null)+ if (lastResult is null){// Task has never been completed beforetriggerDate = DateTime.UtcNow.AddHours(1);diff --git a/Emby.Server.Implementations/Session/SessionManager.cs b/Emby.Server.Implementations/Session/SessionManager.csindex 0d1029882b..a1e3b9dbd9 100644--- a/Emby.Server.Implementations/Session/SessionManager.cs+++ b/Emby.Server.Implementations/Session/SessionManager.cs@@ -377,11 +377,11 @@ namespace Emby.Server.Implementations.Sessioninfo.MediaSourceId = info.ItemId.ToString("N", CultureInfo.InvariantCulture);}- if (!info.ItemId.Equals(default) && info.Item == null && libraryItem != null)+ if (!info.ItemId.Equals(default) && info.Item is null && libraryItem != null){var current = session.NowPlayingItem;- if (current == null || !info.ItemId.Equals(current.Id))+ if (current is null || !info.ItemId.Equals(current.Id)){var runtimeTicks = libraryItem.RunTimeTicks;@@ -495,7 +495,7 @@ namespace Emby.Server.Implementations.SessionsessionInfo.UserId = user?.Id ?? Guid.Empty;sessionInfo.UserName = user?.Username;- sessionInfo.UserPrimaryImageTag = user?.ProfileImage == null ? null : GetImageCacheTag(user);+ sessionInfo.UserPrimaryImageTag = user?.ProfileImage is null ? null : GetImageCacheTag(user);sessionInfo.RemoteEndPoint = remoteEndPoint;sessionInfo.Client = appName;@@ -506,7 +506,7 @@ namespace Emby.Server.Implementations.SessionsessionInfo.ApplicationVersion = appVersion;- if (user == null)+ if (user is null){sessionInfo.AdditionalUsers = Array.Empty<SessionUserInfo>();}@@ -536,7 +536,7 @@ namespace Emby.Server.Implementations.SessionsessionInfo.UserId = user?.Id ?? Guid.Empty;sessionInfo.UserName = username;- sessionInfo.UserPrimaryImageTag = user?.ProfileImage == null ? null : GetImageCacheTag(user);+ sessionInfo.UserPrimaryImageTag = user?.ProfileImage is null ? null : GetImageCacheTag(user);sessionInfo.RemoteEndPoint = remoteEndPoint;if (string.IsNullOrEmpty(deviceName))@@ -570,7 +570,7 @@ namespace Emby.Server.Implementations.Sessionvar user = _userManager.GetUserById(session.UserId);- if (user == null)+ if (user is null){throw new InvalidOperationException("User not found");}@@ -618,7 +618,7 @@ namespace Emby.Server.Implementations.Sessionawait OnPlaybackStopped(new PlaybackStopInfo{Item = session.NowPlayingItem,- ItemId = session.NowPlayingItem == null ? Guid.Empty : session.NowPlayingItem.Id,+ ItemId = session.NowPlayingItem is null ? Guid.Empty : session.NowPlayingItem.Id,SessionId = session.Id,MediaSourceId = session.PlayState?.MediaSourceId,PositionTicks = session.PlayState?.PositionTicks@@ -912,11 +912,11 @@ namespace Emby.Server.Implementations.Sessioninfo.MediaSourceId = info.ItemId.ToString("N", CultureInfo.InvariantCulture);}- if (!info.ItemId.Equals(default) && info.Item == null && libraryItem != null)+ if (!info.ItemId.Equals(default) && info.Item is null && libraryItem != null){var current = session.NowPlayingItem;- if (current == null || !info.ItemId.Equals(current.Id))+ if (current is null || !info.ItemId.Equals(current.Id)){MediaSourceInfo mediaSource = null;@@ -1037,7 +1037,7 @@ namespace Emby.Server.Implementations.Sessionprivate SessionInfo GetSession(string sessionId, bool throwOnMissing = true){var session = Sessions.FirstOrDefault(i => string.Equals(i.Id, sessionId, StringComparison.Ordinal));- if (session == null && throwOnMissing)+ if (session is null && throwOnMissing){throw new ResourceNotFoundException(string.Format(CultureInfo.InvariantCulture, "Session {0} not found.", sessionId));@@ -1051,7 +1051,7 @@ namespace Emby.Server.Implementations.Session// Accept either device id or session idvar session = Sessions.FirstOrDefault(i => string.Equals(i.Id, sessionId, StringComparison.Ordinal));- if (session == null)+ if (session is null){throw new ResourceNotFoundException(string.Format(CultureInfo.InvariantCulture, "Session {0} not found.", sessionId));@@ -1231,7 +1231,7 @@ namespace Emby.Server.Implementations.Session{var item = _libraryManager.GetItemById(id);- if (item == null)+ if (item is null){_logger.LogError("A non-existent item Id {0} was passed into TranslateItemForPlayback", id);return Array.Empty<BaseItem>();@@ -1284,7 +1284,7 @@ namespace Emby.Server.Implementations.Session{var item = _libraryManager.GetItemById(id);- if (item == null)+ if (item is null){_logger.LogError("A non-existent item Id {0} was passed into TranslateItemForInstantMix", id);return new List<BaseItem>();@@ -1480,7 +1480,7 @@ namespace Emby.Server.Implementations.Sessiontrue).ConfigureAwait(false);}- if (user == null)+ if (user is null){AuthenticationFailed?.Invoke(this, new GenericEventArgs<AuthenticationRequest>(request));throw new AuthenticationException("Invalid username or password entered.");@@ -1541,7 +1541,7 @@ namespace Emby.Server.Implementations.Sessionforeach (var auth in allExistingForDevice){- if (existing == null || !string.Equals(auth.AccessToken, existing.AccessToken, StringComparison.Ordinal))+ if (existing is null || !string.Equals(auth.AccessToken, existing.AccessToken, StringComparison.Ordinal)){try{@@ -1677,7 +1677,7 @@ namespace Emby.Server.Implementations.Sessionvar dtoOptions = _itemInfoDtoOptions;- if (_itemInfoDtoOptions == null)+ if (_itemInfoDtoOptions is null){dtoOptions = new DtoOptions{diff --git a/Emby.Server.Implementations/Session/SessionWebSocketListener.cs b/Emby.Server.Implementations/Session/SessionWebSocketListener.csindex c654828b1e..bab934578a 100644--- a/Emby.Server.Implementations/Session/SessionWebSocketListener.cs+++ b/Emby.Server.Implementations/Session/SessionWebSocketListener.cs@@ -202,7 +202,7 @@ namespace Emby.Server.Implementations.Session{lock (_keepAliveLock){- if (_keepAliveCancellationToken == null)+ if (_keepAliveCancellationToken is null){_keepAliveCancellationToken = new CancellationTokenSource();// Start KeepAlive watcherdiff --git a/Emby.Server.Implementations/Session/WebSocketController.cs b/Emby.Server.Implementations/Session/WebSocketController.csindex 1f3248f075..051fa5b3cf 100644--- a/Emby.Server.Implementations/Session/WebSocketController.cs+++ b/Emby.Server.Implementations/Session/WebSocketController.cs@@ -73,7 +73,7 @@ namespace Emby.Server.Implementations.Session.OrderByDescending(i => i.LastActivityDate).FirstOrDefault();- if (socket == null)+ if (socket is null){return Task.CompletedTask;}diff --git a/Emby.Server.Implementations/Sorting/AiredEpisodeOrderComparer.cs b/Emby.Server.Implementations/Sorting/AiredEpisodeOrderComparer.csindex 2d21bd9c2a..964004eccb 100644--- a/Emby.Server.Implementations/Sorting/AiredEpisodeOrderComparer.cs+++ b/Emby.Server.Implementations/Sorting/AiredEpisodeOrderComparer.cs@@ -31,9 +31,9 @@ namespace Emby.Server.Implementations.Sortingvar episode1 = x as Episode;var episode2 = y as Episode;- if (episode1 == null)+ if (episode1 is null){- if (episode2 == null)+ if (episode2 is null){return 0;}@@ -41,7 +41,7 @@ namespace Emby.Server.Implementations.Sortingreturn 1;}- if (episode2 == null)+ if (episode2 is null){return -1;}diff --git a/Emby.Server.Implementations/Sorting/PlayCountComparer.cs b/Emby.Server.Implementations/Sorting/PlayCountComparer.csindex 45c9044c52..16f1b79b3e 100644--- a/Emby.Server.Implementations/Sorting/PlayCountComparer.cs+++ b/Emby.Server.Implementations/Sorting/PlayCountComparer.cs@@ -57,7 +57,7 @@ namespace Emby.Server.Implementations.Sorting{var userdata = UserDataRepository.GetUserData(User, x);- return userdata == null ? 0 : userdata.PlayCount;+ return userdata is null ? 0 : userdata.PlayCount;}}}diff --git a/Emby.Server.Implementations/Sorting/PremiereDateComparer.cs b/Emby.Server.Implementations/Sorting/PremiereDateComparer.csindex b217556ef3..db86b8002d 100644--- a/Emby.Server.Implementations/Sorting/PremiereDateComparer.cs+++ b/Emby.Server.Implementations/Sorting/PremiereDateComparer.cs@@ -34,7 +34,7 @@ namespace Emby.Server.Implementations.Sorting/// <returns>DateTime.</returns>private static DateTime GetDate(BaseItem? x){- if (x == null)+ if (x is null){return DateTime.MinValue;}diff --git a/Emby.Server.Implementations/Sorting/ProductionYearComparer.cs b/Emby.Server.Implementations/Sorting/ProductionYearComparer.csindex d2022df7a6..7fd1e024d0 100644--- a/Emby.Server.Implementations/Sorting/ProductionYearComparer.cs+++ b/Emby.Server.Implementations/Sorting/ProductionYearComparer.cs@@ -33,7 +33,7 @@ namespace Emby.Server.Implementations.Sorting/// <returns>DateTime.</returns>private static int GetValue(BaseItem? x){- if (x == null)+ if (x is null){return 0;}diff --git a/Emby.Server.Implementations/SyncPlay/Group.cs b/Emby.Server.Implementations/SyncPlay/Group.csindex 52becfec6b..ef2a4ef77e 100644--- a/Emby.Server.Implementations/SyncPlay/Group.cs+++ b/Emby.Server.Implementations/SyncPlay/Group.cs@@ -197,7 +197,7 @@ namespace Emby.Server.Implementations.SyncPlayprivate bool HasAccessToQueue(User user, IReadOnlyList<Guid> queue){// Check if queue is empty.- if (queue == null || queue.Count == 0)+ if (queue is null || queue.Count == 0){return true;}@@ -217,7 +217,7 @@ namespace Emby.Server.Implementations.SyncPlayprivate bool AllUsersHaveAccessToQueue(IReadOnlyList<Guid> queue){// Check if queue is empty.- if (queue == null || queue.Count == 0)+ if (queue is null || queue.Count == 0){return true;}diff --git a/Emby.Server.Implementations/SyncPlay/SyncPlayManager.cs b/Emby.Server.Implementations/SyncPlay/SyncPlayManager.csindex 53e3b3577f..63c4a15564 100644--- a/Emby.Server.Implementations/SyncPlay/SyncPlayManager.cs+++ b/Emby.Server.Implementations/SyncPlay/SyncPlayManager.cs@@ -102,12 +102,12 @@ namespace Emby.Server.Implementations.SyncPlay/// <inheritdoc />public void NewGroup(SessionInfo session, NewGroupRequest request, CancellationToken cancellationToken){- if (session == null)+ if (session is null){throw new InvalidOperationException("Session is null!");}- if (request == null)+ if (request is null){throw new InvalidOperationException("Request is null!");}@@ -138,12 +138,12 @@ namespace Emby.Server.Implementations.SyncPlay/// <inheritdoc />public void JoinGroup(SessionInfo session, JoinGroupRequest request, CancellationToken cancellationToken){- if (session == null)+ if (session is null){throw new InvalidOperationException("Session is null!");}- if (request == null)+ if (request is null){throw new InvalidOperationException("Request is null!");}@@ -155,7 +155,7 @@ namespace Emby.Server.Implementations.SyncPlay{_groups.TryGetValue(request.GroupId, out Group group);- if (group == null)+ if (group is null){_logger.LogWarning("Session {SessionId} tried to join group {GroupId} that does not exist.", session.Id, request.GroupId);@@ -204,12 +204,12 @@ namespace Emby.Server.Implementations.SyncPlay/// <inheritdoc />public void LeaveGroup(SessionInfo session, LeaveGroupRequest request, CancellationToken cancellationToken){- if (session == null)+ if (session is null){throw new InvalidOperationException("Session is null!");}- if (request == null)+ if (request is null){throw new InvalidOperationException("Request is null!");}@@ -257,12 +257,12 @@ namespace Emby.Server.Implementations.SyncPlay/// <inheritdoc />public List<GroupInfoDto> ListGroups(SessionInfo session, ListGroupsRequest request){- if (session == null)+ if (session is null){throw new InvalidOperationException("Session is null!");}- if (request == null)+ if (request is null){throw new InvalidOperationException("Request is null!");}@@ -291,12 +291,12 @@ namespace Emby.Server.Implementations.SyncPlay/// <inheritdoc />public void HandleRequest(SessionInfo session, IGroupPlaybackRequest request, CancellationToken cancellationToken){- if (session == null)+ if (session is null){throw new InvalidOperationException("Session is null!");}- if (request == null)+ if (request is null){throw new InvalidOperationException("Request is null!");}diff --git a/Emby.Server.Implementations/TV/TVSeriesManager.cs b/Emby.Server.Implementations/TV/TVSeriesManager.csindex 5c9b9df153..57fa57c592 100644--- a/Emby.Server.Implementations/TV/TVSeriesManager.cs+++ b/Emby.Server.Implementations/TV/TVSeriesManager.cs@@ -37,7 +37,7 @@ namespace Emby.Server.Implementations.TV{var user = _userManager.GetUserById(query.UserId);- if (user == null)+ if (user is null){throw new ArgumentException("User not found");}@@ -86,7 +86,7 @@ namespace Emby.Server.Implementations.TV{var user = _userManager.GetUserById(request.UserId);- if (user == null)+ if (user is null){throw new ArgumentException("User not found");}diff --git a/Emby.Server.Implementations/Updates/InstallationManager.cs b/Emby.Server.Implementations/Updates/InstallationManager.csindex 550f0e0755..84489b6466 100644--- a/Emby.Server.Implementations/Updates/InstallationManager.cs+++ b/Emby.Server.Implementations/Updates/InstallationManager.cs@@ -102,7 +102,7 @@ namespace Emby.Server.Implementations.UpdatesPackageInfo[]? packages = await _httpClientFactory.CreateClient(NamedClient.Default).GetFromJsonAsync<PackageInfo[]>(new Uri(manifest), _jsonSerializerOptions, cancellationToken).ConfigureAwait(false);- if (packages == null)+ if (packages is null){return Array.Empty<PackageInfo>();}@@ -251,7 +251,7 @@ namespace Emby.Server.Implementations.Updatesvar package = FilterPackages(availablePackages, name, id, specificVersion).FirstOrDefault();// Package not found in repository- if (package == null)+ if (package is null){yield break;}@@ -370,7 +370,7 @@ namespace Emby.Server.Implementations.Updates/// <param name="plugin">The <see cref="LocalPlugin"/> to uninstall.</param>public void UninstallPlugin(LocalPlugin plugin){- if (plugin == null)+ if (plugin is null){return;}@@ -565,7 +565,7 @@ namespace Emby.Server.Implementations.Updates?? _pluginManager.Plugins.FirstOrDefault(p => p.Name.Equals(package.Name, StringComparison.OrdinalIgnoreCase) && p.Version.Equals(package.Version));await PerformPackageInstallation(package, plugin?.Manifest.Status ?? PluginStatus.Active, cancellationToken).ConfigureAwait(false);- _logger.LogInformation("Plugin {Action}: {PluginName} {PluginVersion}", plugin == null ? "installed" : "updated", package.Name, package.Version);+ _logger.LogInformation("Plugin {Action}: {PluginName} {PluginVersion}", plugin is null ? "installed" : "updated", package.Name, package.Version);return plugin != null;}diff --git a/Jellyfin.Api/Auth/AnonymousLanAccessPolicy/AnonymousLanAccessHandler.cs b/Jellyfin.Api/Auth/AnonymousLanAccessPolicy/AnonymousLanAccessHandler.csindex 88af08dd33..d4b1ffb060 100644--- a/Jellyfin.Api/Auth/AnonymousLanAccessPolicy/AnonymousLanAccessHandler.cs+++ b/Jellyfin.Api/Auth/AnonymousLanAccessPolicy/AnonymousLanAccessHandler.cs@@ -32,7 +32,7 @@ namespace Jellyfin.Api.Auth.AnonymousLanAccessPolicyvar ip = _httpContextAccessor.HttpContext?.Connection.RemoteIpAddress;// Loopback will be on LAN, so we can accept null.- if (ip == null || _networkManager.IsInLocalNetwork(ip))+ if (ip is null || _networkManager.IsInLocalNetwork(ip)){context.Succeed(requirement);}diff --git a/Jellyfin.Api/Auth/BaseAuthorizationHandler.cs b/Jellyfin.Api/Auth/BaseAuthorizationHandler.csindex 92ee1dd59a..630bb7037a 100644--- a/Jellyfin.Api/Auth/BaseAuthorizationHandler.cs+++ b/Jellyfin.Api/Auth/BaseAuthorizationHandler.cs@@ -67,7 +67,7 @@ namespace Jellyfin.Api.Auth// Ensure userId links to a valid user.var user = _userManager.GetUserById(userId);- if (user == null)+ if (user is null){return false;}diff --git a/Jellyfin.Api/Controllers/ConfigurationController.cs b/Jellyfin.Api/Controllers/ConfigurationController.csindex bbe1633120..a00ac1b0af 100644--- a/Jellyfin.Api/Controllers/ConfigurationController.cs+++ b/Jellyfin.Api/Controllers/ConfigurationController.cs@@ -96,7 +96,7 @@ namespace Jellyfin.Api.Controllersvar configurationType = _configurationManager.GetConfigurationType(key);var deserializedConfiguration = configuration.Deserialize(configurationType, _serializerOptions);- if (deserializedConfiguration == null)+ if (deserializedConfiguration is null){throw new ArgumentException("Body doesn't contain a valid configuration");}diff --git a/Jellyfin.Api/Controllers/DashboardController.cs b/Jellyfin.Api/Controllers/DashboardController.csindex c8411f44ba..3894e6c5fc 100644--- a/Jellyfin.Api/Controllers/DashboardController.cs+++ b/Jellyfin.Api/Controllers/DashboardController.cs@@ -76,7 +76,7 @@ namespace Jellyfin.Api.Controllerspublic ActionResult GetDashboardConfigurationPage([FromQuery] string? name){var altPage = GetPluginPages().FirstOrDefault(p => string.Equals(p.Item1.Name, name, StringComparison.OrdinalIgnoreCase));- if (altPage == null)+ if (altPage is null){return NotFound();}@@ -84,7 +84,7 @@ namespace Jellyfin.Api.ControllersIPlugin plugin = altPage.Item2;string resourcePath = altPage.Item1.EmbeddedResourcePath;Stream? stream = plugin.GetType().Assembly.GetManifestResourceStream(resourcePath);- if (stream == null)+ if (stream is null){_logger.LogError("Failed to get resource {Resource} from plugin {Plugin}", resourcePath, plugin.Name);return NotFound();diff --git a/Jellyfin.Api/Controllers/DevicesController.cs b/Jellyfin.Api/Controllers/DevicesController.csindex 8292cf83b5..aad60cf5cc 100644--- a/Jellyfin.Api/Controllers/DevicesController.cs+++ b/Jellyfin.Api/Controllers/DevicesController.cs@@ -64,7 +64,7 @@ namespace Jellyfin.Api.Controllerspublic async Task<ActionResult<DeviceInfo>> GetDeviceInfo([FromQuery, Required] string id){var deviceInfo = await _deviceManager.GetDevice(id).ConfigureAwait(false);- if (deviceInfo == null)+ if (deviceInfo is null){return NotFound();}@@ -85,7 +85,7 @@ namespace Jellyfin.Api.Controllerspublic async Task<ActionResult<DeviceOptions>> GetDeviceOptions([FromQuery, Required] string id){var deviceInfo = await _deviceManager.GetDeviceOptions(id).ConfigureAwait(false);- if (deviceInfo == null)+ if (deviceInfo is null){return NotFound();}@@ -123,7 +123,7 @@ namespace Jellyfin.Api.Controllerspublic async Task<ActionResult> DeleteDevice([FromQuery, Required] string id){var existingDevice = await _deviceManager.GetDevice(id).ConfigureAwait(false);- if (existingDevice == null)+ if (existingDevice is null){return NotFound();}diff --git a/Jellyfin.Api/Controllers/DlnaController.cs b/Jellyfin.Api/Controllers/DlnaController.csindex 35c3a3d922..07e0590a10 100644--- a/Jellyfin.Api/Controllers/DlnaController.cs+++ b/Jellyfin.Api/Controllers/DlnaController.cs@@ -63,7 +63,7 @@ namespace Jellyfin.Api.Controllerspublic ActionResult<DeviceProfile> GetProfile([FromRoute, Required] string profileId){var profile = _dlnaManager.GetProfile(profileId);- if (profile == null)+ if (profile is null){return NotFound();}@@ -84,7 +84,7 @@ namespace Jellyfin.Api.Controllerspublic ActionResult DeleteProfile([FromRoute, Required] string profileId){var existingDeviceProfile = _dlnaManager.GetProfile(profileId);- if (existingDeviceProfile == null)+ if (existingDeviceProfile is null){return NotFound();}@@ -121,7 +121,7 @@ namespace Jellyfin.Api.Controllerspublic ActionResult UpdateProfile([FromRoute, Required] string profileId, [FromBody] DeviceProfile deviceProfile){var existingDeviceProfile = _dlnaManager.GetProfile(profileId);- if (existingDeviceProfile == null)+ if (existingDeviceProfile is null){return NotFound();}diff --git a/Jellyfin.Api/Controllers/DlnaServerController.cs b/Jellyfin.Api/Controllers/DlnaServerController.csindex 8859d60207..96c492b3ec 100644--- a/Jellyfin.Api/Controllers/DlnaServerController.cs+++ b/Jellyfin.Api/Controllers/DlnaServerController.cs@@ -274,7 +274,7 @@ namespace Jellyfin.Api.Controllersprivate ActionResult GetIconInternal(string fileName){var icon = _dlnaManager.GetIcon(fileName);- if (icon == null)+ if (icon is null){return NotFound();}diff --git a/Jellyfin.Api/Controllers/DynamicHlsController.cs b/Jellyfin.Api/Controllers/DynamicHlsController.csindex 0f4d3c1ebc..afe0de6302 100644--- a/Jellyfin.Api/Controllers/DynamicHlsController.cs+++ b/Jellyfin.Api/Controllers/DynamicHlsController.cs@@ -1482,7 +1482,7 @@ namespace Jellyfin.Api.ControllersstartTranscoding = true;segmentId = 0;}- else if (currentTranscodingIndex == null)+ else if (currentTranscodingIndex is null){_logger.LogDebug("Starting transcoding because currentTranscodingIndex=null");startTranscoding = true;@@ -1665,7 +1665,7 @@ namespace Jellyfin.Api.Controllers/// <returns>The command line arguments for audio transcoding.</returns>private string GetAudioArguments(StreamState state){- if (state.AudioStream == null)+ if (state.AudioStream is null){return string.Empty;}@@ -1762,7 +1762,7 @@ namespace Jellyfin.Api.Controllers/// <returns>The command line arguments for video transcoding.</returns>private string GetVideoArguments(StreamState state, int startNumber, bool isEventPlaylist){- if (state.VideoStream == null)+ if (state.VideoStream is null){return string.Empty;}@@ -1969,14 +1969,14 @@ namespace Jellyfin.Api.Controllers{var job = _transcodingJobHelper.GetTranscodingJob(playlist, TranscodingJobType);- if (job == null || job.HasExited)+ if (job is null || job.HasExited){return null;}var file = GetLastTranscodingFile(playlist, segmentExtension, _fileSystem);- if (file == null)+ if (file is null){return null;}diff --git a/Jellyfin.Api/Controllers/EnvironmentController.cs b/Jellyfin.Api/Controllers/EnvironmentController.csindex b0b4b5af51..6c78a79875 100644--- a/Jellyfin.Api/Controllers/EnvironmentController.cs+++ b/Jellyfin.Api/Controllers/EnvironmentController.cs@@ -104,7 +104,7 @@ namespace Jellyfin.Api.Controllersif (validatePathDto.ValidateWritable){- if (validatePathDto.Path == null)+ if (validatePathDto.Path is null){throw new ResourceNotFoundException(nameof(validatePathDto.Path));}diff --git a/Jellyfin.Api/Controllers/FilterController.cs b/Jellyfin.Api/Controllers/FilterController.csindex 11808b1b82..b6780ee200 100644--- a/Jellyfin.Api/Controllers/FilterController.cs+++ b/Jellyfin.Api/Controllers/FilterController.cs@@ -182,7 +182,7 @@ namespace Jellyfin.Api.Controllersif ((recursive ?? true) || parentItem is UserView || parentItem is ICollectionFolder){- genreQuery.AncestorIds = parentItem == null ? Array.Empty<Guid>() : new[] { parentItem.Id };+ genreQuery.AncestorIds = parentItem is null ? Array.Empty<Guid>() : new[] { parentItem.Id };}else{diff --git a/Jellyfin.Api/Controllers/HlsSegmentController.cs b/Jellyfin.Api/Controllers/HlsSegmentController.csindex 78634f0bfc..8e78d5a1af 100644--- a/Jellyfin.Api/Controllers/HlsSegmentController.cs+++ b/Jellyfin.Api/Controllers/HlsSegmentController.cs@@ -167,7 +167,7 @@ namespace Jellyfin.Api.Controllers}}- return playlistPath == null+ return playlistPath is null? NotFound("Hls segment not found."): GetFileResult(file, playlistPath);}diff --git a/Jellyfin.Api/Controllers/ImageByNameController.cs b/Jellyfin.Api/Controllers/ImageByNameController.csindex 89bbf22c96..c54851b96e 100644--- a/Jellyfin.Api/Controllers/ImageByNameController.cs+++ b/Jellyfin.Api/Controllers/ImageByNameController.cs@@ -77,7 +77,7 @@ namespace Jellyfin.Api.Controllers.Select(i => Path.GetFullPath(Path.Combine(_applicationPaths.GeneralPath, name, filename + i))).FirstOrDefault(System.IO.File.Exists);- if (path == null)+ if (path is null){return NotFound();}diff --git a/Jellyfin.Api/Controllers/ImageController.cs b/Jellyfin.Api/Controllers/ImageController.csindex f092bd8820..adcac8e974 100644--- a/Jellyfin.Api/Controllers/ImageController.cs+++ b/Jellyfin.Api/Controllers/ImageController.cs@@ -198,7 +198,7 @@ namespace Jellyfin.Api.Controllers}var user = _userManager.GetUserById(userId);- if (user?.ProfileImage == null)+ if (user?.ProfileImage is null){return NoContent();}@@ -242,7 +242,7 @@ namespace Jellyfin.Api.Controllers}var user = _userManager.GetUserById(userId);- if (user?.ProfileImage == null)+ if (user?.ProfileImage is null){return NoContent();}@@ -279,7 +279,7 @@ namespace Jellyfin.Api.Controllers[FromQuery] int? imageIndex){var item = _libraryManager.GetItemById(itemId);- if (item == null)+ if (item is null){return NotFound();}@@ -307,7 +307,7 @@ namespace Jellyfin.Api.Controllers[FromRoute] int imageIndex){var item = _libraryManager.GetItemById(itemId);- if (item == null)+ if (item is null){return NotFound();}@@ -335,7 +335,7 @@ namespace Jellyfin.Api.Controllers[FromRoute, Required] ImageType imageType){var item = _libraryManager.GetItemById(itemId);- if (item == null)+ if (item is null){return NotFound();}@@ -371,7 +371,7 @@ namespace Jellyfin.Api.Controllers[FromRoute] int imageIndex){var item = _libraryManager.GetItemById(itemId);- if (item == null)+ if (item is null){return NotFound();}@@ -407,7 +407,7 @@ namespace Jellyfin.Api.Controllers[FromQuery, Required] int newIndex){var item = _libraryManager.GetItemById(itemId);- if (item == null)+ if (item is null){return NotFound();}@@ -430,7 +430,7 @@ namespace Jellyfin.Api.Controllerspublic async Task<ActionResult<IEnumerable<ImageInfo>>> GetItemImageInfos([FromRoute, Required] Guid itemId){var item = _libraryManager.GetItemById(itemId);- if (item == null)+ if (item is null){return NotFound();}@@ -537,7 +537,7 @@ namespace Jellyfin.Api.Controllers[FromQuery] int? imageIndex){var item = _libraryManager.GetItemById(itemId);- if (item == null)+ if (item is null){return NotFound();}@@ -620,7 +620,7 @@ namespace Jellyfin.Api.Controllers[FromQuery] string? foregroundLayer){var item = _libraryManager.GetItemById(itemId);- if (item == null)+ if (item is null){return NotFound();}@@ -703,7 +703,7 @@ namespace Jellyfin.Api.Controllers[FromRoute, Required] int imageIndex){var item = _libraryManager.GetItemById(itemId);- if (item == null)+ if (item is null){return NotFound();}@@ -786,7 +786,7 @@ namespace Jellyfin.Api.Controllers[FromRoute, Required] int imageIndex){var item = _libraryManager.GetArtist(name);- if (item == null)+ if (item is null){return NotFound();}@@ -869,7 +869,7 @@ namespace Jellyfin.Api.Controllers[FromQuery] int? imageIndex){var item = _libraryManager.GetGenre(name);- if (item == null)+ if (item is null){return NotFound();}@@ -952,7 +952,7 @@ namespace Jellyfin.Api.Controllers[FromQuery] string? foregroundLayer){var item = _libraryManager.GetGenre(name);- if (item == null)+ if (item is null){return NotFound();}@@ -1035,7 +1035,7 @@ namespace Jellyfin.Api.Controllers[FromQuery] int? imageIndex){var item = _libraryManager.GetMusicGenre(name);- if (item == null)+ if (item is null){return NotFound();}@@ -1118,7 +1118,7 @@ namespace Jellyfin.Api.Controllers[FromQuery] string? foregroundLayer){var item = _libraryManager.GetMusicGenre(name);- if (item == null)+ if (item is null){return NotFound();}@@ -1201,7 +1201,7 @@ namespace Jellyfin.Api.Controllers[FromQuery] int? imageIndex){var item = _libraryManager.GetPerson(name);- if (item == null)+ if (item is null){return NotFound();}@@ -1284,7 +1284,7 @@ namespace Jellyfin.Api.Controllers[FromQuery] string? foregroundLayer){var item = _libraryManager.GetPerson(name);- if (item == null)+ if (item is null){return NotFound();}@@ -1367,7 +1367,7 @@ namespace Jellyfin.Api.Controllers[FromQuery] int? imageIndex){var item = _libraryManager.GetStudio(name);- if (item == null)+ if (item is null){return NotFound();}@@ -1450,7 +1450,7 @@ namespace Jellyfin.Api.Controllers[FromQuery] string? foregroundLayer){var item = _libraryManager.GetStudio(name);- if (item == null)+ if (item is null){return NotFound();}@@ -1533,7 +1533,7 @@ namespace Jellyfin.Api.Controllers[FromQuery] int? imageIndex){var user = _userManager.GetUserById(userId);- if (user?.ProfileImage == null)+ if (user?.ProfileImage is null){return NotFound();}@@ -1634,7 +1634,7 @@ namespace Jellyfin.Api.Controllers[FromQuery] string? foregroundLayer){var user = _userManager.GetUserById(userId);- if (user?.ProfileImage == null)+ if (user?.ProfileImage is null){return NotFound();}@@ -1944,10 +1944,10 @@ namespace Jellyfin.Api.ControllersunplayedCount = null;}- if (imageInfo == null)+ if (imageInfo is null){imageInfo = item?.GetImageInfo(imageType, imageIndex ?? 0);- if (imageInfo == null)+ if (imageInfo is null){return NotFound(string.Format(NumberFormatInfo.InvariantInfo, "{0} does not have an image of type {1}", item?.Name, imageType));}diff --git a/Jellyfin.Api/Controllers/ItemLookupController.cs b/Jellyfin.Api/Controllers/ItemLookupController.csindex c49f856169..34893d682d 100644--- a/Jellyfin.Api/Controllers/ItemLookupController.cs+++ b/Jellyfin.Api/Controllers/ItemLookupController.cs@@ -65,7 +65,7 @@ namespace Jellyfin.Api.Controllerspublic ActionResult<IEnumerable<ExternalIdInfo>> GetExternalIdInfos([FromRoute, Required] Guid itemId){var item = _libraryManager.GetItemById(itemId);- if (item == null)+ if (item is null){return NotFound();}diff --git a/Jellyfin.Api/Controllers/ItemRefreshController.cs b/Jellyfin.Api/Controllers/ItemRefreshController.csindex 9340737b50..0dc3fbd05a 100644--- a/Jellyfin.Api/Controllers/ItemRefreshController.cs+++ b/Jellyfin.Api/Controllers/ItemRefreshController.cs@@ -61,7 +61,7 @@ namespace Jellyfin.Api.Controllers[FromQuery] bool replaceAllImages = false){var item = _libraryManager.GetItemById(itemId);- if (item == null)+ if (item is null){return NotFound();}diff --git a/Jellyfin.Api/Controllers/ItemUpdateController.cs b/Jellyfin.Api/Controllers/ItemUpdateController.csindex fd137f98f1..5f992f0335 100644--- a/Jellyfin.Api/Controllers/ItemUpdateController.cs+++ b/Jellyfin.Api/Controllers/ItemUpdateController.cs@@ -71,7 +71,7 @@ namespace Jellyfin.Api.Controllerspublic async Task<ActionResult> UpdateItem([FromRoute, Required] Guid itemId, [FromBody, Required] BaseItemDto request){var item = _libraryManager.GetItemById(itemId);- if (item == null)+ if (item is null){return NotFound();}@@ -198,7 +198,7 @@ namespace Jellyfin.Api.Controllerspublic ActionResult UpdateItemContentType([FromRoute, Required] Guid itemId, [FromQuery] string? contentType){var item = _libraryManager.GetItemById(itemId);- if (item == null)+ if (item is null){return NotFound();}diff --git a/Jellyfin.Api/Controllers/LibraryController.cs b/Jellyfin.Api/Controllers/LibraryController.csindex 7d5cfc7ae5..80d1c008b5 100644--- a/Jellyfin.Api/Controllers/LibraryController.cs+++ b/Jellyfin.Api/Controllers/LibraryController.cs@@ -104,7 +104,7 @@ namespace Jellyfin.Api.Controllerspublic ActionResult GetFile([FromRoute, Required] Guid itemId){var item = _libraryManager.GetItemById(itemId);- if (item == null)+ if (item is null){return NotFound();}@@ -154,7 +154,7 @@ namespace Jellyfin.Api.Controllers: _libraryManager.GetUserRootFolder()): _libraryManager.GetItemById(itemId);- if (item == null)+ if (item is null){return NotFound("Item not found.");}@@ -171,7 +171,7 @@ namespace Jellyfin.Api.Controllers}var parent = item.GetParent();- if (parent == null)+ if (parent is null){break;}@@ -220,7 +220,7 @@ namespace Jellyfin.Api.Controllers: _libraryManager.GetUserRootFolder()): _libraryManager.GetItemById(itemId);- if (item == null)+ if (item is null){return NotFound("Item not found.");}@@ -237,7 +237,7 @@ namespace Jellyfin.Api.Controllers}var parent = item.GetParent();- if (parent == null)+ if (parent is null){break;}@@ -435,7 +435,7 @@ namespace Jellyfin.Api.Controllers{var item = _libraryManager.GetItemById(itemId);- if (item == null)+ if (item is null){return NotFound("Item not found");}@@ -610,7 +610,7 @@ namespace Jellyfin.Api.Controllerspublic async Task<ActionResult> GetDownload([FromRoute, Required] Guid itemId){var item = _libraryManager.GetItemById(itemId);- if (item == null)+ if (item is null){return NotFound();}diff --git a/Jellyfin.Api/Controllers/LiveTvController.cs b/Jellyfin.Api/Controllers/LiveTvController.csindex 394df0f58b..94710d78f2 100644--- a/Jellyfin.Api/Controllers/LiveTvController.cs+++ b/Jellyfin.Api/Controllers/LiveTvController.cs@@ -763,7 +763,7 @@ namespace Jellyfin.Api.Controllersawait AssertUserCanManageLiveTv().ConfigureAwait(false);var item = _libraryManager.GetItemById(recordingId);- if (item == null)+ if (item is null){return NotFound();}@@ -840,7 +840,7 @@ namespace Jellyfin.Api.Controllerspublic async Task<ActionResult<SeriesTimerInfoDto>> GetSeriesTimer([FromRoute, Required] string timerId){var timer = await _liveTvManager.GetSeriesTimer(timerId, CancellationToken.None).ConfigureAwait(false);- if (timer == null)+ if (timer is null){return NotFound();}@@ -1201,7 +1201,7 @@ namespace Jellyfin.Api.Controllerspublic ActionResult GetLiveStreamFile([FromRoute, Required] string streamId, [FromRoute, Required] string container){var liveStreamInfo = _mediaSourceManager.GetLiveStreamInfoByUniqueId(streamId);- if (liveStreamInfo == null)+ if (liveStreamInfo is null){return NotFound();}diff --git a/Jellyfin.Api/Controllers/MediaInfoController.cs b/Jellyfin.Api/Controllers/MediaInfoController.csindex c111e92186..be6453af95 100644--- a/Jellyfin.Api/Controllers/MediaInfoController.cs+++ b/Jellyfin.Api/Controllers/MediaInfoController.cs@@ -121,7 +121,7 @@ namespace Jellyfin.Api.Controllersvar profile = playbackInfoDto?.DeviceProfile;_logger.LogDebug("GetPostedPlaybackInfo profile: {@Profile}", profile);- if (profile == null)+ if (profile is null){var caps = _deviceManager.GetCapabilities(User.GetDeviceId());if (caps != null)diff --git a/Jellyfin.Api/Controllers/PackageController.cs b/Jellyfin.Api/Controllers/PackageController.csindex 9690aead0c..0aa7c2ac9e 100644--- a/Jellyfin.Api/Controllers/PackageController.cs+++ b/Jellyfin.Api/Controllers/PackageController.cs@@ -54,7 +54,7 @@ namespace Jellyfin.Api.ControllersassemblyGuid ?? default).FirstOrDefault();- if (result == null)+ if (result is null){return NotFound();}@@ -110,7 +110,7 @@ namespace Jellyfin.Api.ControllersspecificVersion: string.IsNullOrEmpty(version) ? null : Version.Parse(version)).FirstOrDefault();- if (package == null)+ if (package is null){return NotFound();}diff --git a/Jellyfin.Api/Controllers/PersonsController.cs b/Jellyfin.Api/Controllers/PersonsController.csindex 42be969b29..09f7281ecb 100644--- a/Jellyfin.Api/Controllers/PersonsController.cs+++ b/Jellyfin.Api/Controllers/PersonsController.cs@@ -122,7 +122,7 @@ namespace Jellyfin.Api.Controllers.AddClientFields(User);var item = _libraryManager.GetPerson(name);- if (item == null)+ if (item is null){return NotFound();}diff --git a/Jellyfin.Api/Controllers/PlaylistsController.cs b/Jellyfin.Api/Controllers/PlaylistsController.csindex fb045f891e..e0c565da18 100644--- a/Jellyfin.Api/Controllers/PlaylistsController.cs+++ b/Jellyfin.Api/Controllers/PlaylistsController.cs@@ -176,7 +176,7 @@ namespace Jellyfin.Api.Controllers[FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] ImageType[] enableImageTypes){var playlist = (Playlist)_libraryManager.GetItemById(playlistId);- if (playlist == null)+ if (playlist is null){return NotFound();}diff --git a/Jellyfin.Api/Controllers/PlaystateController.cs b/Jellyfin.Api/Controllers/PlaystateController.csindex 3a2ba033ea..58f9b7d356 100644--- a/Jellyfin.Api/Controllers/PlaystateController.cs+++ b/Jellyfin.Api/Controllers/PlaystateController.cs@@ -353,7 +353,7 @@ namespace Jellyfin.Api.Controllersif (method == PlayMethod.Transcode){var job = string.IsNullOrWhiteSpace(playSessionId) ? null : _transcodingJobHelper.GetTranscodingJob(playSessionId);- if (job == null)+ if (job is null){return PlayMethod.DirectPlay;}diff --git a/Jellyfin.Api/Controllers/PluginsController.cs b/Jellyfin.Api/Controllers/PluginsController.csindex b227dba2df..361828fbd7 100644--- a/Jellyfin.Api/Controllers/PluginsController.cs+++ b/Jellyfin.Api/Controllers/PluginsController.cs@@ -71,7 +71,7 @@ namespace Jellyfin.Api.Controllerspublic ActionResult EnablePlugin([FromRoute, Required] Guid pluginId, [FromRoute, Required] Version version){var plugin = _pluginManager.GetPlugin(pluginId, version);- if (plugin == null)+ if (plugin is null){return NotFound();}@@ -95,7 +95,7 @@ namespace Jellyfin.Api.Controllerspublic ActionResult DisablePlugin([FromRoute, Required] Guid pluginId, [FromRoute, Required] Version version){var plugin = _pluginManager.GetPlugin(pluginId, version);- if (plugin == null)+ if (plugin is null){return NotFound();}@@ -119,7 +119,7 @@ namespace Jellyfin.Api.Controllerspublic ActionResult UninstallPluginByVersion([FromRoute, Required] Guid pluginId, [FromRoute, Required] Version version){var plugin = _pluginManager.GetPlugin(pluginId, version);- if (plugin == null)+ if (plugin is null){return NotFound();}@@ -146,7 +146,7 @@ namespace Jellyfin.Api.Controllersvar plugins = _pluginManager.Plugins.Where(p => p.Id.Equals(pluginId));// Select the un-instanced one first.- var plugin = plugins.FirstOrDefault(p => p.Instance == null) ?? plugins.OrderBy(p => p.Manifest.Status).FirstOrDefault();+ var plugin = plugins.FirstOrDefault(p => p.Instance is null) ?? plugins.OrderBy(p => p.Manifest.Status).FirstOrDefault();if (plugin != null){@@ -225,13 +225,13 @@ namespace Jellyfin.Api.Controllerspublic ActionResult GetPluginImage([FromRoute, Required] Guid pluginId, [FromRoute, Required] Version version){var plugin = _pluginManager.GetPlugin(pluginId, version);- if (plugin == null)+ if (plugin is null){return NotFound();}var imagePath = Path.Combine(plugin.Path, plugin.Manifest.ImagePath ?? string.Empty);- if (plugin.Manifest.ImagePath == null || !System.IO.File.Exists(imagePath))+ if (plugin.Manifest.ImagePath is null || !System.IO.File.Exists(imagePath)){return NotFound();}diff --git a/Jellyfin.Api/Controllers/RemoteImageController.cs b/Jellyfin.Api/Controllers/RemoteImageController.csindex dbee56e140..da9e8cf90d 100644--- a/Jellyfin.Api/Controllers/RemoteImageController.cs+++ b/Jellyfin.Api/Controllers/RemoteImageController.cs@@ -68,7 +68,7 @@ namespace Jellyfin.Api.Controllers[FromQuery] bool includeAllLanguages = false){var item = _libraryManager.GetItemById(itemId);- if (item == null)+ if (item is null){return NotFound();}@@ -127,7 +127,7 @@ namespace Jellyfin.Api.Controllerspublic ActionResult<IEnumerable<ImageProviderInfo>> GetRemoteImageProviders([FromRoute, Required] Guid itemId){var item = _libraryManager.GetItemById(itemId);- if (item == null)+ if (item is null){return NotFound();}@@ -154,7 +154,7 @@ namespace Jellyfin.Api.Controllers[FromQuery] string? imageUrl){var item = _libraryManager.GetItemById(itemId);- if (item == null)+ if (item is null){return NotFound();}diff --git a/Jellyfin.Api/Controllers/ScheduledTasksController.cs b/Jellyfin.Api/Controllers/ScheduledTasksController.csindex 68e4f0586f..832e145050 100644--- a/Jellyfin.Api/Controllers/ScheduledTasksController.cs+++ b/Jellyfin.Api/Controllers/ScheduledTasksController.cs@@ -76,7 +76,7 @@ namespace Jellyfin.Api.Controllersvar task = _taskManager.ScheduledTasks.FirstOrDefault(i =>string.Equals(i.Id, taskId, StringComparison.OrdinalIgnoreCase));- if (task == null)+ if (task is null){return NotFound();}@@ -99,7 +99,7 @@ namespace Jellyfin.Api.Controllersvar task = _taskManager.ScheduledTasks.FirstOrDefault(o =>o.Id.Equals(taskId, StringComparison.OrdinalIgnoreCase));- if (task == null)+ if (task is null){return NotFound();}@@ -123,7 +123,7 @@ namespace Jellyfin.Api.Controllersvar task = _taskManager.ScheduledTasks.FirstOrDefault(o =>o.Id.Equals(taskId, StringComparison.OrdinalIgnoreCase));- if (task == null)+ if (task is null){return NotFound();}@@ -149,7 +149,7 @@ namespace Jellyfin.Api.Controllers{var task = _taskManager.ScheduledTasks.FirstOrDefault(o =>o.Id.Equals(taskId, StringComparison.OrdinalIgnoreCase));- if (task == null)+ if (task is null){return NotFound();}diff --git a/Jellyfin.Api/Controllers/SearchController.cs b/Jellyfin.Api/Controllers/SearchController.csindex aeed0c0d61..3c0603a19a 100644--- a/Jellyfin.Api/Controllers/SearchController.cs+++ b/Jellyfin.Api/Controllers/SearchController.cs@@ -221,7 +221,7 @@ namespace Jellyfin.Api.Controllers{var itemWithImage = item.HasImage(ImageType.Thumb) ? item : null;- if (itemWithImage == null && item is Episode)+ if (itemWithImage is null && item is Episode){itemWithImage = GetParentWithImage<Series>(item, ImageType.Thumb);}diff --git a/Jellyfin.Api/Controllers/SessionController.cs b/Jellyfin.Api/Controllers/SessionController.csindex 31b95162d4..9218c3b5cf 100644--- a/Jellyfin.Api/Controllers/SessionController.cs+++ b/Jellyfin.Api/Controllers/SessionController.cs@@ -294,7 +294,7 @@ namespace Jellyfin.Api.Controllers{var currentSession = await RequestHelpers.GetSession(_sessionManager, _userManager, HttpContext).ConfigureAwait(false);- if (command == null)+ if (command is null){throw new ArgumentException("Request body may not be null");}diff --git a/Jellyfin.Api/Controllers/SubtitleController.cs b/Jellyfin.Api/Controllers/SubtitleController.csindex 1258a9876b..b9c2a8ad8e 100644--- a/Jellyfin.Api/Controllers/SubtitleController.cs+++ b/Jellyfin.Api/Controllers/SubtitleController.cs@@ -96,7 +96,7 @@ namespace Jellyfin.Api.Controllers{var item = _libraryManager.GetItemById(itemId);- if (item == null)+ if (item is null){return NotFound();}diff --git a/Jellyfin.Api/Controllers/TvShowsController.cs b/Jellyfin.Api/Controllers/TvShowsController.csindex ea13ceb91c..7f4f4d0776 100644--- a/Jellyfin.Api/Controllers/TvShowsController.cs+++ b/Jellyfin.Api/Controllers/TvShowsController.cs@@ -247,7 +247,7 @@ namespace Jellyfin.Api.Controllers.GetSeasons(user, dtoOptions).FirstOrDefault(i => i.IndexNumber == season.Value);- episodes = seasonItem == null ?+ episodes = seasonItem is null ?new List<BaseItem>(): ((Season)seasonItem).GetEpisodes(user, dtoOptions);}diff --git a/Jellyfin.Api/Controllers/UserController.cs b/Jellyfin.Api/Controllers/UserController.csindex ff653fe6bb..4ee3361b5b 100644--- a/Jellyfin.Api/Controllers/UserController.cs+++ b/Jellyfin.Api/Controllers/UserController.cs@@ -124,7 +124,7 @@ namespace Jellyfin.Api.Controllers{var user = _userManager.GetUserById(userId);- if (user == null)+ if (user is null){return NotFound("User not found");}@@ -173,7 +173,7 @@ namespace Jellyfin.Api.Controllers{var user = _userManager.GetUserById(userId);- if (user == null)+ if (user is null){return NotFound("User not found");}@@ -272,7 +272,7 @@ namespace Jellyfin.Api.Controllersvar user = _userManager.GetUserById(userId);- if (user == null)+ if (user is null){return NotFound("User not found");}@@ -292,7 +292,7 @@ namespace Jellyfin.Api.ControllersHttpContext.GetNormalizedRemoteIp().ToString(),false).ConfigureAwait(false);- if (success == null)+ if (success is null){return StatusCode(StatusCodes.Status403Forbidden, "Invalid user or password entered.");}@@ -333,7 +333,7 @@ namespace Jellyfin.Api.Controllersvar user = _userManager.GetUserById(userId);- if (user == null)+ if (user is null){return NotFound("User not found");}@@ -544,7 +544,7 @@ namespace Jellyfin.Api.Controllers}var user = _userManager.GetUserById(userId);- if (user == null)+ if (user is null){return BadRequest();}diff --git a/Jellyfin.Api/Controllers/UserLibraryController.cs b/Jellyfin.Api/Controllers/UserLibraryController.csindex 8a2d5a27d9..60e1906164 100644--- a/Jellyfin.Api/Controllers/UserLibraryController.cs+++ b/Jellyfin.Api/Controllers/UserLibraryController.cs@@ -402,7 +402,7 @@ namespace Jellyfin.Api.Controllers{var user = _userManager.GetUserById(userId);- if (user == null)+ if (user is null){return NotFound();}@@ -411,7 +411,7 @@ namespace Jellyfin.Api.Controllers? _libraryManager.GetUserRootFolder(): _libraryManager.GetItemById(itemId);- if (item == null)+ if (item is null){return NotFound();}diff --git a/Jellyfin.Api/Controllers/UserViewsController.cs b/Jellyfin.Api/Controllers/UserViewsController.csindex 85d154cac2..3aeb444dfa 100644--- a/Jellyfin.Api/Controllers/UserViewsController.cs+++ b/Jellyfin.Api/Controllers/UserViewsController.cs@@ -117,7 +117,7 @@ namespace Jellyfin.Api.Controllerspublic ActionResult<IEnumerable<SpecialViewOptionDto>> GetGroupingOptions([FromRoute, Required] Guid userId){var user = _userManager.GetUserById(userId);- if (user == null)+ if (user is null){return NotFound();}diff --git a/Jellyfin.Api/Controllers/VideoAttachmentsController.cs b/Jellyfin.Api/Controllers/VideoAttachmentsController.csindex c2bb0dfffe..bb31626142 100644--- a/Jellyfin.Api/Controllers/VideoAttachmentsController.cs+++ b/Jellyfin.Api/Controllers/VideoAttachmentsController.cs@@ -55,7 +55,7 @@ namespace Jellyfin.Api.Controllerstry{var item = _libraryManager.GetItemById(videoId);- if (item == null)+ if (item is null){return NotFound();}diff --git a/Jellyfin.Api/Controllers/VideosController.cs b/Jellyfin.Api/Controllers/VideosController.csindex bf08ad376b..17e5567305 100644--- a/Jellyfin.Api/Controllers/VideosController.cs+++ b/Jellyfin.Api/Controllers/VideosController.cs@@ -149,7 +149,7 @@ namespace Jellyfin.Api.Controllers{var video = (Video)_libraryManager.GetItemById(itemId);- if (video == null)+ if (video is null){return NotFound("The video either does not exist or the id does not belong to a video.");}@@ -199,7 +199,7 @@ namespace Jellyfin.Api.Controllers}var primaryVersion = items.FirstOrDefault(i => i.MediaSourceCount > 1 && string.IsNullOrEmpty(i.PrimaryVersionId));- if (primaryVersion == null)+ if (primaryVersion is null){primaryVersion = items.OrderBy(i =>@@ -444,7 +444,7 @@ namespace Jellyfin.Api.ControllersStreamingHelpers.AddDlnaHeaders(state, Response.Headers, true, state.Request.StartTimeTicks, Request, _dlnaManager);var liveStreamInfo = _mediaSourceManager.GetLiveStreamInfo(streamingRequest.LiveStreamId);- if (liveStreamInfo == null)+ if (liveStreamInfo is null){return NotFound();}diff --git a/Jellyfin.Api/Controllers/YearsController.cs b/Jellyfin.Api/Controllers/YearsController.csindex b732bdff3c..f8193f19a5 100644--- a/Jellyfin.Api/Controllers/YearsController.cs+++ b/Jellyfin.Api/Controllers/YearsController.cs@@ -173,7 +173,7 @@ namespace Jellyfin.Api.Controllerspublic ActionResult<BaseItemDto> GetYear([FromRoute, Required] int year, [FromQuery] Guid? userId){var item = _libraryManager.GetYear(year);- if (item == null)+ if (item is null){return NotFound();}diff --git a/Jellyfin.Api/Helpers/AudioHelper.cs b/Jellyfin.Api/Helpers/AudioHelper.csindex bc83ff48a8..5c5a2fc348 100644--- a/Jellyfin.Api/Helpers/AudioHelper.cs+++ b/Jellyfin.Api/Helpers/AudioHelper.cs@@ -85,7 +85,7 @@ namespace Jellyfin.Api.HelpersTranscodingJobType transcodingJobType,StreamingRequestDto streamingRequest){- if (_httpContextAccessor.HttpContext == null)+ if (_httpContextAccessor.HttpContext is null){throw new ResourceNotFoundException(nameof(_httpContextAccessor.HttpContext));}@@ -116,7 +116,7 @@ namespace Jellyfin.Api.HelpersStreamingHelpers.AddDlnaHeaders(state, _httpContextAccessor.HttpContext.Response.Headers, true, streamingRequest.StartTimeTicks, _httpContextAccessor.HttpContext.Request, _dlnaManager);var liveStreamInfo = _mediaSourceManager.GetLiveStreamInfo(streamingRequest.LiveStreamId);- if (liveStreamInfo == null)+ if (liveStreamInfo is null){throw new FileNotFoundException();}diff --git a/Jellyfin.Api/Helpers/DynamicHlsHelper.cs b/Jellyfin.Api/Helpers/DynamicHlsHelper.csindex ee672cab4e..904021a86c 100644--- a/Jellyfin.Api/Helpers/DynamicHlsHelper.cs+++ b/Jellyfin.Api/Helpers/DynamicHlsHelper.cs@@ -117,7 +117,7 @@ namespace Jellyfin.Api.HelpersTranscodingJobType transcodingJobType,CancellationTokenSource cancellationTokenSource){- if (_httpContextAccessor.HttpContext == null)+ if (_httpContextAccessor.HttpContext is null){throw new ResourceNotFoundException(nameof(_httpContextAccessor.HttpContext));}@@ -271,7 +271,7 @@ namespace Jellyfin.Api.Helpersif (EnableAdaptiveBitrateStreaming(state, isLiveStream, enableAdaptiveBitrateStreaming, _httpContextAccessor.HttpContext.GetNormalizedRemoteIp())){- var requestedVideoBitrate = state.VideoRequest == null ? 0 : state.VideoRequest.VideoBitRate ?? 0;+ var requestedVideoBitrate = state.VideoRequest is null ? 0 : state.VideoRequest.VideoBitRate ?? 0;// By default, vary by just 200kvar variation = GetBitrateVariation(totalBitrate);@@ -483,7 +483,7 @@ namespace Jellyfin.Api.Helpersreturn;}- var selectedIndex = state.SubtitleStream == null || state.SubtitleDeliveryMethod != SubtitleDeliveryMethod.Hls ? (int?)null : state.SubtitleStream.Index;+ var selectedIndex = state.SubtitleStream is null || state.SubtitleDeliveryMethod != SubtitleDeliveryMethod.Hls ? (int?)null : state.SubtitleStream.Index;const string Format = "#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID=\"subs\",NAME=\"{0}\",DEFAULT={1},FORCED={2},AUTOSELECT=YES,URI=\"{3}\",LANGUAGE=\"{4}\"";foreach (var stream in subtitles)diff --git a/Jellyfin.Api/Helpers/HlsHelpers.cs b/Jellyfin.Api/Helpers/HlsHelpers.csindex 4567621470..0f6d2aef77 100644--- a/Jellyfin.Api/Helpers/HlsHelpers.cs+++ b/Jellyfin.Api/Helpers/HlsHelpers.cs@@ -47,7 +47,7 @@ namespace Jellyfin.Api.Helperswhile (!reader.EndOfStream){var line = await reader.ReadLineAsync().ConfigureAwait(false);- if (line == null)+ if (line is null){// Nothing currently in buffer.break;diff --git a/Jellyfin.Api/Helpers/MediaInfoHelper.cs b/Jellyfin.Api/Helpers/MediaInfoHelper.csindex 4441ae023e..6134fb7274 100644--- a/Jellyfin.Api/Helpers/MediaInfoHelper.cs+++ b/Jellyfin.Api/Helpers/MediaInfoHelper.cs@@ -390,7 +390,7 @@ namespace Jellyfin.Api.Helpersvar result = await _mediaSourceManager.OpenLiveStream(request, CancellationToken.None).ConfigureAwait(false);var profile = request.DeviceProfile;- if (profile == null)+ if (profile is null){var clientCapabilities = _deviceManager.GetCapabilities(httpContext.User.GetDeviceId());if (clientCapabilities != null)diff --git a/Jellyfin.Api/Helpers/RequestHelpers.cs b/Jellyfin.Api/Helpers/RequestHelpers.csindex 8c5af013aa..035d84513a 100644--- a/Jellyfin.Api/Helpers/RequestHelpers.cs+++ b/Jellyfin.Api/Helpers/RequestHelpers.cs@@ -96,7 +96,7 @@ namespace Jellyfin.Api.HelpershttpContext.GetNormalizedRemoteIp().ToString(),user).ConfigureAwait(false);- if (session == null)+ if (session is null){throw new ArgumentException("Session not found.");}diff --git a/Jellyfin.Api/Helpers/StreamingHelpers.cs b/Jellyfin.Api/Helpers/StreamingHelpers.csindex c8e62999c4..5e01b7dccb 100644--- a/Jellyfin.Api/Helpers/StreamingHelpers.cs+++ b/Jellyfin.Api/Helpers/StreamingHelpers.cs@@ -76,7 +76,7 @@ namespace Jellyfin.Api.Helpers}streamingRequest.StreamOptions = ParseStreamOptions(httpRequest.Query);- if (httpRequest.Path.Value == null)+ if (httpRequest.Path.Value is null){throw new ResourceNotFoundException(nameof(httpRequest.Path));}@@ -142,7 +142,7 @@ namespace Jellyfin.Api.HelpersmediaSource = currentJob.MediaSource;}- if (mediaSource == null)+ if (mediaSource is null){var mediaSources = await mediaSourceManager.GetPlaybackMediaSources(libraryManager.GetItemById(streamingRequest.Id), null, false, false, cancellationToken).ConfigureAwait(false);@@ -150,7 +150,7 @@ namespace Jellyfin.Api.Helpers? mediaSources[0]: mediaSources.Find(i => string.Equals(i.Id, streamingRequest.MediaSourceId, StringComparison.Ordinal));- if (mediaSource == null && Guid.Parse(streamingRequest.MediaSourceId).Equals(streamingRequest.Id))+ if (mediaSource is null && Guid.Parse(streamingRequest.MediaSourceId).Equals(streamingRequest.Id)){mediaSource = mediaSources[0];}@@ -510,16 +510,16 @@ namespace Jellyfin.Api.Helpers{state.DeviceProfile = dlnaManager.GetProfile(deviceProfileId);- if (state.DeviceProfile == null)+ if (state.DeviceProfile is null){var caps = deviceManager.GetCapabilities(deviceProfileId);- state.DeviceProfile = caps == null ? dlnaManager.GetProfile(request.Headers) : caps.DeviceProfile;+ state.DeviceProfile = caps is null ? dlnaManager.GetProfile(request.Headers) : caps.DeviceProfile;}}var profile = state.DeviceProfile;- if (profile == null)+ if (profile is null){// Don't use settings from the default profile.// Only use a specific profile if it was requested.diff --git a/Jellyfin.Api/Helpers/TranscodingJobHelper.cs b/Jellyfin.Api/Helpers/TranscodingJobHelper.csindex c663c6e310..592f22d8dd 100644--- a/Jellyfin.Api/Helpers/TranscodingJobHelper.cs+++ b/Jellyfin.Api/Helpers/TranscodingJobHelper.cs@@ -829,7 +829,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 null){return null;}diff --git a/Jellyfin.Api/ModelBinders/NullableEnumModelBinderProvider.cs b/Jellyfin.Api/ModelBinders/NullableEnumModelBinderProvider.csindex 2ccfd0c06e..da0addd0eb 100644--- a/Jellyfin.Api/ModelBinders/NullableEnumModelBinderProvider.cs+++ b/Jellyfin.Api/ModelBinders/NullableEnumModelBinderProvider.cs@@ -14,7 +14,7 @@ namespace Jellyfin.Api.ModelBinderspublic IModelBinder? GetBinder(ModelBinderProviderContext context){var nullableType = Nullable.GetUnderlyingType(context.Metadata.ModelType);- if (nullableType == null || !nullableType.IsEnum)+ if (nullableType is null || !nullableType.IsEnum){// Type isn't nullable or isn't an enum.return null;diff --git a/Jellyfin.Api/Models/PlaybackDtos/TranscodingJobDto.cs b/Jellyfin.Api/Models/PlaybackDtos/TranscodingJobDto.csindex ab67c8732a..bb0f51936f 100644--- a/Jellyfin.Api/Models/PlaybackDtos/TranscodingJobDto.cs+++ b/Jellyfin.Api/Models/PlaybackDtos/TranscodingJobDto.cs@@ -220,7 +220,7 @@ namespace Jellyfin.Api.Models.PlaybackDtoslock (_timerLock){- if (KillTimer == null)+ if (KillTimer is null){Logger.LogDebug("Starting kill timer at {0}ms. JobId {1} PlaySessionId {2}", intervalMs, Id, PlaySessionId);KillTimer = new Timer(new TimerCallback(callback), this, intervalMs, Timeout.Infinite);diff --git a/Jellyfin.Data/Entities/User.cs b/Jellyfin.Data/Entities/User.csindex 26c46a704f..e2cd659e74 100644--- a/Jellyfin.Data/Entities/User.cs+++ b/Jellyfin.Data/Entities/User.cs@@ -373,7 +373,7 @@ namespace Jellyfin.Data.Entitiespublic void SetPermission(PermissionKind kind, bool value){var currentPermission = Permissions.FirstOrDefault(p => p.Kind == kind);- if (currentPermission == null)+ if (currentPermission is null){Permissions.Add(new Permission(kind, value));}@@ -442,7 +442,7 @@ namespace Jellyfin.Data.Entities{var value = string.Join(Delimiter, values);var currentPreference = Preferences.FirstOrDefault(p => p.Kind == preference);- if (currentPreference == null)+ if (currentPreference is null){Preferences.Add(new Preference(preference, value));}@@ -462,7 +462,7 @@ namespace Jellyfin.Data.Entities{var value = string.Join(Delimiter, values);var currentPreference = Preferences.FirstOrDefault(p => p.Kind == preference);- if (currentPreference == null)+ if (currentPreference is null){Preferences.Add(new Preference(preference, value));}diff --git a/Jellyfin.Drawing.Skia/SkiaEncoder.cs b/Jellyfin.Drawing.Skia/SkiaEncoder.csindex 84b261b545..02b69398e1 100644--- a/Jellyfin.Drawing.Skia/SkiaEncoder.cs+++ b/Jellyfin.Drawing.Skia/SkiaEncoder.cs@@ -250,7 +250,7 @@ namespace Jellyfin.Drawing.Skiavar resultBitmap = SKBitmap.Decode(NormalizePath(path));- if (resultBitmap == null)+ if (resultBitmap is null){return Decode(path, true, orientation, out origin);}@@ -414,7 +414,7 @@ namespace Jellyfin.Drawing.Skiavar hasIndicator = options.AddPlayedIndicator || options.UnplayedCount.HasValue || !options.PercentPlayed.Equals(0);using var bitmap = GetBitmap(inputPath, autoOrient, orientation);- if (bitmap == null)+ if (bitmap is null){throw new InvalidDataException($"Skia unable to read image {inputPath}");}diff --git a/Jellyfin.Drawing.Skia/SplashscreenBuilder.cs b/Jellyfin.Drawing.Skia/SplashscreenBuilder.csindex e5fa6c2bd1..7fbae33495 100644--- a/Jellyfin.Drawing.Skia/SplashscreenBuilder.cs+++ b/Jellyfin.Drawing.Skia/SplashscreenBuilder.cs@@ -85,7 +85,7 @@ namespace Jellyfin.Drawing.Skiabreak;}- if (currentImage == null)+ if (currentImage is null){throw new ArgumentException("Not enough valid pictures provided to create a splashscreen!");}diff --git a/Jellyfin.Drawing.Skia/StripCollageBuilder.cs b/Jellyfin.Drawing.Skia/StripCollageBuilder.csindex b55a994056..c8b8f3ace4 100644--- a/Jellyfin.Drawing.Skia/StripCollageBuilder.cs+++ b/Jellyfin.Drawing.Skia/StripCollageBuilder.cs@@ -97,7 +97,7 @@ namespace Jellyfin.Drawing.Skiacanvas.Clear(SKColors.Black);using var backdrop = SkiaHelper.GetNextValidImage(_skiaEncoder, paths, 0, out _);- if (backdrop == null)+ if (backdrop is null){return bitmap;}@@ -164,7 +164,7 @@ namespace Jellyfin.Drawing.Skiausing var currentBitmap = SkiaHelper.GetNextValidImage(_skiaEncoder, paths, imageIndex, out int newIndex);imageIndex = newIndex;- if (currentBitmap == null)+ if (currentBitmap is null){continue;}diff --git a/Jellyfin.Networking/Manager/NetworkManager.cs b/Jellyfin.Networking/Manager/NetworkManager.csindex 9e06cdfe71..519b681615 100644--- a/Jellyfin.Networking/Manager/NetworkManager.cs+++ b/Jellyfin.Networking/Manager/NetworkManager.cs@@ -232,7 +232,7 @@ namespace Jellyfin.Networking.Managerpublic Collection<IPObject> CreateIPCollection(string[] values, bool negated = false){Collection<IPObject> col = new Collection<IPObject>();- if (values == null)+ if (values is null){return col;}@@ -515,7 +515,7 @@ namespace Jellyfin.Networking.Manager/// <inheritdoc/>public Collection<IPObject> GetFilteredLANSubnets(Collection<IPObject>? filter = null){- if (filter == null)+ if (filter is null){return _lanSubnets.Exclude(_excludedSubnets, true).AsNetworks();}@@ -880,7 +880,7 @@ namespace Jellyfin.Networking.Manager{_publishedServerUrls.Clear();string[] overrides = config.PublishedServerUriBySubnet;- if (overrides == null)+ if (overrides is null){return;}@@ -1235,12 +1235,12 @@ namespace Jellyfin.Networking.Manager// Find all external bind addresses. Store the default gateway, but check to see if there is a better match first.foreach (var addr in addresses.OrderBy(p => p.Tag)){- if (defaultGateway == null && !IsInLocalNetwork(addr))+ if (defaultGateway is null && !IsInLocalNetwork(addr)){defaultGateway = addr.Address;}- if (bindAddress == null && addr.Contains(source))+ if (bindAddress is null && addr.Contains(source)){bindAddress = addr.Address;}diff --git a/Jellyfin.Server.Implementations/Devices/DeviceManager.cs b/Jellyfin.Server.Implementations/Devices/DeviceManager.csindex eeb958c620..321a16d475 100644--- a/Jellyfin.Server.Implementations/Devices/DeviceManager.cs+++ b/Jellyfin.Server.Implementations/Devices/DeviceManager.cs@@ -55,7 +55,7 @@ namespace Jellyfin.Server.Implementations.Devicesawait using (dbContext.ConfigureAwait(false)){deviceOptions = await dbContext.DeviceOptions.AsQueryable().FirstOrDefaultAsync(dev => dev.DeviceId == deviceId).ConfigureAwait(false);- if (deviceOptions == null)+ if (deviceOptions is null){deviceOptions = new DeviceOptions(deviceId);dbContext.DeviceOptions.Add(deviceOptions);@@ -121,7 +121,7 @@ namespace Jellyfin.Server.Implementations.Devices.ConfigureAwait(false);}- var deviceInfo = device == null ? null : ToDeviceInfo(device);+ var deviceInfo = device is null ? null : ToDeviceInfo(device);return deviceInfo;}diff --git a/Jellyfin.Server.Implementations/Events/Consumers/Session/PlaybackStartLogger.cs b/Jellyfin.Server.Implementations/Events/Consumers/Session/PlaybackStartLogger.csindex aa6015caae..bb98a6c342 100644--- a/Jellyfin.Server.Implementations/Events/Consumers/Session/PlaybackStartLogger.cs+++ b/Jellyfin.Server.Implementations/Events/Consumers/Session/PlaybackStartLogger.cs@@ -38,7 +38,7 @@ namespace Jellyfin.Server.Implementations.Events.Consumers.Session/// <inheritdoc />public async Task OnEvent(PlaybackStartEventArgs eventArgs){- if (eventArgs.MediaInfo == null)+ if (eventArgs.MediaInfo is null){_logger.LogWarning("PlaybackStart reported with null media info.");return;diff --git a/Jellyfin.Server.Implementations/Events/Consumers/Session/PlaybackStopLogger.cs b/Jellyfin.Server.Implementations/Events/Consumers/Session/PlaybackStopLogger.csindex 1648b1b475..baa957390a 100644--- a/Jellyfin.Server.Implementations/Events/Consumers/Session/PlaybackStopLogger.cs+++ b/Jellyfin.Server.Implementations/Events/Consumers/Session/PlaybackStopLogger.cs@@ -40,7 +40,7 @@ namespace Jellyfin.Server.Implementations.Events.Consumers.Session{var item = eventArgs.MediaInfo;- if (item == null)+ if (item is null){_logger.LogWarning("PlaybackStopped reported with null media info.");return;@@ -60,7 +60,7 @@ namespace Jellyfin.Server.Implementations.Events.Consumers.Sessionvar user = eventArgs.Users[0];var notificationType = GetPlaybackStoppedNotificationType(item.MediaType);- if (notificationType == null)+ if (notificationType is null){return;}diff --git a/Jellyfin.Server.Implementations/Events/EventManager.cs b/Jellyfin.Server.Implementations/Events/EventManager.csindex 7f7c4750d8..f49ae8e27a 100644--- a/Jellyfin.Server.Implementations/Events/EventManager.cs+++ b/Jellyfin.Server.Implementations/Events/EventManager.cs@@ -44,7 +44,7 @@ namespace Jellyfin.Server.Implementations.Eventswhere T : EventArgs{using var scope = _appHost.ServiceProvider?.CreateScope();- if (scope == null)+ if (scope is null){return;}diff --git a/Jellyfin.Server.Implementations/Extensions/ServiceCollectionExtensions.cs b/Jellyfin.Server.Implementations/Extensions/ServiceCollectionExtensions.csindex f98a0aede8..05c6229316 100644--- a/Jellyfin.Server.Implementations/Extensions/ServiceCollectionExtensions.cs+++ b/Jellyfin.Server.Implementations/Extensions/ServiceCollectionExtensions.cs@@ -27,7 +27,7 @@ public static class ServiceCollectionExtensions.UseCacheKeyPrefix("EF_")// Don't cache null values. Remove this optional setting if it's not necessary..SkipCachingResults(result =>- result.Value == null || (result.Value is EFTableRows rows && rows.RowsCount == 0)));+ result.Value is null || (result.Value is EFTableRows rows && rows.RowsCount == 0)));serviceCollection.AddPooledDbContextFactory<JellyfinDb>((serviceProvider, opt) =>{diff --git a/Jellyfin.Server.Implementations/Security/AuthenticationManager.cs b/Jellyfin.Server.Implementations/Security/AuthenticationManager.csindex 33c08c8c29..810e578075 100644--- a/Jellyfin.Server.Implementations/Security/AuthenticationManager.cs+++ b/Jellyfin.Server.Implementations/Security/AuthenticationManager.cs@@ -65,7 +65,7 @@ namespace Jellyfin.Server.Implementations.Security.FirstOrDefaultAsync().ConfigureAwait(false);- if (key == null)+ if (key is null){return;}diff --git a/Jellyfin.Server.Implementations/Users/DefaultAuthenticationProvider.cs b/Jellyfin.Server.Implementations/Users/DefaultAuthenticationProvider.csindex 7480a05c25..72f3d6e8ec 100644--- a/Jellyfin.Server.Implementations/Users/DefaultAuthenticationProvider.cs+++ b/Jellyfin.Server.Implementations/Users/DefaultAuthenticationProvider.cs@@ -41,7 +41,7 @@ namespace Jellyfin.Server.Implementations.Users// This is the version that we need to use for local users. Because reasons.public Task<ProviderAuthenticationResult> Authenticate(string username, string password, User resolvedUser){- if (resolvedUser == null)+ if (resolvedUser is null){throw new AuthenticationException("Specified user does not exist.");}@@ -58,7 +58,7 @@ namespace Jellyfin.Server.Implementations.Users}// Handle the case when the stored password is null, but the user tried to login with a password- if (resolvedUser.Password == null)+ if (resolvedUser.Password is null){throw new AuthenticationException("Invalid username or password");}diff --git a/Jellyfin.Server.Implementations/Users/DisplayPreferencesManager.cs b/Jellyfin.Server.Implementations/Users/DisplayPreferencesManager.csindex 87babc05c8..fddad1c4f9 100644--- a/Jellyfin.Server.Implementations/Users/DisplayPreferencesManager.cs+++ b/Jellyfin.Server.Implementations/Users/DisplayPreferencesManager.cs@@ -34,7 +34,7 @@ namespace Jellyfin.Server.Implementations.Users.FirstOrDefault(pref =>pref.UserId.Equals(userId) && string.Equals(pref.Client, client) && pref.ItemId.Equals(itemId));- if (prefs == null)+ if (prefs is null){prefs = new DisplayPreferences(userId, itemId, client);_dbContext.DisplayPreferences.Add(prefs);@@ -49,7 +49,7 @@ namespace Jellyfin.Server.Implementations.Usersvar prefs = _dbContext.ItemDisplayPreferences.FirstOrDefault(pref => pref.UserId.Equals(userId) && pref.ItemId.Equals(itemId) && string.Equals(pref.Client, client));- if (prefs == null)+ if (prefs is null){prefs = new ItemDisplayPreferences(userId, Guid.Empty, client);_dbContext.ItemDisplayPreferences.Add(prefs);diff --git a/Jellyfin.Server.Implementations/Users/UserManager.cs b/Jellyfin.Server.Implementations/Users/UserManager.csindex 25560707ac..131853aed4 100644--- a/Jellyfin.Server.Implementations/Users/UserManager.cs+++ b/Jellyfin.Server.Implementations/Users/UserManager.cs@@ -401,7 +401,7 @@ namespace Jellyfin.Server.Implementations.Usersvar authenticationProvider = authResult.AuthenticationProvider;var success = authResult.Success;- if (user == null)+ if (user is null){string updatedUsername = authResult.Username;@@ -434,7 +434,7 @@ namespace Jellyfin.Server.Implementations.Users}}- if (user == null)+ if (user is null){_logger.LogInformation("Authentication request for {UserName} has been denied (IP: {IP}).",@@ -708,7 +708,7 @@ namespace Jellyfin.Server.Implementations.Users/// <inheritdoc/>public async Task ClearProfileImageAsync(User user){- if (user.ProfileImage == null)+ if (user.ProfileImage is null){return;}diff --git a/Jellyfin.Server/Filters/FileResponseFilter.cs b/Jellyfin.Server/Filters/FileResponseFilter.csindex eae9a80048..544fdbfd63 100644--- a/Jellyfin.Server/Filters/FileResponseFilter.cs+++ b/Jellyfin.Server/Filters/FileResponseFilter.cs@@ -31,7 +31,7 @@ namespace Jellyfin.Server.Filters.FirstOrDefault(o => o.Key.Equals(SuccessCode, StringComparison.Ordinal));// Operation doesn't have a response.- if (response.Value == null)+ if (response.Value is null){continue;}diff --git a/Jellyfin.Server/Formatters/CssOutputFormatter.cs b/Jellyfin.Server/Formatters/CssOutputFormatter.csindex cfc9d1ad3b..fdaa48f847 100644--- a/Jellyfin.Server/Formatters/CssOutputFormatter.cs+++ b/Jellyfin.Server/Formatters/CssOutputFormatter.cs@@ -30,7 +30,7 @@ namespace Jellyfin.Server.Formatterspublic override Task WriteResponseBodyAsync(OutputFormatterWriteContext context, Encoding selectedEncoding){var stringResponse = context.Object?.ToString();- return stringResponse == null ? Task.CompletedTask : context.HttpContext.Response.WriteAsync(stringResponse);+ return stringResponse is null ? Task.CompletedTask : context.HttpContext.Response.WriteAsync(stringResponse);}}}diff --git a/Jellyfin.Server/Formatters/XmlOutputFormatter.cs b/Jellyfin.Server/Formatters/XmlOutputFormatter.csindex be0baea2d2..156368d695 100644--- a/Jellyfin.Server/Formatters/XmlOutputFormatter.cs+++ b/Jellyfin.Server/Formatters/XmlOutputFormatter.cs@@ -27,7 +27,7 @@ namespace Jellyfin.Server.Formatterspublic override Task WriteResponseBodyAsync(OutputFormatterWriteContext context, Encoding selectedEncoding){var stringResponse = context.Object?.ToString();- return stringResponse == null ? Task.CompletedTask : context.HttpContext.Response.WriteAsync(stringResponse);+ return stringResponse is null ? Task.CompletedTask : context.HttpContext.Response.WriteAsync(stringResponse);}}}diff --git a/Jellyfin.Server/Migrations/Routines/MigrateDisplayPreferencesDb.cs b/Jellyfin.Server/Migrations/Routines/MigrateDisplayPreferencesDb.csindex 37716482c3..0fad77cfe6 100644--- a/Jellyfin.Server/Migrations/Routines/MigrateDisplayPreferencesDb.cs+++ b/Jellyfin.Server/Migrations/Routines/MigrateDisplayPreferencesDb.cs@@ -91,7 +91,7 @@ namespace Jellyfin.Server.Migrations.Routinesforeach (var result in results){var dto = JsonSerializer.Deserialize<DisplayPreferencesDto>(result[3].ToBlob(), _jsonOptions);- if (dto == null)+ if (dto is null){continue;}@@ -108,7 +108,7 @@ namespace Jellyfin.Server.Migrations.RoutinesdisplayPrefs.Add(displayPreferencesKey);var existingUser = _userManager.GetUserById(dtoUserId);- if (existingUser == null)+ if (existingUser is null){_logger.LogWarning("User with ID {UserId} does not exist in the database, skipping migration.", dtoUserId);continue;diff --git a/Jellyfin.Server/Migrations/Routines/MigrateUserDb.cs b/Jellyfin.Server/Migrations/Routines/MigrateUserDb.csindex 0c2cc69a7e..2dbd82e8fd 100644--- a/Jellyfin.Server/Migrations/Routines/MigrateUserDb.cs+++ b/Jellyfin.Server/Migrations/Routines/MigrateUserDb.cs@@ -76,7 +76,7 @@ namespace Jellyfin.Server.Migrations.Routinesforeach (var entry in queryResult){UserMockup? mockup = JsonSerializer.Deserialize<UserMockup>(entry[2].ToBlob(), JsonDefaults.Options);- if (mockup == null)+ if (mockup is null){continue;}diff --git a/Jellyfin.Server/Program.cs b/Jellyfin.Server/Program.csindex 7ed8388256..b0455aafb3 100644--- a/Jellyfin.Server/Program.cs+++ b/Jellyfin.Server/Program.cs@@ -677,7 +677,7 @@ namespace Jellyfin.Server{var xdgRuntimeDir = Environment.GetEnvironmentVariable("XDG_RUNTIME_DIR");var socketFile = "jellyfin.sock";- if (xdgRuntimeDir == null)+ if (xdgRuntimeDir is null){// Fall back to config dirsocketPath = Path.Join(appPaths.ConfigurationDirectoryPath, socketFile);diff --git a/MediaBrowser.Common/Extensions/HttpContextExtensions.cs b/MediaBrowser.Common/Extensions/HttpContextExtensions.csindex 1e5877c84c..6608704c0a 100644--- a/MediaBrowser.Common/Extensions/HttpContextExtensions.cs+++ b/MediaBrowser.Common/Extensions/HttpContextExtensions.cs@@ -15,8 +15,8 @@ namespace MediaBrowser.Common.Extensions/// <returns><c>true</c> if the request is coming from LAN, <c>false</c> otherwise.</returns>public static bool IsLocal(this HttpContext context){- return (context.Connection.LocalIpAddress == null- && context.Connection.RemoteIpAddress == null)+ return (context.Connection.LocalIpAddress is null+ && context.Connection.RemoteIpAddress is null)|| Equals(context.Connection.LocalIpAddress, context.Connection.RemoteIpAddress);}diff --git a/MediaBrowser.Common/Net/NetworkExtensions.cs b/MediaBrowser.Common/Net/NetworkExtensions.csindex 7ad0058540..5e5e5b81b7 100644--- a/MediaBrowser.Common/Net/NetworkExtensions.cs+++ b/MediaBrowser.Common/Net/NetworkExtensions.cs@@ -114,7 +114,7 @@ namespace MediaBrowser.Common.Net/// <returns>True if both are equal.</returns>public static bool Compare(this Collection<IPObject> source, Collection<IPObject> dest){- if (dest == null || source.Count != dest.Count)+ if (dest is null || source.Count != dest.Count){return false;}@@ -187,7 +187,7 @@ namespace MediaBrowser.Common.Net/// <returns>A new collection, with the items excluded.</returns>public static Collection<IPObject> Exclude(this Collection<IPObject> source, Collection<IPObject> excludeList, bool isNetwork){- if (source.Count == 0 || excludeList == null)+ if (source.Count == 0 || excludeList is null){return new Collection<IPObject>(source);}diff --git a/MediaBrowser.Common/Plugins/BasePluginOfT.cs b/MediaBrowser.Common/Plugins/BasePluginOfT.csindex 0da5592d38..19db30cb8b 100644--- a/MediaBrowser.Common/Plugins/BasePluginOfT.cs+++ b/MediaBrowser.Common/Plugins/BasePluginOfT.cs@@ -103,7 +103,7 @@ namespace MediaBrowser.Common.Pluginsget{// Lazy load- if (_configuration == null)+ if (_configuration is null){lock (_configurationSyncLock){diff --git a/MediaBrowser.Common/Plugins/LocalPlugin.cs b/MediaBrowser.Common/Plugins/LocalPlugin.csindex 4c8e2d5044..96af423cc3 100644--- a/MediaBrowser.Common/Plugins/LocalPlugin.cs+++ b/MediaBrowser.Common/Plugins/LocalPlugin.cs@@ -43,7 +43,7 @@ namespace MediaBrowser.Common.Plugins{get{- if (_version == null)+ if (_version is null){_version = Version.Parse(Manifest.Version);}@@ -85,9 +85,9 @@ namespace MediaBrowser.Common.Plugins/// <returns>Comparison result.</returns>public static int Compare(LocalPlugin a, LocalPlugin b){- if (a == null || b == null)+ if (a is null || b is null){- throw new ArgumentNullException(a == null ? nameof(a) : nameof(b));+ throw new ArgumentNullException(a is null ? nameof(a) : nameof(b));}var compare = string.Compare(a.Name, b.Name, StringComparison.OrdinalIgnoreCase);@@ -128,7 +128,7 @@ namespace MediaBrowser.Common.Plugins/// <inheritdoc />public bool Equals(LocalPlugin? other){- if (other == null)+ if (other is null){return false;}diff --git a/MediaBrowser.Controller/BaseItemManager/BaseItemManager.cs b/MediaBrowser.Controller/BaseItemManager/BaseItemManager.csindex 61539cae56..b0e394dc5a 100644--- a/MediaBrowser.Controller/BaseItemManager/BaseItemManager.cs+++ b/MediaBrowser.Controller/BaseItemManager/BaseItemManager.cs@@ -56,7 +56,7 @@ namespace MediaBrowser.Controller.BaseItemManagervar itemConfig = _serverConfigurationManager.Configuration.MetadataOptions.FirstOrDefault(i => string.Equals(i.ItemType, baseItem.GetType().Name, StringComparison.OrdinalIgnoreCase));- return itemConfig == null || !itemConfig.DisabledMetadataFetchers.Contains(name.AsSpan(), StringComparison.OrdinalIgnoreCase);+ return itemConfig is null || !itemConfig.DisabledMetadataFetchers.Contains(name.AsSpan(), StringComparison.OrdinalIgnoreCase);}/// <inheritdoc />@@ -81,7 +81,7 @@ namespace MediaBrowser.Controller.BaseItemManagervar itemConfig = _serverConfigurationManager.Configuration.MetadataOptions.FirstOrDefault(i => string.Equals(i.ItemType, baseItem.GetType().Name, StringComparison.OrdinalIgnoreCase));- return itemConfig == null || !itemConfig.DisabledImageFetchers.Contains(name.AsSpan(), StringComparison.OrdinalIgnoreCase);+ return itemConfig is null || !itemConfig.DisabledImageFetchers.Contains(name.AsSpan(), StringComparison.OrdinalIgnoreCase);}/// <summary>diff --git a/MediaBrowser.Controller/Drawing/ImageProcessorExtensions.cs b/MediaBrowser.Controller/Drawing/ImageProcessorExtensions.csindex b036425ab3..62b70ce53c 100644--- a/MediaBrowser.Controller/Drawing/ImageProcessorExtensions.cs+++ b/MediaBrowser.Controller/Drawing/ImageProcessorExtensions.cs@@ -18,7 +18,7 @@ namespace MediaBrowser.Controller.Drawing{var imageInfo = item.GetImageInfo(imageType, imageIndex);- if (imageInfo == null)+ if (imageInfo is null){return null;}diff --git a/MediaBrowser.Controller/Entities/AggregateFolder.cs b/MediaBrowser.Controller/Entities/AggregateFolder.csindex e671e5c711..4dc78ff86b 100644--- a/MediaBrowser.Controller/Entities/AggregateFolder.cs+++ b/MediaBrowser.Controller/Entities/AggregateFolder.cs@@ -67,7 +67,7 @@ namespace MediaBrowser.Controller.Entities{lock (_childIdsLock){- if (_childrenIds == null || _childrenIds.Length == 0)+ if (_childrenIds is null || _childrenIds.Length == 0){var list = base.LoadChildren();_childrenIds = list.Select(i => i.Id).ToArray();diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.csindex 7f5f9f74bd..20f0095880 100644--- a/MediaBrowser.Controller/Entities/BaseItem.cs+++ b/MediaBrowser.Controller/Entities/BaseItem.cs@@ -494,7 +494,7 @@ namespace MediaBrowser.Controller.Entities{get{- if (_sortName == null)+ if (_sortName is null){if (!string.IsNullOrEmpty(ForcedSortName)){@@ -880,7 +880,7 @@ namespace MediaBrowser.Controller.Entities/// <returns>System.String.</returns>protected virtual string CreateSortName(){- if (Name == null)+ if (Name is null){return null; // some items may not have name filled in properly}@@ -1073,7 +1073,7 @@ namespace MediaBrowser.Controller.Entities{var stream = i.VideoStream;- return stream == null || stream.Width == null ? 0 : stream.Width.Value;+ return stream is null || stream.Width is null ? 0 : stream.Width.Value;}).ToList();}@@ -1330,7 +1330,7 @@ namespace MediaBrowser.Controller.Entitiespublic void SetParent(Folder parent){- ParentId = parent == null ? Guid.Empty : parent.Id;+ ParentId = parent is null ? Guid.Empty : parent.Id;}/// <summary>@@ -1534,7 +1534,7 @@ namespace MediaBrowser.Controller.Entitiesvar maxAllowedRating = user.MaxParentalAgeRating;- if (maxAllowedRating == null)+ if (maxAllowedRating is null){return true;}@@ -1701,7 +1701,7 @@ namespace MediaBrowser.Controller.Entitiesvar item = FindLinkedChild(info);// If still null, log- if (item == null)+ if (item is null){// Don't keep searching over and overinfo.ItemId = Guid.Empty;@@ -1725,7 +1725,7 @@ namespace MediaBrowser.Controller.Entitiesvar itemByPath = LibraryManager.FindByPath(path, null);- if (itemByPath == null)+ if (itemByPath is null){Logger.LogWarning("Unable to find linked item at path {0}", info.Path);}@@ -1737,7 +1737,7 @@ namespace MediaBrowser.Controller.Entities{var item = LibraryManager.GetItemById(info.LibraryItemId);- if (item == null)+ if (item is null){Logger.LogWarning("Unable to find linked item at path {0}", info.Path);}@@ -1892,7 +1892,7 @@ namespace MediaBrowser.Controller.Entitiesvar existingImage = GetImageInfo(image.Type, index);- if (existingImage == null)+ if (existingImage is null){AddImage(image);}@@ -1915,7 +1915,7 @@ namespace MediaBrowser.Controller.Entitiesvar image = GetImageInfo(type, index);- if (image == null)+ if (image is null){AddImage(GetImageInfo(file, type));}@@ -1942,7 +1942,7 @@ namespace MediaBrowser.Controller.Entities{var info = GetImageInfo(type, index);- if (info == null)+ if (info is null){// Nothing to doreturn;@@ -2035,7 +2035,7 @@ namespace MediaBrowser.Controller.Entities{var chapter = ItemRepository.GetChapter(this, imageIndex);- if (chapter == null)+ if (chapter is null){return null;}@@ -2147,7 +2147,7 @@ namespace MediaBrowser.Controller.Entitiesforeach (var newImage in images){- if (newImage == null)+ if (newImage is null){throw new ArgumentException("null image found in list");}@@ -2155,7 +2155,7 @@ namespace MediaBrowser.Controller.Entitiesvar existing = existingImages.Find(i => string.Equals(i.Path, newImage.FullName, StringComparison.OrdinalIgnoreCase));- if (existing == null)+ if (existing is null){newImageList.Add(newImage);}@@ -2241,7 +2241,7 @@ namespace MediaBrowser.Controller.Entitiesvar info1 = GetImageInfo(type, index1);var info2 = GetImageInfo(type, index2);- if (info1 == null || info2 == null)+ if (info1 is null || info2 is null){// Nothing to doreturn Task.CompletedTask;@@ -2290,7 +2290,7 @@ namespace MediaBrowser.Controller.Entitiesvar userdata = UserDataManager.GetUserData(user, this);- return userdata == null || !userdata.Played;+ return userdata is null || !userdata.Played;}ItemLookupInfo IHasLookupInfo<ItemLookupInfo>.GetLookupInfo()@@ -2445,14 +2445,14 @@ namespace MediaBrowser.Controller.Entities// Try to retrieve it from the db. If we don't find it, use the resolved versionvar video = LibraryManager.GetItemById(id) as Video;- if (video == null)+ if (video is null){video = LibraryManager.ResolvePath(FileSystem.GetFileSystemInfo(path)) as Video;newOptions.ForceSave = true;}- if (video == null)+ if (video is null){return Task.FromResult(true);}diff --git a/MediaBrowser.Controller/Entities/BaseItemExtensions.cs b/MediaBrowser.Controller/Entities/BaseItemExtensions.csindex 948eb43754..dc06bf9bda 100644--- a/MediaBrowser.Controller/Entities/BaseItemExtensions.cs+++ b/MediaBrowser.Controller/Entities/BaseItemExtensions.cs@@ -89,7 +89,7 @@ namespace MediaBrowser.Controller.Entities}var v = sourceProp.GetValue(source);- if (v == null)+ if (v is null){continue;}diff --git a/MediaBrowser.Controller/Entities/Extensions.cs b/MediaBrowser.Controller/Entities/Extensions.csindex 1acb92fdc6..d4a7793909 100644--- a/MediaBrowser.Controller/Entities/Extensions.cs+++ b/MediaBrowser.Controller/Entities/Extensions.cs@@ -26,7 +26,7 @@ namespace MediaBrowser.Controller.Entitiesvar current = item.RemoteTrailers.FirstOrDefault(i => string.Equals(i.Url, url, StringComparison.OrdinalIgnoreCase));- if (current == null)+ if (current is null){var mediaUrl = new MediaUrl{diff --git a/MediaBrowser.Controller/Entities/Folder.cs b/MediaBrowser.Controller/Entities/Folder.csindex 808f918104..9ef5504afb 100644--- a/MediaBrowser.Controller/Entities/Folder.cs+++ b/MediaBrowser.Controller/Entities/Folder.cs@@ -703,7 +703,7 @@ namespace MediaBrowser.Controller.EntitiesIEnumerable<BaseItem> items;Func<BaseItem, bool> filter = i => UserViewBuilder.Filter(i, user, query, UserDataManager, LibraryManager);- if (query.User == null)+ if (query.User is null){items = GetRecursiveChildren(filter);}@@ -961,7 +961,7 @@ namespace MediaBrowser.Controller.EntitiesIEnumerable<BaseItem> items;- if (query.User == null)+ if (query.User is null){items = Children.Where(filter);}@@ -1311,7 +1311,7 @@ namespace MediaBrowser.Controller.Entities}// If there are not sub-folders, proceed as normal.- if (children == null)+ if (children is null){children = GetEligibleChildrenForRecursiveChildren(user);}@@ -1320,7 +1320,7 @@ namespace MediaBrowser.Controller.Entities{bool? isVisibleToUser = null;- if (query == null || UserViewBuilder.FilterItem(child, query))+ if (query is null || UserViewBuilder.FilterItem(child, query)){isVisibleToUser = child.IsVisible(user);@@ -1345,7 +1345,7 @@ namespace MediaBrowser.Controller.Entities{foreach (var child in GetLinkedChildren(user)){- if (query == null || UserViewBuilder.FilterItem(child, query))+ if (query is null || UserViewBuilder.FilterItem(child, query)){if (child.IsVisible(user)){@@ -1402,7 +1402,7 @@ namespace MediaBrowser.Controller.Entities{foreach (var child in Children){- if (filter == null || filter(child))+ if (filter is null || filter(child)){result[child.Id] = child;}@@ -1420,7 +1420,7 @@ namespace MediaBrowser.Controller.Entities{foreach (var child in GetLinkedChildren()){- if (filter == null || filter(child))+ if (filter is null || filter(child)){result[child.Id] = child;}@@ -1478,7 +1478,7 @@ namespace MediaBrowser.Controller.Entitiespublic List<BaseItem> GetLinkedChildren(User user){- if (!FilterLinkedChildrenPerUser || user == null)+ if (!FilterLinkedChildrenPerUser || user is null){return GetLinkedChildren();}@@ -1504,7 +1504,7 @@ namespace MediaBrowser.Controller.Entities{var child = GetLinkedChild(i);- if (child == null)+ if (child is null){continue;}diff --git a/MediaBrowser.Controller/Entities/InternalItemsQuery.cs b/MediaBrowser.Controller/Entities/InternalItemsQuery.csindex 1bf5285382..fc019c0ee7 100644--- a/MediaBrowser.Controller/Entities/InternalItemsQuery.cs+++ b/MediaBrowser.Controller/Entities/InternalItemsQuery.cs@@ -316,7 +316,7 @@ namespace MediaBrowser.Controller.Entities{set{- if (value == null)+ if (value is null){ParentId = Guid.Empty;ParentType = null;diff --git a/MediaBrowser.Controller/Entities/ItemImageInfo.cs b/MediaBrowser.Controller/Entities/ItemImageInfo.csindex ea8555dbfe..0171af27cf 100644--- a/MediaBrowser.Controller/Entities/ItemImageInfo.cs+++ b/MediaBrowser.Controller/Entities/ItemImageInfo.cs@@ -39,6 +39,6 @@ namespace MediaBrowser.Controller.Entitiespublic string BlurHash { get; set; }[JsonIgnore]- public bool IsLocalFile => Path == null || !Path.StartsWith("http", StringComparison.OrdinalIgnoreCase);+ public bool IsLocalFile => Path is null || !Path.StartsWith("http", StringComparison.OrdinalIgnoreCase);}}diff --git a/MediaBrowser.Controller/Entities/PeopleHelper.cs b/MediaBrowser.Controller/Entities/PeopleHelper.csindex 8571bfcea5..46d969ffe4 100644--- a/MediaBrowser.Controller/Entities/PeopleHelper.cs+++ b/MediaBrowser.Controller/Entities/PeopleHelper.cs@@ -53,7 +53,7 @@ namespace MediaBrowser.Controller.Entities{// If the actor already exists without a role and we have one, fill it invar existing = people.FirstOrDefault(p => p.Name.Equals(person.Name, StringComparison.OrdinalIgnoreCase) && (p.Type.Equals(PersonType.Actor, StringComparison.OrdinalIgnoreCase) || p.Type.Equals(PersonType.GuestStar, StringComparison.OrdinalIgnoreCase)));- if (existing == null)+ if (existing is null){// Wasn't there - add itpeople.Add(person);@@ -76,7 +76,7 @@ namespace MediaBrowser.Controller.Entitiesstring.Equals(p.Type, person.Type, StringComparison.OrdinalIgnoreCase));// Check for dupes based on the combination of Name and Type- if (existing == null)+ if (existing is null){people.Add(person);}diff --git a/MediaBrowser.Controller/Entities/TV/Episode.cs b/MediaBrowser.Controller/Entities/TV/Episode.csindex 15b721fe63..2d9cdb8d04 100644--- a/MediaBrowser.Controller/Entities/TV/Episode.cs+++ b/MediaBrowser.Controller/Entities/TV/Episode.cs@@ -136,7 +136,7 @@ namespace MediaBrowser.Controller.Entities.TVpublic string FindSeriesSortName(){var series = Series;- return series == null ? SeriesName : series.SortName;+ return series is null ? SeriesName : series.SortName;}public override double GetDefaultPrimaryImageAspectRatio()@@ -181,14 +181,14 @@ namespace MediaBrowser.Controller.Entities.TVpublic string FindSeriesPresentationUniqueKey(){var series = Series;- return series == null ? null : series.PresentationUniqueKey;+ return series is null ? null : series.PresentationUniqueKey;}public string FindSeasonName(){var season = Season;- if (season == null)+ if (season is null){if (ParentIndexNumber.HasValue){@@ -204,7 +204,7 @@ namespace MediaBrowser.Controller.Entities.TVpublic string FindSeriesName(){var series = Series;- return series == null ? SeriesName : series.Name;+ return series is null ? SeriesName : series.Name;}public Guid FindSeasonId()@@ -212,7 +212,7 @@ namespace MediaBrowser.Controller.Entities.TVvar season = FindParent<Season>();// Episodes directly in series folder- if (season == null)+ if (season is null){var series = Series;@@ -226,7 +226,7 @@ namespace MediaBrowser.Controller.Entities.TV}}- return season == null ? Guid.Empty : season.Id;+ return season is null ? Guid.Empty : season.Id;}/// <summary>@@ -262,7 +262,7 @@ namespace MediaBrowser.Controller.Entities.TVpublic Guid FindSeriesId(){var series = FindParent<Series>();- return series == null ? Guid.Empty : series.Id;+ return series is null ? Guid.Empty : series.Id;}public override IEnumerable<Guid> GetAncestorIds()diff --git a/MediaBrowser.Controller/Entities/TV/Season.cs b/MediaBrowser.Controller/Entities/TV/Season.csindex 599d35da64..19fe16c8f1 100644--- a/MediaBrowser.Controller/Entities/TV/Season.cs+++ b/MediaBrowser.Controller/Entities/TV/Season.cs@@ -93,7 +93,7 @@ namespace MediaBrowser.Controller.Entities.TVpublic string FindSeriesSortName(){var series = Series;- return series == null ? SeriesName : series.SortName;+ return series is null ? SeriesName : series.SortName;}public override List<string> GetUserDataKeys()@@ -149,7 +149,7 @@ namespace MediaBrowser.Controller.Entities.TVprotected override QueryResult<BaseItem> GetItemsInternal(InternalItemsQuery query){- if (query.User == null)+ if (query.User is null){return base.GetItemsInternal(query);}@@ -208,13 +208,13 @@ namespace MediaBrowser.Controller.Entities.TVpublic string FindSeriesPresentationUniqueKey(){var series = Series;- return series == null ? null : series.PresentationUniqueKey;+ return series is null ? null : series.PresentationUniqueKey;}public string FindSeriesName(){var series = Series;- return series == null ? SeriesName : series.Name;+ return series is null ? SeriesName : series.Name;}public Guid FindSeriesId()diff --git a/MediaBrowser.Controller/Entities/TV/Series.cs b/MediaBrowser.Controller/Entities/TV/Series.csindex d66802a64f..069071ee57 100644--- a/MediaBrowser.Controller/Entities/TV/Series.cs+++ b/MediaBrowser.Controller/Entities/TV/Series.cs@@ -266,7 +266,7 @@ namespace MediaBrowser.Controller.Entities.TVDtoOptions = options};- if (user == null || !user.DisplayMissingEpisodes)+ if (user is null || !user.DisplayMissingEpisodes){query.IsMissing = false;}@@ -384,7 +384,7 @@ namespace MediaBrowser.Controller.Entities.TVpublic List<BaseItem> GetSeasonEpisodes(Season parentSeason, User user, IEnumerable<BaseItem> allSeriesEpisodes, DtoOptions options){- if (allSeriesEpisodes == null)+ if (allSeriesEpisodes is null){return GetSeasonEpisodes(parentSeason, user, options);}diff --git a/MediaBrowser.Controller/Entities/UserRootFolder.cs b/MediaBrowser.Controller/Entities/UserRootFolder.csindex e547db5231..b19b1fa13b 100644--- a/MediaBrowser.Controller/Entities/UserRootFolder.cs+++ b/MediaBrowser.Controller/Entities/UserRootFolder.cs@@ -56,7 +56,7 @@ namespace MediaBrowser.Controller.Entities{lock (_childIdsLock){- if (_childrenIds == null)+ if (_childrenIds is null){var list = base.LoadChildren();_childrenIds = list.Select(i => i.Id).ToList();diff --git a/MediaBrowser.Controller/Entities/UserViewBuilder.cs b/MediaBrowser.Controller/Entities/UserViewBuilder.csindex f467a60384..7ebf9e5f8b 100644--- a/MediaBrowser.Controller/Entities/UserViewBuilder.cs+++ b/MediaBrowser.Controller/Entities/UserViewBuilder.cs@@ -559,7 +559,7 @@ namespace MediaBrowser.Controller.Entitiesvar val = query.Is3D.Value;var video = item as Video;- if (video == null || val != video.Video3DFormat.HasValue)+ if (video is null || val != video.Video3DFormat.HasValue){return false;}@@ -689,7 +689,7 @@ namespace MediaBrowser.Controller.Entitiesvar video = item as Video;- if (video == null || val != video.HasSubtitles)+ if (video is null || val != video.HasSubtitles){return false;}@@ -776,7 +776,7 @@ namespace MediaBrowser.Controller.Entitiesif (query.VideoTypes.Length > 0){var video = item as Video;- if (video == null || !query.VideoTypes.Contains(video.VideoType))+ if (video is null || !query.VideoTypes.Contains(video.VideoType)){return false;}@@ -913,7 +913,7 @@ namespace MediaBrowser.Controller.Entities{var episode = item as Episode;- if (episode == null)+ if (episode is null){return false;}@@ -929,7 +929,7 @@ namespace MediaBrowser.Controller.Entitiesprivate IEnumerable<BaseItem> GetMediaFolders(User user){- if (user == null)+ if (user is null){return _libraryManager.RootFolder.Children@@ -945,7 +945,7 @@ namespace MediaBrowser.Controller.Entitiesprivate BaseItem[] GetMediaFolders(User user, IEnumerable<string> viewTypes){- if (user == null)+ if (user is null){return GetMediaFolders(null).Where(i =>@@ -967,7 +967,7 @@ namespace MediaBrowser.Controller.Entitiesprivate BaseItem[] GetMediaFolders(Folder parent, User user, IEnumerable<string> viewTypes){- if (parent == null || parent is UserView)+ if (parent is null || parent is UserView){return GetMediaFolders(user, viewTypes);}diff --git a/MediaBrowser.Controller/Library/ItemResolveArgs.cs b/MediaBrowser.Controller/Library/ItemResolveArgs.csindex 91d162b411..f93c890fee 100644--- a/MediaBrowser.Controller/Library/ItemResolveArgs.cs+++ b/MediaBrowser.Controller/Library/ItemResolveArgs.cs@@ -47,7 +47,7 @@ namespace MediaBrowser.Controller.Librarypublic LibraryOptions LibraryOptions{- get => _libraryOptions ??= Parent == null ? new LibraryOptions() : BaseItem.LibraryManager.GetLibraryOptions(Parent);+ get => _libraryOptions ??= Parent is null ? new LibraryOptions() : BaseItem.LibraryManager.GetLibraryOptions(Parent);set => _libraryOptions = value;}@@ -119,7 +119,7 @@ namespace MediaBrowser.Controller.Libraryget{var paths = string.IsNullOrEmpty(Path) ? Array.Empty<string>() : new[] { Path };- return AdditionalLocations == null ? paths : paths.Concat(AdditionalLocations).ToArray();+ return AdditionalLocations is null ? paths : paths.Concat(AdditionalLocations).ToArray();}}@@ -136,7 +136,7 @@ namespace MediaBrowser.Controller.Library// Just in case the user decided to nest episodes.// Not officially supported but in some cases we can handle it.- if (item == null)+ if (item is null){var parents = parent.GetParents();foreach (var currentParent in parents)@@ -289,7 +289,7 @@ namespace MediaBrowser.Controller.Library{if (args != null){- if (args.Path == null && Path == null)+ if (args.Path is null && Path is null){return true;}diff --git a/MediaBrowser.Controller/Library/NameExtensions.cs b/MediaBrowser.Controller/Library/NameExtensions.csindex 9d78b8b6c8..919570e893 100644--- a/MediaBrowser.Controller/Library/NameExtensions.cs+++ b/MediaBrowser.Controller/Library/NameExtensions.cs@@ -15,7 +15,7 @@ namespace MediaBrowser.Controller.Libraryprivate static string RemoveDiacritics(string? name){- if (name == null)+ if (name is null){return string.Empty;}diff --git a/MediaBrowser.Controller/LiveTv/LiveTvChannel.cs b/MediaBrowser.Controller/LiveTv/LiveTvChannel.csindex 335222da96..9788260420 100644--- a/MediaBrowser.Controller/LiveTv/LiveTvChannel.cs+++ b/MediaBrowser.Controller/LiveTv/LiveTvChannel.cs@@ -139,7 +139,7 @@ namespace MediaBrowser.Controller.LiveTvPath = Path,RunTimeTicks = RunTimeTicks,Type = MediaSourceType.Placeholder,- IsInfiniteStream = RunTimeTicks == null+ IsInfiniteStream = RunTimeTicks is null};list.Add(info);diff --git a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.csindex fae53acbfb..d423a2fbe4 100644--- a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs+++ b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs@@ -162,7 +162,7 @@ namespace MediaBrowser.Controller.MediaEncodingprivate bool IsHwTonemapAvailable(EncodingJobInfo state, EncodingOptions options){- if (state.VideoStream == null+ if (state.VideoStream is null|| !options.EnableTonemapping|| GetVideoColorBitDepth(state) != 10){@@ -189,7 +189,7 @@ namespace MediaBrowser.Controller.MediaEncodingprivate bool IsVulkanHwTonemapAvailable(EncodingJobInfo state, EncodingOptions options){- if (state.VideoStream == null)+ if (state.VideoStream is null){return false;}@@ -202,7 +202,7 @@ namespace MediaBrowser.Controller.MediaEncodingprivate bool IsVaapiVppTonemapAvailable(EncodingJobInfo state, EncodingOptions options){- if (state.VideoStream == null+ if (state.VideoStream is null|| !options.EnableVppTonemapping|| GetVideoColorBitDepth(state) != 10){@@ -1066,7 +1066,7 @@ namespace MediaBrowser.Controller.MediaEncodingpublic string GetVideoBitrateParam(EncodingJobInfo state, string videoCodec){- if (state.OutputVideoBitrate == null)+ if (state.OutputVideoBitrate is null){return string.Empty;}@@ -2076,7 +2076,7 @@ namespace MediaBrowser.Controller.MediaEncodingpublic int? GetAudioBitrateParam(int? audioBitRate, string audioCodec, MediaStream audioStream){- if (audioStream == null)+ if (audioStream is null){return null;}@@ -2167,7 +2167,7 @@ namespace MediaBrowser.Controller.MediaEncoding/// <returns>System.Nullable{System.Int32}.</returns>public int? GetNumAudioChannelsParam(EncodingJobInfo state, MediaStream audioStream, string outputAudioCodec){- if (audioStream == null)+ if (audioStream is null){return null;}@@ -2320,7 +2320,7 @@ namespace MediaBrowser.Controller.MediaEncoding// If we don't have known media info// If input is video, use -sn to drop subtitles// Otherwise just return empty- if (state.VideoStream == null && state.AudioStream == null)+ if (state.VideoStream is null && state.AudioStream is null){return state.IsInputVideo ? "-sn" : string.Empty;}@@ -2385,7 +2385,7 @@ namespace MediaBrowser.Controller.MediaEncoding}var subtitleMethod = state.SubtitleDeliveryMethod;- if (state.SubtitleStream == null || subtitleMethod == SubtitleDeliveryMethod.Hls)+ if (state.SubtitleStream is null || subtitleMethod == SubtitleDeliveryMethod.Hls){args += " -map -0:s";}@@ -2731,7 +2731,7 @@ namespace MediaBrowser.Controller.MediaEncoding}// default- if (filter == null)+ if (filter is null){if (requestedHeight > 0){@@ -4440,7 +4440,7 @@ namespace MediaBrowser.Controller.MediaEncodingstring outputVideoCodec){var videoStream = state.VideoStream;- if (videoStream == null)+ if (videoStream is null){return string.Empty;}@@ -4623,7 +4623,7 @@ namespace MediaBrowser.Controller.MediaEncoding{var videoStream = state.VideoStream;var mediaSource = state.MediaSource;- if (videoStream == null || mediaSource == null)+ if (videoStream is null || mediaSource is null){return null;}@@ -5469,7 +5469,7 @@ namespace MediaBrowser.Controller.MediaEncodingreturn;}- var inputChannels = audioStream == null ? 6 : audioStream.Channels ?? 6;+ var inputChannels = audioStream is null ? 6 : audioStream.Channels ?? 6;if (inputChannels >= 6){return;@@ -5521,7 +5521,7 @@ namespace MediaBrowser.Controller.MediaEncodingprivate void NormalizeSubtitleEmbed(EncodingJobInfo state){- if (state.SubtitleStream == null || state.SubtitleDeliveryMethod != SubtitleDeliveryMethod.Embed)+ if (state.SubtitleStream is null || state.SubtitleDeliveryMethod != SubtitleDeliveryMethod.Embed){return;}@@ -5536,7 +5536,7 @@ namespace MediaBrowser.Controller.MediaEncodingpublic string GetSubtitleEmbedArguments(EncodingJobInfo state){- if (state.SubtitleStream == null || state.SubtitleDeliveryMethod != SubtitleDeliveryMethod.Embed)+ if (state.SubtitleStream is null || state.SubtitleDeliveryMethod != SubtitleDeliveryMethod.Embed){return string.Empty;}@@ -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 == null && state.VideoStream != null)+ if (state.AudioStream is null && state.VideoStream != null){return string.Empty;}diff --git a/MediaBrowser.Controller/MediaEncoding/EncodingJobInfo.cs b/MediaBrowser.Controller/MediaEncoding/EncodingJobInfo.csindex c9625cf1da..5d13cb8ed8 100644--- a/MediaBrowser.Controller/MediaEncoding/EncodingJobInfo.cs+++ b/MediaBrowser.Controller/MediaEncoding/EncodingJobInfo.cs@@ -40,7 +40,7 @@ namespace MediaBrowser.Controller.MediaEncoding{if (!_transcodeReasons.HasValue){- if (BaseRequest.TranscodeReasons == null)+ if (BaseRequest.TranscodeReasons is null){_transcodeReasons = 0;return 0;@@ -305,7 +305,7 @@ namespace MediaBrowser.Controller.MediaEncodingif (BaseRequest.Static|| EncodingHelper.IsCopyCodec(OutputVideoCodec)){- return VideoStream == null ? null : (VideoStream.AverageFrameRate ?? VideoStream.RealFrameRate);+ return VideoStream is null ? null : (VideoStream.AverageFrameRate ?? VideoStream.RealFrameRate);}return BaseRequest.MaxFramerate ?? BaseRequest.Framerate;@@ -419,7 +419,7 @@ namespace MediaBrowser.Controller.MediaEncoding{get{- if (VideoStream == null)+ if (VideoStream is null){return null;}@@ -437,7 +437,7 @@ namespace MediaBrowser.Controller.MediaEncoding{get{- if (AudioStream == null)+ if (AudioStream is null){return null;}diff --git a/MediaBrowser.Controller/Providers/MetadataResult.cs b/MediaBrowser.Controller/Providers/MetadataResult.csindex 58a0fa2a9a..952dd48703 100644--- a/MediaBrowser.Controller/Providers/MetadataResult.cs+++ b/MediaBrowser.Controller/Providers/MetadataResult.cs@@ -59,7 +59,7 @@ namespace MediaBrowser.Controller.Providers/// </summary>public void ResetPeople(){- if (People == null)+ if (People is null){People = new List<PersonInfo>();}@@ -83,7 +83,7 @@ namespace MediaBrowser.Controller.Providers}}- if (userData == null)+ if (userData is null){userData = new UserItemData(){diff --git a/MediaBrowser.Controller/Session/SessionInfo.cs b/MediaBrowser.Controller/Session/SessionInfo.csindex b4520ae48f..d30472f224 100644--- a/MediaBrowser.Controller/Session/SessionInfo.cs+++ b/MediaBrowser.Controller/Session/SessionInfo.cs@@ -64,7 +64,7 @@ namespace MediaBrowser.Controller.Session{get{- if (Capabilities == null)+ if (Capabilities is null){return Array.Empty<string>();}@@ -182,7 +182,7 @@ namespace MediaBrowser.Controller.Session{get{- if (Capabilities == null || !Capabilities.SupportsMediaControl)+ if (Capabilities is null || !Capabilities.SupportsMediaControl){return false;}@@ -204,7 +204,7 @@ namespace MediaBrowser.Controller.Session{get{- if (Capabilities == null || !Capabilities.SupportsMediaControl)+ if (Capabilities is null || !Capabilities.SupportsMediaControl){return false;}@@ -239,7 +239,7 @@ namespace MediaBrowser.Controller.Session/// </summary>/// <value>The supported commands.</value>public IReadOnlyList<GeneralCommandType> SupportedCommands- => Capabilities == null ? Array.Empty<GeneralCommandType>() : Capabilities.SupportedCommands;+ => Capabilities is null ? Array.Empty<GeneralCommandType>() : Capabilities.SupportedCommands;public Tuple<ISessionController, bool> EnsureController<T>(Func<SessionInfo, ISessionController> factory){@@ -296,7 +296,7 @@ namespace MediaBrowser.Controller.Session{_lastProgressInfo = progressInfo;- if (_progressTimer == null)+ if (_progressTimer is null){_progressTimer = new Timer(OnProgressTimerCallback, null, 1000, 1000);}@@ -315,7 +315,7 @@ namespace MediaBrowser.Controller.Session}var progressInfo = _lastProgressInfo;- if (progressInfo == null)+ if (progressInfo is null){return;}diff --git a/MediaBrowser.LocalMetadata/BaseXmlProvider.cs b/MediaBrowser.LocalMetadata/BaseXmlProvider.csindex 9f8e921b4b..548ccee2d4 100644--- a/MediaBrowser.LocalMetadata/BaseXmlProvider.cs+++ b/MediaBrowser.LocalMetadata/BaseXmlProvider.cs@@ -51,7 +51,7 @@ namespace MediaBrowser.LocalMetadatavar file = GetXmlFile(info, directoryService);- if (file == null)+ if (file is null){return Task.FromResult(result);}@@ -98,7 +98,7 @@ namespace MediaBrowser.LocalMetadata{var file = GetXmlFile(new ItemInfo(item), directoryService);- if (file == null)+ if (file is null){return false;}diff --git a/MediaBrowser.LocalMetadata/Images/EpisodeLocalImageProvider.cs b/MediaBrowser.LocalMetadata/Images/EpisodeLocalImageProvider.csindex dc13bf4f6d..a8e2946f18 100644--- a/MediaBrowser.LocalMetadata/Images/EpisodeLocalImageProvider.cs+++ b/MediaBrowser.LocalMetadata/Images/EpisodeLocalImageProvider.cs@@ -32,7 +32,7 @@ namespace MediaBrowser.LocalMetadata.Imagespublic IEnumerable<LocalImageInfo> GetImages(BaseItem item, IDirectoryService directoryService){var parentPath = Path.GetDirectoryName(item.Path);- if (parentPath == null)+ if (parentPath is null){return Enumerable.Empty<LocalImageInfo>();}diff --git a/MediaBrowser.LocalMetadata/Images/LocalImageProvider.cs b/MediaBrowser.LocalMetadata/Images/LocalImageProvider.csindex 70fd68129a..e92c4f83ea 100644--- a/MediaBrowser.LocalMetadata/Images/LocalImageProvider.cs+++ b/MediaBrowser.LocalMetadata/Images/LocalImageProvider.cs@@ -453,7 +453,7 @@ namespace MediaBrowser.LocalMetadata.Images{var image = GetImage(files, name, prefix);- if (image == null)+ if (image is null){return false;}diff --git a/MediaBrowser.MediaEncoding/Attachments/AttachmentExtractor.cs b/MediaBrowser.MediaEncoding/Attachments/AttachmentExtractor.csindex 22abf93ac3..0ee2bdd380 100644--- a/MediaBrowser.MediaEncoding/Attachments/AttachmentExtractor.cs+++ b/MediaBrowser.MediaEncoding/Attachments/AttachmentExtractor.cs@@ -62,14 +62,14 @@ namespace MediaBrowser.MediaEncoding.Attachmentsvar mediaSources = await _mediaSourceManager.GetPlaybackMediaSources(item, null, true, false, cancellationToken).ConfigureAwait(false);var mediaSource = mediaSources.FirstOrDefault(i => string.Equals(i.Id, mediaSourceId, StringComparison.OrdinalIgnoreCase));- if (mediaSource == null)+ if (mediaSource is null){throw new ResourceNotFoundException($"MediaSource {mediaSourceId} not found");}var mediaAttachment = mediaSource.MediaAttachments.FirstOrDefault(i => i.Index == attachmentStreamIndex);- if (mediaAttachment == null)+ if (mediaAttachment is null){throw new ResourceNotFoundException($"MediaSource {mediaSourceId} has no attachment with stream index {attachmentStreamIndex}");}diff --git a/MediaBrowser.MediaEncoding/BdInfo/BdInfoExaminer.cs b/MediaBrowser.MediaEncoding/BdInfo/BdInfoExaminer.csindex 6ebaa4fff0..bde3d2e847 100644--- a/MediaBrowser.MediaEncoding/BdInfo/BdInfoExaminer.cs+++ b/MediaBrowser.MediaEncoding/BdInfo/BdInfoExaminer.cs@@ -48,7 +48,7 @@ namespace MediaBrowser.MediaEncoding.BdInfoMediaStreams = Array.Empty<MediaStream>()};- if (playlist == null)+ if (playlist is null){return outputStream;}diff --git a/MediaBrowser.MediaEncoding/Encoder/EncoderValidator.cs b/MediaBrowser.MediaEncoding/Encoder/EncoderValidator.csindex 8c8fc6b0f8..1ae3c976dc 100644--- a/MediaBrowser.MediaEncoding/Encoder/EncoderValidator.cs+++ b/MediaBrowser.MediaEncoding/Encoder/EncoderValidator.cs@@ -190,7 +190,7 @@ namespace MediaBrowser.MediaEncoding.Encoder_logger.LogInformation("Found ffmpeg version {Version}", version != null ? version.ToString() : "unknown");- if (version == null)+ if (version is null){if (MaxVersion != null) // Version is unknown{diff --git a/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs b/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.csindex e50aa679a3..9abfb91027 100644--- a/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs+++ b/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs@@ -531,7 +531,7 @@ namespace MediaBrowser.MediaEncoding.Encoderthrow;}- if (result == null || (result.Streams == null && result.Format == null))+ if (result is null || (result.Streams is null && result.Format is null)){throw new FfmpegException("ffprobe failed - streams and format are both null.");}diff --git a/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs b/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.csindex 417f1520f7..d5e90e8558 100644--- a/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs+++ b/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs@@ -156,7 +156,7 @@ namespace MediaBrowser.MediaEncoding.Probingelse{var artist = tags.GetFirstNotNullNorWhiteSpaceValue("artist");- info.Artists = artist == null+ info.Artists = artist is null? Array.Empty<string>(): SplitDistinctArtists(artist, _nameDelimiters, true).ToArray();}@@ -989,7 +989,7 @@ namespace MediaBrowser.MediaEncoding.Probing/// <returns>System.String.</returns>private string GetDictionaryValue(IReadOnlyDictionary<string, string> tags, string key){- if (tags == null)+ if (tags is null){return null;}@@ -1121,7 +1121,7 @@ namespace MediaBrowser.MediaEncoding.Probing{// Get the first info streamvar stream = result.Streams?.FirstOrDefault(s => string.Equals(s.CodecType, "audio", StringComparison.OrdinalIgnoreCase));- if (stream == null)+ if (stream is null){return;}@@ -1144,7 +1144,7 @@ namespace MediaBrowser.MediaEncoding.Probingprivate int? GetBPSFromTags(MediaStreamInfo streamInfo){- if (streamInfo?.Tags == null)+ if (streamInfo?.Tags is null){return null;}@@ -1161,7 +1161,7 @@ namespace MediaBrowser.MediaEncoding.Probingprivate double? GetRuntimeSecondsFromTags(MediaStreamInfo streamInfo){- if (streamInfo?.Tags == null)+ if (streamInfo?.Tags is null){return null;}@@ -1177,7 +1177,7 @@ namespace MediaBrowser.MediaEncoding.Probingprivate long? GetNumberOfBytesFromTags(MediaStreamInfo streamInfo){- if (streamInfo?.Tags == null)+ if (streamInfo?.Tags is null){return null;}@@ -1195,7 +1195,7 @@ namespace MediaBrowser.MediaEncoding.Probingprivate void SetSize(InternalMediaInfoResult data, MediaInfo info){- if (data.Format == null)+ if (data.Format is null){return;}@@ -1510,7 +1510,7 @@ namespace MediaBrowser.MediaEncoding.Probing{var tags = data.Format?.Tags;- if (tags == null)+ if (tags is null){return;}diff --git a/MediaBrowser.Model/Dlna/AudioOptions.cs b/MediaBrowser.Model/Dlna/AudioOptions.csindex 33755e7462..df4018fdd5 100644--- a/MediaBrowser.Model/Dlna/AudioOptions.cs+++ b/MediaBrowser.Model/Dlna/AudioOptions.cs@@ -77,7 +77,7 @@ namespace MediaBrowser.Model.Dlnareturn MaxBitrate;}- if (Profile == null)+ if (Profile is null){return null;}diff --git a/MediaBrowser.Model/Dlna/ContainerProfile.cs b/MediaBrowser.Model/Dlna/ContainerProfile.csindex c6befdd857..9f7654a697 100644--- a/MediaBrowser.Model/Dlna/ContainerProfile.cs+++ b/MediaBrowser.Model/Dlna/ContainerProfile.cs@@ -52,7 +52,7 @@ namespace MediaBrowser.Model.Dlnapublic static bool ContainsContainer(string[]? profileContainers, bool isNegativeList, string? inputContainer){- if (profileContainers == null || profileContainers.Length == 0)+ if (profileContainers is null || profileContainers.Length == 0){// Empty profiles always support all containers/codecsreturn true;diff --git a/MediaBrowser.Model/Dlna/StreamBuilder.cs b/MediaBrowser.Model/Dlna/StreamBuilder.csindex 6e9b943f74..94112ab166 100644--- a/MediaBrowser.Model/Dlna/StreamBuilder.cs+++ b/MediaBrowser.Model/Dlna/StreamBuilder.cs@@ -247,7 +247,7 @@ namespace MediaBrowser.Model.Dlnaif (profile != null){- var playProfiles = playProfile == null ? profile.DirectPlayProfiles : new[] { playProfile };+ var playProfiles = playProfile is null ? profile.DirectPlayProfiles : new[] { playProfile };foreach (var format in formats){foreach (var directPlayProfile in playProfiles)@@ -370,7 +370,7 @@ namespace MediaBrowser.Model.Dlnavar directPlayProfile = options.Profile.DirectPlayProfiles.FirstOrDefault(x => x.Type == DlnaProfileType.Audio && IsAudioDirectPlaySupported(x, item, audioStream));- if (directPlayProfile == null)+ if (directPlayProfile is null){_logger.LogDebug("Profile: {0}, No audio direct play profiles found for {1} with codec {2}",@@ -422,7 +422,7 @@ namespace MediaBrowser.Model.Dlnaprivate static TranscodeReason GetTranscodeReasonsFromDirectPlayProfile(MediaSourceInfo item, MediaStream videoStream, MediaStream audioStream, IEnumerable<DirectPlayProfile> directPlayProfiles){- var mediaType = videoStream == null ? DlnaProfileType.Audio : DlnaProfileType.Video;+ var mediaType = videoStream is null ? DlnaProfileType.Audio : DlnaProfileType.Video;var containerSupported = false;var audioSupported = false;@@ -436,9 +436,9 @@ namespace MediaBrowser.Model.Dlna{containerSupported = true;- videoSupported = videoStream == null || profile.SupportsVideoCodec(videoStream.Codec);+ videoSupported = videoStream is null || profile.SupportsVideoCodec(videoStream.Codec);- audioSupported = audioStream == null || profile.SupportsAudioCodec(audioStream.Codec);+ audioSupported = audioStream is null || profile.SupportsAudioCodec(audioStream.Codec);if (videoSupported && audioSupported){@@ -586,7 +586,7 @@ namespace MediaBrowser.Model.Dlna}// Collect candidate audio streams- ICollection<MediaStream> candidateAudioStreams = audioStream == null ? Array.Empty<MediaStream>() : new[] { audioStream };+ ICollection<MediaStream> candidateAudioStreams = audioStream is null ? Array.Empty<MediaStream>() : new[] { audioStream };if (!options.AudioStreamIndex.HasValue || options.AudioStreamIndex < 0){if (audioStream?.IsDefault == true)@@ -729,8 +729,8 @@ namespace MediaBrowser.Model.Dlnaif (options.AllowVideoStreamCopy){// prefer direct copy profile- float videoFramerate = videoStream == null ? 0 : videoStream.AverageFrameRate ?? videoStream.AverageFrameRate ?? 0;- TransportStreamTimestamp? timestamp = videoStream == null ? TransportStreamTimestamp.None : item.Timestamp;+ float videoFramerate = videoStream is null ? 0 : videoStream.AverageFrameRate ?? videoStream.AverageFrameRate ?? 0;+ TransportStreamTimestamp? timestamp = videoStream is null ? TransportStreamTimestamp.None : item.Timestamp;int? numAudioStreams = item.GetStreamCount(MediaStreamType.Audio);int? numVideoStreams = item.GetStreamCount(MediaStreamType.Video);@@ -832,13 +832,13 @@ namespace MediaBrowser.Model.Dlnadouble? videoLevel = videoStream?.Level;string videoProfile = videoStream?.Profile;string videoRangeType = videoStream?.VideoRangeType;- float videoFramerate = videoStream == null ? 0 : videoStream.AverageFrameRate ?? videoStream.AverageFrameRate ?? 0;+ float videoFramerate = videoStream is null ? 0 : videoStream.AverageFrameRate ?? videoStream.AverageFrameRate ?? 0;bool? isAnamorphic = videoStream?.IsAnamorphic;bool? isInterlaced = videoStream?.IsInterlaced;string videoCodecTag = videoStream?.CodecTag;bool? isAvc = videoStream?.IsAVC;- TransportStreamTimestamp? timestamp = videoStream == null ? TransportStreamTimestamp.None : item.Timestamp;+ TransportStreamTimestamp? timestamp = videoStream is null ? TransportStreamTimestamp.None : item.Timestamp;int? packetLength = videoStream?.PacketLength;int? refFrames = videoStream?.RefFrames;@@ -870,12 +870,12 @@ namespace MediaBrowser.Model.Dlnaint audioBitrate = GetAudioBitrate(options.GetMaxBitrate(false) ?? 0, playlistItem.TargetAudioCodec, audioStream, playlistItem);playlistItem.AudioBitrate = Math.Min(playlistItem.AudioBitrate ?? audioBitrate, audioBitrate);- bool? isSecondaryAudio = audioStream == null ? null : item.IsSecondaryAudio(audioStream);- int? inputAudioBitrate = audioStream == null ? null : audioStream.BitRate;- int? audioChannels = audioStream == null ? null : audioStream.Channels;- string audioProfile = audioStream == null ? null : audioStream.Profile;- int? inputAudioSampleRate = audioStream == null ? null : audioStream.SampleRate;- int? inputAudioBitDepth = audioStream == null ? null : audioStream.BitDepth;+ bool? isSecondaryAudio = audioStream is null ? null : item.IsSecondaryAudio(audioStream);+ int? inputAudioBitrate = audioStream is null ? null : audioStream.BitRate;+ int? audioChannels = audioStream is null ? null : audioStream.Channels;+ string audioProfile = audioStream is null ? null : audioStream.Profile;+ int? inputAudioSampleRate = audioStream is null ? null : audioStream.SampleRate;+ int? inputAudioBitDepth = audioStream is null ? null : audioStream.BitDepth;var appliedAudioConditions = options.Profile.CodecProfiles.Where(i => i.Type == CodecType.VideoAudio &&@@ -965,7 +965,7 @@ namespace MediaBrowser.Model.Dlnaint defaultBitrate;int encoderAudioBitrateLimit = int.MaxValue;- if (audioStream == null)+ if (audioStream is null){defaultBitrate = 192000;}@@ -1080,13 +1080,13 @@ namespace MediaBrowser.Model.Dlnadouble? videoLevel = videoStream?.Level;string videoProfile = videoStream?.Profile;string videoRangeType = videoStream?.VideoRangeType;- float videoFramerate = videoStream == null ? 0 : videoStream.AverageFrameRate ?? videoStream.AverageFrameRate ?? 0;+ float videoFramerate = videoStream is null ? 0 : videoStream.AverageFrameRate ?? videoStream.AverageFrameRate ?? 0;bool? isAnamorphic = videoStream?.IsAnamorphic;bool? isInterlaced = videoStream?.IsInterlaced;string videoCodecTag = videoStream?.CodecTag;bool? isAvc = videoStream?.IsAVC;- TransportStreamTimestamp? timestamp = videoStream == null ? TransportStreamTimestamp.None : mediaSource.Timestamp;+ TransportStreamTimestamp? timestamp = videoStream is null ? TransportStreamTimestamp.None : mediaSource.Timestamp;int? packetLength = videoStream?.PacketLength;int? refFrames = videoStream?.RefFrames;@@ -1177,7 +1177,7 @@ namespace MediaBrowser.Model.Dlnaif (candidateAudioStreams.Any()){selectedAudioStream = candidateAudioStreams.FirstOrDefault(audioStream => directPlayProfile.SupportsAudioCodec(audioStream.Codec));- if (selectedAudioStream == null)+ if (selectedAudioStream is null){directPlayProfileReasons |= TranscodeReason.AudioCodecNotSupported;}@@ -1501,12 +1501,12 @@ namespace MediaBrowser.Model.Dlnathrow new ArgumentException("DeviceId is required");}- if (options.Profile == null)+ if (options.Profile is null){throw new ArgumentException("Profile is required");}- if (options.MediaSources == null)+ if (options.MediaSources is null){throw new ArgumentException("MediaSources is required");}diff --git a/MediaBrowser.Model/Dlna/StreamInfo.cs b/MediaBrowser.Model/Dlna/StreamInfo.csindex 5cfa2e7e3c..b82f233ae2 100644--- a/MediaBrowser.Model/Dlna/StreamInfo.cs+++ b/MediaBrowser.Model/Dlna/StreamInfo.cs@@ -215,7 +215,7 @@ namespace MediaBrowser.Model.Dlnavar stream = TargetVideoStream;return MaxFramerate.HasValue && !IsDirectStream? MaxFramerate- : stream == null ? null : stream.AverageFrameRate ?? stream.RealFrameRate;+ : stream is null ? null : stream.AverageFrameRate ?? stream.RealFrameRate;}}@@ -460,7 +460,7 @@ namespace MediaBrowser.Model.Dlnareturn !IsDirectStream? defaultValue- : MediaSource == null ? defaultValue : MediaSource.Timestamp ?? TransportStreamTimestamp.None;+ : MediaSource is null ? defaultValue : MediaSource.Timestamp ?? TransportStreamTimestamp.None;}}diff --git a/MediaBrowser.Model/Drawing/DrawingUtils.cs b/MediaBrowser.Model/Drawing/DrawingUtils.csindex 5567927682..2040d26bbb 100644--- a/MediaBrowser.Model/Drawing/DrawingUtils.cs+++ b/MediaBrowser.Model/Drawing/DrawingUtils.cs@@ -71,18 +71,18 @@ namespace MediaBrowser.Model.Drawingint? fillHeight){// Return original size if input is invalid.- if ((fillWidth == null || fillWidth == 0)- && (fillHeight == null || fillHeight == 0))+ if ((fillWidth is null || fillWidth == 0)+ && (fillHeight is null || fillHeight == 0)){return size;}- if (fillWidth == null || fillWidth == 0)+ if (fillWidth is null || fillWidth == 0){fillWidth = 1;}- if (fillHeight == null || fillHeight == 0)+ if (fillHeight is null || fillHeight == 0){fillHeight = 1;}diff --git a/MediaBrowser.Model/Dto/MediaSourceInfo.cs b/MediaBrowser.Model/Dto/MediaSourceInfo.csindex c348e83ae5..520832aeee 100644--- a/MediaBrowser.Model/Dto/MediaSourceInfo.cs+++ b/MediaBrowser.Model/Dto/MediaSourceInfo.cs@@ -134,7 +134,7 @@ namespace MediaBrowser.Model.Dtopublic void InferTotalBitrate(bool force = false){- if (MediaStreams == null)+ if (MediaStreams is null){return;}diff --git a/MediaBrowser.Model/Entities/ProviderIdsExtensions.cs b/MediaBrowser.Model/Entities/ProviderIdsExtensions.csindex d3b8400f34..cf453d62cb 100644--- a/MediaBrowser.Model/Entities/ProviderIdsExtensions.cs+++ b/MediaBrowser.Model/Entities/ProviderIdsExtensions.cs@@ -55,7 +55,7 @@ namespace MediaBrowser.Model.Entities{ArgumentNullException.ThrowIfNull(instance);- if (instance.ProviderIds == null)+ if (instance.ProviderIds is null){id = null;return false;diff --git a/MediaBrowser.Model/Notifications/NotificationOptions.cs b/MediaBrowser.Model/Notifications/NotificationOptions.csindex d1b5491bd1..8708d55f7d 100644--- a/MediaBrowser.Model/Notifications/NotificationOptions.cs+++ b/MediaBrowser.Model/Notifications/NotificationOptions.cs@@ -93,7 +93,7 @@ namespace MediaBrowser.Model.Notifications{NotificationOption opt = GetOptions(notificationType);- return opt == null+ return opt is null|| !opt.DisabledServices.Contains(service, StringComparison.OrdinalIgnoreCase);}diff --git a/MediaBrowser.Model/Updates/VersionInfo.cs b/MediaBrowser.Model/Updates/VersionInfo.csindex 03a540dde2..320199f984 100644--- a/MediaBrowser.Model/Updates/VersionInfo.cs+++ b/MediaBrowser.Model/Updates/VersionInfo.cs@@ -17,7 +17,7 @@ namespace MediaBrowser.Model.Updates[JsonPropertyName("version")]public string Version{- get => _version == null ? string.Empty : _version.ToString();+ get => _version is null ? string.Empty : _version.ToString();set => _version = SysVersion.Parse(value);}diff --git a/MediaBrowser.Providers/BoxSets/BoxSetMetadataService.cs b/MediaBrowser.Providers/BoxSets/BoxSetMetadataService.csindex cbbb343e5e..df9d15ec20 100644--- a/MediaBrowser.Providers/BoxSets/BoxSetMetadataService.cs+++ b/MediaBrowser.Providers/BoxSets/BoxSetMetadataService.cs@@ -66,7 +66,7 @@ namespace MediaBrowser.Providers.BoxSetsvar libraryFolderIds = item.GetLibraryFolderIds();var itemLibraryFolderIds = item.LibraryFolderIds;- if (itemLibraryFolderIds == null || !libraryFolderIds.SequenceEqual(itemLibraryFolderIds))+ if (itemLibraryFolderIds is null || !libraryFolderIds.SequenceEqual(itemLibraryFolderIds)){item.LibraryFolderIds = libraryFolderIds;updatedType |= ItemUpdateType.MetadataImport;diff --git a/MediaBrowser.Providers/Manager/ItemImageProvider.cs b/MediaBrowser.Providers/Manager/ItemImageProvider.csindex bbbbfad54a..23e9cbd34a 100644--- a/MediaBrowser.Providers/Manager/ItemImageProvider.cs+++ b/MediaBrowser.Providers/Manager/ItemImageProvider.cs@@ -399,7 +399,7 @@ namespace MediaBrowser.Providers.Manager{var currentImage = item.GetImageInfo(type, 0);- if (currentImage == null || !string.Equals(currentImage.Path, image.FileInfo.FullName, StringComparison.OrdinalIgnoreCase))+ if (currentImage is null || !string.Equals(currentImage.Path, image.FileInfo.FullName, StringComparison.OrdinalIgnoreCase)){item.SetImagePath(type, image.FileInfo);changed = true;@@ -471,7 +471,7 @@ namespace MediaBrowser.Providers.ManagerCancellationToken cancellationToken){var eligibleImages = images- .Where(i => i.Type == type && (i.Width == null || i.Width >= minWidth))+ .Where(i => i.Type == type && (i.Width is null || i.Width >= minWidth)).ToList();if (EnableImageStub(item) && eligibleImages.Count > 0)@@ -539,7 +539,7 @@ namespace MediaBrowser.Providers.Managerif (item is IItemByName and not MusicArtist){var hasDualAccess = item as IHasDualAccess;- if (hasDualAccess == null || hasDualAccess.IsAccessedByName)+ if (hasDualAccess is null || hasDualAccess.IsAccessedByName){return true;}diff --git a/MediaBrowser.Providers/Manager/MetadataService.cs b/MediaBrowser.Providers/Manager/MetadataService.csindex 0f3f1bdcba..8bd1b487dc 100644--- a/MediaBrowser.Providers/Manager/MetadataService.cs+++ b/MediaBrowser.Providers/Manager/MetadataService.cs@@ -918,12 +918,12 @@ namespace MediaBrowser.Providers.Managervar source = sourceResult.Item;var target = targetResult.Item;- if (source == null)+ if (source is null){throw new ArgumentException("Item cannot be null.", nameof(sourceResult));}- if (target == null)+ if (target is null){throw new ArgumentException("Item cannot be null.", nameof(targetResult));}@@ -1005,7 +1005,7 @@ namespace MediaBrowser.Providers.Managerif (!lockedFields.Contains(MetadataField.Cast)){- if (replaceData || targetResult.People == null || targetResult.People.Count == 0)+ if (replaceData || targetResult.People is null || targetResult.People.Count == 0){targetResult.People = sourceResult.People;}@@ -1178,7 +1178,7 @@ namespace MediaBrowser.Providers.Manager{if (source is Video sourceCast && target is Video targetCast){- if (replaceData || targetCast.Video3DFormat == null)+ if (replaceData || targetCast.Video3DFormat is null){targetCast.Video3DFormat = sourceCast.Video3DFormat;}diff --git a/MediaBrowser.Providers/Manager/ProviderManager.cs b/MediaBrowser.Providers/Manager/ProviderManager.csindex ac4dc1bc31..07d6b2b5eb 100644--- a/MediaBrowser.Providers/Manager/ProviderManager.cs+++ b/MediaBrowser.Providers/Manager/ProviderManager.cs@@ -135,7 +135,7 @@ namespace MediaBrowser.Providers.Managervar service = _metadataServices.FirstOrDefault(current => current.CanRefreshPrimary(type));service ??= _metadataServices.FirstOrDefault(current => current.CanRefresh(item));- if (service == null)+ if (service is null){_logger.LogError("Unable to find a metadata service for item of type {TypeName}", item.GetType().Name);return Task.FromResult(ItemUpdateType.None);@@ -660,7 +660,7 @@ namespace MediaBrowser.Providers.Managerif (!includeDisabled){- if (libraryOptions.MetadataSavers == null)+ if (libraryOptions.MetadataSavers is null){if (options.DisabledMetadataSavers.Contains(saver.Name, StringComparison.OrdinalIgnoreCase)){@@ -725,7 +725,7 @@ namespace MediaBrowser.Providers.Manager{LibraryOptions libraryOptions;- if (referenceItem == null)+ if (referenceItem is null){// Give it a dummy path just so that it looks like a file system itemvar dummy = new TItemType@@ -776,7 +776,7 @@ namespace MediaBrowser.Providers.Manager{var existingMatch = resultList.FirstOrDefault(i => i.ProviderIds.Any(p => string.Equals(result.GetProviderId(p.Key), p.Value, StringComparison.OrdinalIgnoreCase)));- if (existingMatch == null)+ if (existingMatch is null){resultList.Add(result);}@@ -831,7 +831,7 @@ namespace MediaBrowser.Providers.Manager{var provider = _metadataProviders.OfType<IRemoteSearchProvider>().FirstOrDefault(i => string.Equals(i.Name, providerName, StringComparison.OrdinalIgnoreCase));- if (provider == null)+ if (provider is null){throw new ArgumentException("Search provider not found.");}@@ -1002,7 +1002,7 @@ namespace MediaBrowser.Providers.Managertry{var item = libraryManager.GetItemById(refreshItem.Item1);- if (item == null)+ if (item is null){continue;}diff --git a/MediaBrowser.Providers/MediaInfo/EmbeddedImageProvider.cs b/MediaBrowser.Providers/MediaInfo/EmbeddedImageProvider.csindex d60d829def..a326de18f7 100644--- a/MediaBrowser.Providers/MediaInfo/EmbeddedImageProvider.cs+++ b/MediaBrowser.Providers/MediaInfo/EmbeddedImageProvider.cs@@ -162,7 +162,7 @@ namespace MediaBrowser.Providers.MediaInfo&& imageFileNames.Any(name => stream.Comment.Contains(name, StringComparison.OrdinalIgnoreCase)));// Primary type only: default to first image if none found by label- if (imageStream == null)+ if (imageStream is null){if (type == ImageType.Primary){diff --git a/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs b/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.csindex 7412a10d02..5bd0c90cea 100644--- a/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs+++ b/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs@@ -195,7 +195,7 @@ namespace MediaBrowser.Providers.MediaInfo// .Replace("matroska", "mkv", StringComparison.OrdinalIgnoreCase);// For DVDs this may not always be accurate, so don't set the runtime if the item already has one- var needToSetRuntime = video.VideoType != VideoType.Dvd || video.RunTimeTicks == null || video.RunTimeTicks.Value == 0;+ var needToSetRuntime = video.VideoType != VideoType.Dvd || video.RunTimeTicks is null || video.RunTimeTicks.Value == 0;if (needToSetRuntime){@@ -572,7 +572,7 @@ namespace MediaBrowser.Providers.MediaInfobool requirePerfectMatch;bool enabled;- if (libraryOptions.SubtitleDownloadLanguages == null)+ if (libraryOptions.SubtitleDownloadLanguages is null){subtitleDownloadLanguages = subtitleOptions.DownloadLanguages;skipIfEmbeddedSubtitlesPresent = subtitleOptions.SkipIfEmbeddedSubtitlesPresent;diff --git a/MediaBrowser.Providers/MediaInfo/ProbeProvider.cs b/MediaBrowser.Providers/MediaInfo/ProbeProvider.csindex 75f997a281..3bdc927964 100644--- a/MediaBrowser.Providers/MediaInfo/ProbeProvider.cs+++ b/MediaBrowser.Providers/MediaInfo/ProbeProvider.cs@@ -108,7 +108,7 @@ namespace MediaBrowser.Providers.MediaInfopublic bool HasChanged(BaseItem item, IDirectoryService directoryService){var video = item as Video;- if (video == null || video.VideoType == VideoType.VideoFile || video.VideoType == VideoType.Iso)+ if (video is null || video.VideoType == VideoType.VideoFile || video.VideoType == VideoType.Iso){var path = item.Path;diff --git a/MediaBrowser.Providers/MediaInfo/SubtitleScheduledTask.cs b/MediaBrowser.Providers/MediaInfo/SubtitleScheduledTask.csindex eb9071a52a..f21939d2a5 100644--- a/MediaBrowser.Providers/MediaInfo/SubtitleScheduledTask.cs+++ b/MediaBrowser.Providers/MediaInfo/SubtitleScheduledTask.cs@@ -80,7 +80,7 @@ namespace MediaBrowser.Providers.MediaInfobool skipIfEmbeddedSubtitlesPresent;bool skipIfAudioTrackMatches;- if (libraryOptions.SubtitleDownloadLanguages == null)+ if (libraryOptions.SubtitleDownloadLanguages is null){subtitleDownloadLanguages = options.DownloadLanguages;skipIfEmbeddedSubtitlesPresent = options.SkipIfEmbeddedSubtitlesPresent;@@ -172,7 +172,7 @@ namespace MediaBrowser.Providers.MediaInfobool skipIfAudioTrackMatches;bool requirePerfectMatch;- if (libraryOptions.SubtitleDownloadLanguages == null)+ if (libraryOptions.SubtitleDownloadLanguages is null){subtitleDownloadLanguages = options.DownloadLanguages;skipIfEmbeddedSubtitlesPresent = options.SkipIfEmbeddedSubtitlesPresent;diff --git a/MediaBrowser.Providers/MediaInfo/VideoImageProvider.cs b/MediaBrowser.Providers/MediaInfo/VideoImageProvider.csindex d4bf629702..ba7ad40727 100644--- a/MediaBrowser.Providers/MediaInfo/VideoImageProvider.cs+++ b/MediaBrowser.Providers/MediaInfo/VideoImageProvider.cs@@ -89,14 +89,14 @@ namespace MediaBrowser.Providers.MediaInfovar query = new MediaStreamQuery { ItemId = item.Id, Index = item.DefaultVideoStreamIndex };var videoStream = _mediaSourceManager.GetMediaStreams(query).FirstOrDefault();- if (videoStream == null)+ if (videoStream is null){query.Type = MediaStreamType.Video;query.Index = null;videoStream = _mediaSourceManager.GetMediaStreams(query).FirstOrDefault();}- if (videoStream == null)+ if (videoStream is null){_logger.LogInformation("Skipping image extraction: no video stream found for {Path}.", item.Path ?? string.Empty);return new DynamicImageResponse { HasImage = false };diff --git a/MediaBrowser.Providers/Plugins/Omdb/JsonOmdbNotAvailableInt32Converter.cs b/MediaBrowser.Providers/Plugins/Omdb/JsonOmdbNotAvailableInt32Converter.csindex 8bfdc461e6..38379ae5d9 100644--- a/MediaBrowser.Providers/Plugins/Omdb/JsonOmdbNotAvailableInt32Converter.cs+++ b/MediaBrowser.Providers/Plugins/Omdb/JsonOmdbNotAvailableInt32Converter.cs@@ -16,7 +16,7 @@ namespace MediaBrowser.Providers.Plugins.Omdbif (reader.TokenType == JsonTokenType.String){var str = reader.GetString();- if (str == null || str.Equals("N/A", StringComparison.OrdinalIgnoreCase))+ if (str is null || str.Equals("N/A", StringComparison.OrdinalIgnoreCase)){return null;}diff --git a/MediaBrowser.Providers/Plugins/Omdb/OmdbProvider.cs b/MediaBrowser.Providers/Plugins/Omdb/OmdbProvider.csindex 10077e5c89..d3e5c9ee0a 100644--- a/MediaBrowser.Providers/Plugins/Omdb/OmdbProvider.cs+++ b/MediaBrowser.Providers/Plugins/Omdb/OmdbProvider.cs@@ -141,7 +141,7 @@ namespace MediaBrowser.Providers.Plugins.Omdbvar seasonResult = await GetSeasonRootObject(seriesImdbId, seasonNumber, cancellationToken).ConfigureAwait(false);- if (seasonResult?.Episodes == null)+ if (seasonResult?.Episodes is null){return false;}@@ -161,7 +161,7 @@ namespace MediaBrowser.Providers.Plugins.Omdb}// finally, search by numbers- if (result == null)+ if (result is null){foreach (var episode in seasonResult.Episodes){@@ -173,7 +173,7 @@ namespace MediaBrowser.Providers.Plugins.Omdb}}- if (result == null)+ if (result is null){return false;}diff --git a/MediaBrowser.Providers/Plugins/StudioImages/StudiosImageProvider.cs b/MediaBrowser.Providers/Plugins/StudioImages/StudiosImageProvider.csindex ffbb338e84..4ff9e02477 100644--- a/MediaBrowser.Providers/Plugins/StudioImages/StudiosImageProvider.cs+++ b/MediaBrowser.Providers/Plugins/StudioImages/StudiosImageProvider.cs@@ -70,7 +70,7 @@ namespace MediaBrowser.Providers.Plugins.StudioImagesvar imageInfo = GetImage(item, thumbsPath, ImageType.Thumb, "thumb");- if (imageInfo == null)+ if (imageInfo is null){return Enumerable.Empty<RemoteImageInfo>();}diff --git a/MediaBrowser.Providers/Plugins/Tmdb/BoxSets/TmdbBoxSetImageProvider.cs b/MediaBrowser.Providers/Plugins/Tmdb/BoxSets/TmdbBoxSetImageProvider.csindex ef878e6707..20898d213d 100644--- a/MediaBrowser.Providers/Plugins/Tmdb/BoxSets/TmdbBoxSetImageProvider.cs+++ b/MediaBrowser.Providers/Plugins/Tmdb/BoxSets/TmdbBoxSetImageProvider.cs@@ -72,7 +72,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.BoxSets// TODO use image languages if All Languages isn't toggled, but there's currently no way to get that value in herevar collection = await _tmdbClientManager.GetCollectionAsync(tmdbId, null, null, cancellationToken).ConfigureAwait(false);- if (collection?.Images == null)+ if (collection?.Images is null){return Enumerable.Empty<RemoteImageInfo>();}diff --git a/MediaBrowser.Providers/Plugins/Tmdb/BoxSets/TmdbBoxSetProvider.cs b/MediaBrowser.Providers/Plugins/Tmdb/BoxSets/TmdbBoxSetProvider.csindex 90f2aa88f7..0a85832051 100644--- a/MediaBrowser.Providers/Plugins/Tmdb/BoxSets/TmdbBoxSetProvider.cs+++ b/MediaBrowser.Providers/Plugins/Tmdb/BoxSets/TmdbBoxSetProvider.cs@@ -51,7 +51,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 null){return Enumerable.Empty<RemoteSearchResult>();}diff --git a/MediaBrowser.Providers/Plugins/Tmdb/Movies/TmdbMovieImageProvider.cs b/MediaBrowser.Providers/Plugins/Tmdb/Movies/TmdbMovieImageProvider.csindex 1646a93d22..55e96f1fe5 100644--- a/MediaBrowser.Providers/Plugins/Tmdb/Movies/TmdbMovieImageProvider.cs+++ b/MediaBrowser.Providers/Plugins/Tmdb/Movies/TmdbMovieImageProvider.cs@@ -90,7 +90,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.Movies.GetMovieAsync(movieTmdbId, null, null, cancellationToken).ConfigureAwait(false);- if (movie?.Images == null)+ if (movie?.Images is null){return Enumerable.Empty<RemoteImageInfo>();}diff --git a/MediaBrowser.Providers/Plugins/Tmdb/Movies/TmdbMovieProvider.cs b/MediaBrowser.Providers/Plugins/Tmdb/Movies/TmdbMovieProvider.csindex dd2d5d97d9..4f9dfb3efd 100644--- a/MediaBrowser.Providers/Plugins/Tmdb/Movies/TmdbMovieProvider.cs+++ b/MediaBrowser.Providers/Plugins/Tmdb/Movies/TmdbMovieProvider.cs@@ -177,7 +177,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.Movies.GetMovieAsync(Convert.ToInt32(tmdbId, CultureInfo.InvariantCulture), info.MetadataLanguage, TmdbUtils.GetImageLanguagesParam(info.MetadataLanguage), cancellationToken).ConfigureAwait(false);- if (movieResult == null)+ if (movieResult is null){return new MetadataResult<Movie>();}diff --git a/MediaBrowser.Providers/Plugins/Tmdb/People/TmdbPersonImageProvider.cs b/MediaBrowser.Providers/Plugins/Tmdb/People/TmdbPersonImageProvider.csindex d7f5c99dd2..aa46d8f257 100644--- a/MediaBrowser.Providers/Plugins/Tmdb/People/TmdbPersonImageProvider.cs+++ b/MediaBrowser.Providers/Plugins/Tmdb/People/TmdbPersonImageProvider.cs@@ -64,7 +64,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.Peoplevar language = item.GetPreferredMetadataLanguage();var personResult = await _tmdbClientManager.GetPersonAsync(int.Parse(personTmdbId, CultureInfo.InvariantCulture), language, cancellationToken).ConfigureAwait(false);- if (personResult?.Images?.Profiles == null)+ if (personResult?.Images?.Profiles is null){return Enumerable.Empty<RemoteImageInfo>();}diff --git a/MediaBrowser.Providers/Plugins/Tmdb/TV/TmdbEpisodeImageProvider.cs b/MediaBrowser.Providers/Plugins/Tmdb/TV/TmdbEpisodeImageProvider.csindex 943a3a75b2..127d41cc7d 100644--- a/MediaBrowser.Providers/Plugins/Tmdb/TV/TmdbEpisodeImageProvider.cs+++ b/MediaBrowser.Providers/Plugins/Tmdb/TV/TmdbEpisodeImageProvider.cs@@ -84,7 +84,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.TV.ConfigureAwait(false);var stills = episodeResult?.Images?.Stills;- if (stills == null)+ if (stills is null){return Enumerable.Empty<RemoteImageInfo>();}diff --git a/MediaBrowser.Providers/Plugins/Tmdb/TV/TmdbEpisodeProvider.cs b/MediaBrowser.Providers/Plugins/Tmdb/TV/TmdbEpisodeProvider.csindex e20284e6f8..d003017ffc 100644--- a/MediaBrowser.Providers/Plugins/Tmdb/TV/TmdbEpisodeProvider.cs+++ b/MediaBrowser.Providers/Plugins/Tmdb/TV/TmdbEpisodeProvider.cs@@ -107,7 +107,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.TV.GetEpisodeAsync(seriesTmdbId, seasonNumber.Value, episodeNumber.Value, info.SeriesDisplayOrder, info.MetadataLanguage, TmdbUtils.GetImageLanguagesParam(info.MetadataLanguage), cancellationToken).ConfigureAwait(false);- if (episodeResult == null)+ if (episodeResult is null){return metadataResult;}diff --git a/MediaBrowser.Providers/Plugins/Tmdb/TV/TmdbSeasonImageProvider.cs b/MediaBrowser.Providers/Plugins/Tmdb/TV/TmdbSeasonImageProvider.csindex da32ea4081..fda00537d5 100644--- a/MediaBrowser.Providers/Plugins/Tmdb/TV/TmdbSeasonImageProvider.cs+++ b/MediaBrowser.Providers/Plugins/Tmdb/TV/TmdbSeasonImageProvider.cs@@ -62,7 +62,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.TVvar seriesTmdbId = Convert.ToInt32(series?.GetProviderId(MetadataProvider.Tmdb), CultureInfo.InvariantCulture);- if (seriesTmdbId <= 0 || season?.IndexNumber == null)+ if (seriesTmdbId <= 0 || season?.IndexNumber is null){return Enumerable.Empty<RemoteImageInfo>();}@@ -75,7 +75,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.TV.ConfigureAwait(false);var posters = seasonResult?.Images?.Posters;- if (posters == null)+ if (posters is null){return Enumerable.Empty<RemoteImageInfo>();}diff --git a/MediaBrowser.Providers/Plugins/Tmdb/TV/TmdbSeasonProvider.cs b/MediaBrowser.Providers/Plugins/Tmdb/TV/TmdbSeasonProvider.csindex 2cf0f399e0..e38af68a63 100644--- a/MediaBrowser.Providers/Plugins/Tmdb/TV/TmdbSeasonProvider.cs+++ b/MediaBrowser.Providers/Plugins/Tmdb/TV/TmdbSeasonProvider.cs@@ -55,7 +55,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.TV.GetSeasonAsync(Convert.ToInt32(seriesTmdbId, CultureInfo.InvariantCulture), seasonNumber.Value, info.MetadataLanguage, TmdbUtils.GetImageLanguagesParam(info.MetadataLanguage), cancellationToken).ConfigureAwait(false);- if (seasonResult == null)+ if (seasonResult is null){return result;}diff --git a/MediaBrowser.Providers/Plugins/Tmdb/TV/TmdbSeriesImageProvider.cs b/MediaBrowser.Providers/Plugins/Tmdb/TV/TmdbSeriesImageProvider.csindex e96b680b48..9062f1b850 100644--- a/MediaBrowser.Providers/Plugins/Tmdb/TV/TmdbSeriesImageProvider.cs+++ b/MediaBrowser.Providers/Plugins/Tmdb/TV/TmdbSeriesImageProvider.cs@@ -73,7 +73,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.TV.GetSeriesAsync(Convert.ToInt32(tmdbId, CultureInfo.InvariantCulture), null, null, cancellationToken).ConfigureAwait(false);- if (series?.Images == null)+ if (series?.Images is null){return Enumerable.Empty<RemoteImageInfo>();}diff --git a/MediaBrowser.Providers/Plugins/Tmdb/TmdbClientManager.cs b/MediaBrowser.Providers/Plugins/Tmdb/TmdbClientManager.csindex 7d77334078..7f943a7b6f 100644--- a/MediaBrowser.Providers/Plugins/Tmdb/TmdbClientManager.cs+++ b/MediaBrowser.Providers/Plugins/Tmdb/TmdbClientManager.cs@@ -174,7 +174,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdbstring.Equals(displayOrder, "tv", StringComparison.Ordinal) ? TvGroupType.TV :null;- if (groupType == null)+ if (groupType is null){return null;}@@ -190,7 +190,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdbvar series = await GetSeriesAsync(tvShowId, language, imageLanguages, cancellationToken).ConfigureAwait(false);var episodeGroupId = series?.EpisodeGroups.Results.Find(g => g.Type == groupType)?.Id;- if (episodeGroupId == null)+ if (episodeGroupId is null){return null;}diff --git a/MediaBrowser.Providers/TV/SeriesMetadataService.cs b/MediaBrowser.Providers/TV/SeriesMetadataService.csindex c09b6d8138..a261d7cdb5 100644--- a/MediaBrowser.Providers/TV/SeriesMetadataService.cs+++ b/MediaBrowser.Providers/TV/SeriesMetadataService.cs@@ -80,7 +80,7 @@ namespace MediaBrowser.Providers.TVtargetItem.Status = sourceItem.Status;}- if (replaceData || targetItem.AirDays == null || targetItem.AirDays.Length == 0)+ if (replaceData || targetItem.AirDays is null || targetItem.AirDays.Length == 0){targetItem.AirDays = sourceItem.AirDays;}@@ -201,7 +201,7 @@ namespace MediaBrowser.Providers.TVvar seasonNumber = episode.ParentIndexNumber >= 0 ? episode.ParentIndexNumber : null;var existingSeason = seasons.FirstOrDefault(i => i.IndexNumber == seasonNumber);- if (existingSeason == null)+ if (existingSeason is null){var season = await CreateSeasonAsync(series, seasonNumber, cancellationToken).ConfigureAwait(false);seasons.Add(season);diff --git a/MediaBrowser.XbmcMetadata/Parsers/BaseNfoParser.cs b/MediaBrowser.XbmcMetadata/Parsers/BaseNfoParser.csindex 9e197e737b..d31c07d144 100644--- a/MediaBrowser.XbmcMetadata/Parsers/BaseNfoParser.cs+++ b/MediaBrowser.XbmcMetadata/Parsers/BaseNfoParser.cs@@ -85,7 +85,7 @@ namespace MediaBrowser.XbmcMetadata.Parsers/// <exception cref="ArgumentException"><c>metadataFile</c> is <c>null</c> or empty.</exception>public void Fetch(MetadataResult<T> item, string metadataFile, CancellationToken cancellationToken){- if (item.Item == null)+ if (item.Item is null){throw new ArgumentException("Item can't be null.", nameof(item));}@@ -880,7 +880,7 @@ namespace MediaBrowser.XbmcMetadata.Parsersvar fileSystemMetadata = _directoryService.GetFile(val);// non existing file returns null- if (fileSystemMetadata == null || !fileSystemMetadata.Exists)+ if (fileSystemMetadata is null || !fileSystemMetadata.Exists){Logger.LogWarning("Artwork file {Path} specified in nfo file for {ItemName} does not exist.", uri, itemResult.Item.Name);return;diff --git a/MediaBrowser.XbmcMetadata/Providers/BaseNfoProvider.cs b/MediaBrowser.XbmcMetadata/Providers/BaseNfoProvider.csindex abd3e78d76..af581fc5df 100644--- a/MediaBrowser.XbmcMetadata/Providers/BaseNfoProvider.cs+++ b/MediaBrowser.XbmcMetadata/Providers/BaseNfoProvider.cs@@ -33,7 +33,7 @@ namespace MediaBrowser.XbmcMetadata.Providersvar file = GetXmlFile(info, directoryService);- if (file == null)+ if (file is null){return Task.FromResult(result);}@@ -64,7 +64,7 @@ namespace MediaBrowser.XbmcMetadata.Providers{var file = GetXmlFile(new ItemInfo(item), directoryService);- if (file == null)+ if (file is null){return false;}diff --git a/MediaBrowser.XbmcMetadata/Savers/BaseNfoSaver.cs b/MediaBrowser.XbmcMetadata/Savers/BaseNfoSaver.csindex 740ca4c49b..9eae87b3b4 100644--- a/MediaBrowser.XbmcMetadata/Savers/BaseNfoSaver.cs+++ b/MediaBrowser.XbmcMetadata/Savers/BaseNfoSaver.cs@@ -855,7 +855,7 @@ namespace MediaBrowser.XbmcMetadata.Saversvar user = userManager.GetUserById(Guid.Parse(userId));- if (user == null)+ if (user is null){return;}diff --git a/src/Jellyfin.Extensions/AlphanumericComparator.cs b/src/Jellyfin.Extensions/AlphanumericComparator.csindex 98a32d5b20..1b19752bb3 100644--- a/src/Jellyfin.Extensions/AlphanumericComparator.cs+++ b/src/Jellyfin.Extensions/AlphanumericComparator.cs@@ -16,15 +16,15 @@ namespace Jellyfin.Extensions/// <returns>A signed integer that indicates the relative values of <c>x</c> and <c>y</c>.</returns>public static int CompareValues(string? s1, string? s2){- if (s1 == null && s2 == null)+ if (s1 is null && s2 is null){return 0;}- else if (s1 == null)+ else if (s1 is null){return -1;}- else if (s2 == null)+ else if (s2 is null){return 1;}diff --git a/tests/Jellyfin.Model.Tests/Dlna/StreamBuilderTests.cs b/tests/Jellyfin.Model.Tests/Dlna/StreamBuilderTests.csindex e1bd2fe0f3..a36c3b7c19 100644--- a/tests/Jellyfin.Model.Tests/Dlna/StreamBuilderTests.cs+++ b/tests/Jellyfin.Model.Tests/Dlna/StreamBuilderTests.cs@@ -472,7 +472,7 @@ namespace Jellyfin.Model.Tests}}}- else if (playMethod == null)+ else if (playMethod is null){Assert.Null(val.SubProtocol);Assert.Equal("stream", uri.Filename);diff --git a/tests/Jellyfin.Naming.Tests/Video/Format3DTests.cs b/tests/Jellyfin.Naming.Tests/Video/Format3DTests.csindex 1762b91b9d..511a014a60 100644--- a/tests/Jellyfin.Naming.Tests/Video/Format3DTests.cs+++ b/tests/Jellyfin.Naming.Tests/Video/Format3DTests.cs@@ -61,7 +61,7 @@ namespace Jellyfin.Naming.Tests.VideoAssert.Equal(is3D, result.Is3D);- if (format3D == null)+ if (format3D is null){Assert.Null(result?.Format3D);}diff --git a/tests/Jellyfin.Naming.Tests/Video/MultiVersionTests.cs b/tests/Jellyfin.Naming.Tests/Video/MultiVersionTests.csindex 79f2366b89..0ebcf5d81d 100644--- a/tests/Jellyfin.Naming.Tests/Video/MultiVersionTests.cs+++ b/tests/Jellyfin.Naming.Tests/Video/MultiVersionTests.cs@@ -25,7 +25,7 @@ namespace Jellyfin.Naming.Tests.Videofiles.Select(i => VideoResolver.Resolve(i, false, _namingOptions)).OfType<VideoFileInfo>().ToList(),_namingOptions).ToList();- Assert.Single(result.Where(v => v.ExtraType == null));+ Assert.Single(result.Where(v => v.ExtraType is null));Assert.Single(result.Where(v => v.ExtraType != null));}@@ -44,7 +44,7 @@ namespace Jellyfin.Naming.Tests.Videofiles.Select(i => VideoResolver.Resolve(i, false, _namingOptions)).OfType<VideoFileInfo>().ToList(),_namingOptions).ToList();- Assert.Single(result.Where(v => v.ExtraType == null));+ Assert.Single(result.Where(v => v.ExtraType is null));Assert.Single(result.Where(v => v.ExtraType != null));Assert.Equal(2, result[0].AlternateVersions.Count);}diff --git a/tests/Jellyfin.Providers.Tests/Manager/MetadataServiceTests.cs b/tests/Jellyfin.Providers.Tests/Manager/MetadataServiceTests.csindex 28b2e1d8f2..f94d6717bd 100644--- a/tests/Jellyfin.Providers.Tests/Manager/MetadataServiceTests.cs+++ b/tests/Jellyfin.Providers.Tests/Manager/MetadataServiceTests.cs@@ -328,11 +328,11 @@ namespace Jellyfin.Providers.Tests.ManagerPeople = oldValue};- var lockedFields = lockField == null ? Array.Empty<MetadataField>() : new[] { (MetadataField)lockField };+ var lockedFields = lockField is null ? Array.Empty<MetadataField>() : new[] { (MetadataField)lockField };MetadataService<Movie, MovieInfo>.MergeBaseItemData(source, target, lockedFields, replaceData, false);actualValue = target.People;- return newValue?.Equals(actualValue) ?? actualValue == null;+ return newValue?.Equals(actualValue) ?? actualValue is null;}/// <summary>@@ -367,12 +367,12 @@ namespace Jellyfin.Providers.Tests.Manager};property.SetValue(target.Item, oldValue);- var lockedFields = lockField == null ? Array.Empty<MetadataField>() : new[] { (MetadataField)lockField };+ var lockedFields = lockField is null ? Array.Empty<MetadataField>() : new[] { (MetadataField)lockField };// generic type doesn't actually matter to call the static method, just has to be filled inMetadataService<TItemType, TIdType>.MergeBaseItemData(source, target, lockedFields, replaceData, false);actualValue = property.GetValue(target.Item);- return newValue?.Equals(actualValue) ?? actualValue == null;+ return newValue?.Equals(actualValue) ?? actualValue is null;}}}diff --git a/tests/Jellyfin.Providers.Tests/Manager/ProviderManagerTests.cs b/tests/Jellyfin.Providers.Tests/Manager/ProviderManagerTests.csindex 725e295b9a..c1f2f5f711 100644--- a/tests/Jellyfin.Providers.Tests/Manager/ProviderManagerTests.cs+++ b/tests/Jellyfin.Providers.Tests/Manager/ProviderManagerTests.cs@@ -430,7 +430,7 @@ namespace Jellyfin.Providers.Tests.Manager.Returns((int)order);}- var provider = hasOrder == null+ var provider = hasOrder is null? new Mock<TProviderType>(MockBehavior.Strict): hasOrder.As<TProviderType>();provider.Setup(p => p.Name)@@ -473,12 +473,12 @@ namespace Jellyfin.Providers.Tests.ManagerMock<IHasOrder>? hasOrder = null;if (order != null){- hasOrder = forcedProvider == null ? new Mock<IHasOrder>() : forcedProvider.As<IHasOrder>();+ hasOrder = forcedProvider is null ? new Mock<IHasOrder>() : forcedProvider.As<IHasOrder>();hasOrder.Setup(i => i.Order).Returns((int)order);}- var provider = hasOrder == null+ var provider = hasOrder is null? new Mock<TProviderType>(MockBehavior.Strict): hasOrder.As<TProviderType>();provider.Setup(p => p.Name)diff --git a/tests/Jellyfin.Providers.Tests/MediaInfo/EmbeddedImageProviderTests.cs b/tests/Jellyfin.Providers.Tests/MediaInfo/EmbeddedImageProviderTests.csindex 9b80f0b948..6b2d9021c9 100644--- a/tests/Jellyfin.Providers.Tests/MediaInfo/EmbeddedImageProviderTests.cs+++ b/tests/Jellyfin.Providers.Tests/MediaInfo/EmbeddedImageProviderTests.cs@@ -80,7 +80,7 @@ namespace Jellyfin.Providers.Tests.MediaInfovar actual = await embeddedImageProvider.GetImage(input, type, CancellationToken.None);Assert.NotNull(actual);- if (expectedFormat == null)+ if (expectedFormat is null){Assert.False(actual.HasImage);}@@ -131,7 +131,7 @@ namespace Jellyfin.Providers.Tests.MediaInfovar actual = await embeddedImageProvider.GetImage(input, type, CancellationToken.None);Assert.NotNull(actual);- if (expectedFormat == null)+ if (expectedFormat is null){Assert.False(actual.HasImage);}diff --git a/tests/Jellyfin.Server.Implementations.Tests/TypedBaseItem/BaseItemKindTests.cs b/tests/Jellyfin.Server.Implementations.Tests/TypedBaseItem/BaseItemKindTests.csindex 31f33c6825..1bd51b2468 100644--- a/tests/Jellyfin.Server.Implementations.Tests/TypedBaseItem/BaseItemKindTests.cs+++ b/tests/Jellyfin.Server.Implementations.Tests/TypedBaseItem/BaseItemKindTests.cs@@ -50,7 +50,7 @@ namespace Jellyfin.Server.Implementations.Tests.TypedBaseItemprivate static bool IsProjectAssemblyName(string? name){- if (name == null)+ if (name is null){return false;}