mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-05-31 21:08:27 +01:00
Replace != null with is not null
This commit is contained in:
@@ -138,7 +138,7 @@ namespace Emby.Server.Implementations.IO
|
||||
IEnumerable<BaseItem> itemsToRefresh = paths
|
||||
.Distinct(StringComparer.OrdinalIgnoreCase)
|
||||
.Select(GetAffectedBaseItem)
|
||||
.Where(item => item != null)
|
||||
.Where(item => item is not null)
|
||||
.GroupBy(x => x!.Id) // Removed null values in the previous .Where()
|
||||
.Select(x => x.First())!;
|
||||
|
||||
@@ -185,7 +185,7 @@ namespace Emby.Server.Implementations.IO
|
||||
path = System.IO.Path.GetDirectoryName(path) ?? string.Empty;
|
||||
}
|
||||
|
||||
if (item != null)
|
||||
if (item is not null)
|
||||
{
|
||||
// If the item has been deleted find the first valid parent that still exists
|
||||
while (!Directory.Exists(item.Path) && !File.Exists(item.Path))
|
||||
@@ -206,7 +206,7 @@ namespace Emby.Server.Implementations.IO
|
||||
{
|
||||
lock (_timerLock)
|
||||
{
|
||||
if (_timer != null)
|
||||
if (_timer is not null)
|
||||
{
|
||||
_timer.Dispose();
|
||||
_timer = null;
|
||||
|
||||
@@ -115,7 +115,7 @@ namespace Emby.Server.Implementations.IO
|
||||
|
||||
var options = _libraryManager.GetLibraryOptions(item);
|
||||
|
||||
if (options != null)
|
||||
if (options is not null)
|
||||
{
|
||||
return options.EnableRealtimeMonitor;
|
||||
}
|
||||
|
||||
@@ -149,7 +149,7 @@ namespace Emby.Server.Implementations.IO
|
||||
var extension = Path.GetExtension(shortcutPath);
|
||||
var handler = _shortcutHandlers.Find(i => string.Equals(extension, i.Extension, StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
if (handler != null)
|
||||
if (handler is not null)
|
||||
{
|
||||
handler.Create(shortcutPath, target);
|
||||
}
|
||||
@@ -621,14 +621,14 @@ namespace Emby.Server.Implementations.IO
|
||||
|
||||
// On linux and osx the search pattern is case sensitive
|
||||
// If we're OK with case-sensitivity, and we're only filtering for one extension, then use the native method
|
||||
if ((enableCaseSensitiveExtensions || _isEnvironmentCaseInsensitive) && extensions != null && extensions.Count == 1)
|
||||
if ((enableCaseSensitiveExtensions || _isEnvironmentCaseInsensitive) && extensions is not null && extensions.Count == 1)
|
||||
{
|
||||
return ToMetadata(new DirectoryInfo(path).EnumerateFiles("*" + extensions[0], enumerationOptions));
|
||||
}
|
||||
|
||||
var files = new DirectoryInfo(path).EnumerateFiles("*", enumerationOptions);
|
||||
|
||||
if (extensions != null && extensions.Count > 0)
|
||||
if (extensions is not null && extensions.Count > 0)
|
||||
{
|
||||
files = files.Where(i =>
|
||||
{
|
||||
@@ -678,14 +678,14 @@ namespace Emby.Server.Implementations.IO
|
||||
|
||||
// On linux and osx the search pattern is case sensitive
|
||||
// If we're OK with case-sensitivity, and we're only filtering for one extension, then use the native method
|
||||
if ((enableCaseSensitiveExtensions || _isEnvironmentCaseInsensitive) && extensions != null && extensions.Length == 1)
|
||||
if ((enableCaseSensitiveExtensions || _isEnvironmentCaseInsensitive) && extensions is not null && extensions.Length == 1)
|
||||
{
|
||||
return Directory.EnumerateFiles(path, "*" + extensions[0], enumerationOptions);
|
||||
}
|
||||
|
||||
var files = Directory.EnumerateFiles(path, "*", enumerationOptions);
|
||||
|
||||
if (extensions != null && extensions.Length > 0)
|
||||
if (extensions is not null && extensions.Length > 0)
|
||||
{
|
||||
files = files.Where(i =>
|
||||
{
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace Emby.Server.Implementations.IO
|
||||
|
||||
await destination.WriteAsync(buffer.AsMemory(0, read), cancellationToken).ConfigureAwait(false);
|
||||
|
||||
if (onStarted != null)
|
||||
if (onStarted is not null)
|
||||
{
|
||||
onStarted();
|
||||
onStarted = null;
|
||||
|
||||
Reference in New Issue
Block a user