== null -> is null

pull/10141/head
Bond_009 9 months ago
parent d92e9ae85e
commit 18a311d32f

@ -1006,7 +1006,7 @@ namespace Emby.Server.Implementations
if (ConfigurationManager.GetNetworkConfiguration().EnablePublishedServerUriByRequest) if (ConfigurationManager.GetNetworkConfiguration().EnablePublishedServerUriByRequest)
{ {
int? requestPort = request.Host.Port; int? requestPort = request.Host.Port;
if (requestPort == null if (requestPort is null
|| (requestPort == 80 && string.Equals(request.Scheme, "http", StringComparison.OrdinalIgnoreCase)) || (requestPort == 80 && string.Equals(request.Scheme, "http", StringComparison.OrdinalIgnoreCase))
|| (requestPort == 443 && string.Equals(request.Scheme, "https", StringComparison.OrdinalIgnoreCase))) || (requestPort == 443 && string.Equals(request.Scheme, "https", StringComparison.OrdinalIgnoreCase)))
{ {
@ -1190,7 +1190,7 @@ namespace Emby.Server.Implementations
} }
} }
if (_sessionManager != null) if (_sessionManager is not null)
{ {
// used for closing websockets // used for closing websockets
foreach (var session in _sessionManager.Sessions) foreach (var session in _sessionManager.Sessions)

@ -693,7 +693,7 @@ public class DynamicHlsHelper
// Currently we only transcode to 8 bits AV1 // Currently we only transcode to 8 bits AV1
int bitDepth = 8; int bitDepth = 8;
if (EncodingHelper.IsCopyCodec(state.OutputVideoCodec) if (EncodingHelper.IsCopyCodec(state.OutputVideoCodec)
&& state.VideoStream != null && state.VideoStream is not null
&& state.VideoStream.BitDepth.HasValue) && state.VideoStream.BitDepth.HasValue)
{ {
bitDepth = state.VideoStream.BitDepth.Value; bitDepth = state.VideoStream.BitDepth.Value;

@ -77,7 +77,7 @@ public class CommaDelimitedArrayModelBinder : IModelBinder
var typedValueIndex = 0; var typedValueIndex = 0;
for (var i = 0; i < parsedValues.Length; i++) for (var i = 0; i < parsedValues.Length; i++)
{ {
if (parsedValues[i] != null) if (parsedValues[i] is not null)
{ {
typedValues.SetValue(parsedValues[i], typedValueIndex); typedValues.SetValue(parsedValues[i], typedValueIndex);
typedValueIndex++; typedValueIndex++;

@ -77,7 +77,7 @@ public class PipeDelimitedArrayModelBinder : IModelBinder
var typedValueIndex = 0; var typedValueIndex = 0;
for (var i = 0; i < parsedValues.Length; i++) for (var i = 0; i < parsedValues.Length; i++)
{ {
if (parsedValues[i] != null) if (parsedValues[i] is not null)
{ {
typedValues.SetValue(parsedValues[i], typedValueIndex); typedValues.SetValue(parsedValues[i], typedValueIndex);
typedValueIndex++; typedValueIndex++;

@ -276,7 +276,7 @@ namespace Jellyfin.Server.Extensions
} }
else if (NetworkExtensions.TryParseToSubnet(allowedProxies[i], out var subnet)) else if (NetworkExtensions.TryParseToSubnet(allowedProxies[i], out var subnet))
{ {
if (subnet != null) if (subnet is not null)
{ {
AddIPAddress(config, options, subnet.Prefix, subnet.PrefixLength); AddIPAddress(config, options, subnet.Prefix, subnet.PrefixLength);
} }

@ -1864,7 +1864,7 @@ namespace MediaBrowser.Controller.Entities
/// <exception cref="ArgumentException">Backdrops should be accessed using Item.Backdrops.</exception> /// <exception cref="ArgumentException">Backdrops should be accessed using Item.Backdrops.</exception>
public bool HasImage(ImageType type, int imageIndex) public bool HasImage(ImageType type, int imageIndex)
{ {
return GetImageInfo(type, imageIndex) != null; return GetImageInfo(type, imageIndex) is not null;
} }
public void SetImage(ItemImageInfo image, int index) public void SetImage(ItemImageInfo image, int index)

@ -99,7 +99,7 @@ namespace MediaBrowser.Controller.Entities.TV
} }
[JsonIgnore] [JsonIgnore]
public bool IsInSeasonFolder => FindParent<Season>() != null; public bool IsInSeasonFolder => FindParent<Season>() is not null;
[JsonIgnore] [JsonIgnore]
public string SeriesPresentationUniqueKey { get; set; } public string SeriesPresentationUniqueKey { get; set; }

@ -333,7 +333,7 @@ namespace MediaBrowser.Controller.Entities
protected override bool IsActiveRecording() protected override bool IsActiveRecording()
{ {
return LiveTvManager.GetActiveRecordingInfo(Path) != null; return LiveTvManager.GetActiveRecordingInfo(Path) is not null;
} }
public override bool CanDelete() public override bool CanDelete()

@ -217,7 +217,7 @@ namespace MediaBrowser.Controller.Library
/// <returns><c>true</c> if [contains file system entry by name] [the specified name]; otherwise, <c>false</c>.</returns> /// <returns><c>true</c> if [contains file system entry by name] [the specified name]; otherwise, <c>false</c>.</returns>
public bool ContainsFileSystemEntryByName(string name) public bool ContainsFileSystemEntryByName(string name)
{ {
return GetFileSystemEntryByName(name) != null; return GetFileSystemEntryByName(name) is not null;
} }
public string GetCollectionType() public string GetCollectionType()

@ -2692,7 +2692,7 @@ namespace MediaBrowser.Controller.MediaEncoding
string args = string.Empty; string args = string.Empty;
// http://ffmpeg.org/ffmpeg-all.html#toc-Complex-filtergraphs-1 // http://ffmpeg.org/ffmpeg-all.html#toc-Complex-filtergraphs-1
if (state.VideoStream != null && videoProcessFilters.Contains("-filter_complex", StringComparison.Ordinal)) if (state.VideoStream is not null && videoProcessFilters.Contains("-filter_complex", StringComparison.Ordinal))
{ {
int videoStreamIndex = FindIndex(state.MediaSource.MediaStreams, state.VideoStream); int videoStreamIndex = FindIndex(state.MediaSource.MediaStreams, state.VideoStream);

@ -135,7 +135,7 @@ namespace MediaBrowser.Model.Dlna
} }
} }
if (transcodingProfile != null) if (transcodingProfile is not null)
{ {
if (!item.SupportsTranscoding) if (!item.SupportsTranscoding)
{ {
@ -759,7 +759,7 @@ namespace MediaBrowser.Model.Dlna
{ {
// prefer direct copy profile // prefer direct copy profile
float videoFramerate = videoStream?.AverageFrameRate ?? videoStream?.RealFrameRate ?? 0; float videoFramerate = videoStream?.AverageFrameRate ?? videoStream?.RealFrameRate ?? 0;
TransportStreamTimestamp? timestamp = videoStream == null ? TransportStreamTimestamp.None : item.Timestamp; TransportStreamTimestamp? timestamp = videoStream is null ? TransportStreamTimestamp.None : item.Timestamp;
int? numAudioStreams = item.GetStreamCount(MediaStreamType.Audio); int? numAudioStreams = item.GetStreamCount(MediaStreamType.Audio);
int? numVideoStreams = item.GetStreamCount(MediaStreamType.Video); int? numVideoStreams = item.GetStreamCount(MediaStreamType.Video);

@ -128,7 +128,7 @@ namespace MediaBrowser.Providers.MediaInfo
var m2ts = _mediaEncoder.GetPrimaryPlaylistM2tsFiles(item.Path); var m2ts = _mediaEncoder.GetPrimaryPlaylistM2tsFiles(item.Path);
// Return if no playable .m2ts files are found // Return if no playable .m2ts files are found
if (blurayDiscInfo == null || blurayDiscInfo.Files.Length == 0 || m2ts.Count == 0) if (blurayDiscInfo is null || blurayDiscInfo.Files.Length == 0 || m2ts.Count == 0)
{ {
_logger.LogError("No playable .m2ts files found in Blu-ray structure, skipping FFprobe."); _logger.LogError("No playable .m2ts files found in Blu-ray structure, skipping FFprobe.");
return ItemUpdateType.MetadataImport; return ItemUpdateType.MetadataImport;

@ -59,7 +59,7 @@ namespace Jellyfin.Extensions.Json.Converters
var typedValueIndex = 0; var typedValueIndex = 0;
for (var i = 0; i < stringEntries.Length; i++) for (var i = 0; i < stringEntries.Length; i++)
{ {
if (parsedValues[i] != null) if (parsedValues[i] is not null)
{ {
typedValues.SetValue(parsedValues[i], typedValueIndex); typedValues.SetValue(parsedValues[i], typedValueIndex);
typedValueIndex++; typedValueIndex++;

@ -40,7 +40,7 @@ namespace Jellyfin.Extensions
public static IEnumerable<string> ReadAllLines(this TextReader reader) public static IEnumerable<string> ReadAllLines(this TextReader reader)
{ {
string? line; string? line;
while ((line = reader.ReadLine()) != null) while ((line = reader.ReadLine()) is not null)
{ {
yield return line; yield return line;
} }
@ -54,7 +54,7 @@ namespace Jellyfin.Extensions
public static async IAsyncEnumerable<string> ReadAllLinesAsync(this TextReader reader) public static async IAsyncEnumerable<string> ReadAllLinesAsync(this TextReader reader)
{ {
string? line; string? line;
while ((line = await reader.ReadLineAsync().ConfigureAwait(false)) != null) while ((line = await reader.ReadLineAsync().ConfigureAwait(false)) is not null)
{ {
yield return line; yield return line;
} }

Loading…
Cancel
Save