aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations
diff options
context:
space:
mode:
authorBond_009 <bond.009@outlook.com>2022-12-05 15:00:20 +0100
committerBond_009 <bond.009@outlook.com>2022-12-05 15:00:20 +0100
commitc7d50d640e614a3c13699e3041fbfcb258861c5a (patch)
tree85ce1a16c1af479160b805ec098463ae457b5228 /Emby.Server.Implementations
parentb2def4c9ea6cf5e406bf5f865867d6cb5b54f640 (diff)
Replace == null with is null
Diffstat (limited to 'Emby.Server.Implementations')
-rw-r--r--Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs4
-rw-r--r--Emby.Server.Implementations/AppBase/ConfigurationHelper.cs2
-rw-r--r--Emby.Server.Implementations/Channels/ChannelManager.cs16
-rw-r--r--Emby.Server.Implementations/Collections/CollectionManager.cs8
-rw-r--r--Emby.Server.Implementations/Data/SqliteExtensions.cs2
-rw-r--r--Emby.Server.Implementations/Data/SqliteItemRepository.cs18
-rw-r--r--Emby.Server.Implementations/Dto/DtoService.cs16
-rw-r--r--Emby.Server.Implementations/EntryPoints/LibraryChangedNotifier.cs6
-rw-r--r--Emby.Server.Implementations/EntryPoints/UserDataChangeNotifier.cs2
-rw-r--r--Emby.Server.Implementations/HttpServer/WebSocketConnection.cs4
-rw-r--r--Emby.Server.Implementations/IO/FileRefresher.cs6
-rw-r--r--Emby.Server.Implementations/Library/LibraryManager.cs46
-rw-r--r--Emby.Server.Implementations/Library/LiveStreamHelper.cs4
-rw-r--r--Emby.Server.Implementations/Library/MediaSourceManager.cs14
-rw-r--r--Emby.Server.Implementations/Library/ResolverHelper.cs2
-rw-r--r--Emby.Server.Implementations/Library/Resolvers/Audio/AudioResolver.cs4
-rw-r--r--Emby.Server.Implementations/Library/Resolvers/BaseVideoResolver.cs4
-rw-r--r--Emby.Server.Implementations/Library/Resolvers/ExtraResolver.cs2
-rw-r--r--Emby.Server.Implementations/Library/Resolvers/GenericFolderResolver.cs2
-rw-r--r--Emby.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs8
-rw-r--r--Emby.Server.Implementations/Library/Resolvers/TV/EpisodeResolver.cs6
-rw-r--r--Emby.Server.Implementations/Library/UserViewManager.cs4
-rw-r--r--Emby.Server.Implementations/Library/Validators/CollectionPostScanTask.cs2
-rw-r--r--Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs22
-rw-r--r--Emby.Server.Implementations/LiveTv/EmbyTV/ItemDataProvider.cs2
-rw-r--r--Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs12
-rw-r--r--Emby.Server.Implementations/LiveTv/Listings/XmlTvListingsProvider.cs2
-rw-r--r--Emby.Server.Implementations/LiveTv/LiveTvDtoService.cs8
-rw-r--r--Emby.Server.Implementations/LiveTv/LiveTvManager.cs22
-rw-r--r--Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs2
-rw-r--r--Emby.Server.Implementations/Localization/LocalizationManager.cs4
-rw-r--r--Emby.Server.Implementations/Playlists/PlaylistManager.cs4
-rw-r--r--Emby.Server.Implementations/Playlists/PlaylistsFolder.cs2
-rw-r--r--Emby.Server.Implementations/Plugins/PluginManager.cs10
-rw-r--r--Emby.Server.Implementations/ScheduledTasks/ScheduledTaskWorker.cs2
-rw-r--r--Emby.Server.Implementations/ScheduledTasks/TaskManager.cs6
-rw-r--r--Emby.Server.Implementations/ScheduledTasks/Triggers/IntervalTrigger.cs2
-rw-r--r--Emby.Server.Implementations/Session/SessionManager.cs32
-rw-r--r--Emby.Server.Implementations/Session/SessionWebSocketListener.cs2
-rw-r--r--Emby.Server.Implementations/Session/WebSocketController.cs2
-rw-r--r--Emby.Server.Implementations/Sorting/AiredEpisodeOrderComparer.cs6
-rw-r--r--Emby.Server.Implementations/Sorting/PlayCountComparer.cs2
-rw-r--r--Emby.Server.Implementations/Sorting/PremiereDateComparer.cs2
-rw-r--r--Emby.Server.Implementations/Sorting/ProductionYearComparer.cs2
-rw-r--r--Emby.Server.Implementations/SyncPlay/Group.cs4
-rw-r--r--Emby.Server.Implementations/SyncPlay/SyncPlayManager.cs22
-rw-r--r--Emby.Server.Implementations/TV/TVSeriesManager.cs4
-rw-r--r--Emby.Server.Implementations/Updates/InstallationManager.cs8
48 files changed, 184 insertions, 184 deletions
diff --git a/Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs b/Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs
index 26b4649dd..5876c9b4c 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.AppBase
configurationManager._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.cs
index f923e59ef..1c8477605 100644
--- a/Emby.Server.Implementations/AppBase/ConfigurationHelper.cs
+++ b/Emby.Server.Implementations/AppBase/ConfigurationHelper.cs
@@ -43,7 +43,7 @@ namespace Emby.Server.Implementations.AppBase
Span<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.cs
index 6837cce5c..d7eb7e3ac 100644
--- a/Emby.Server.Implementations/Channels/ChannelManager.cs
+++ b/Emby.Server.Implementations/Channels/ChannelManager.cs
@@ -129,7 +129,7 @@ namespace Emby.Server.Implementations.Channels
public 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.Channels
if (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.Channels
var item = _libraryManager.GetItemById(id) as Channel;
- if (item == null)
+ if (item is null)
{
item = new Channel
{
@@ -861,7 +861,7 @@ namespace Emby.Server.Implementations.Channels
var 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.Channels
var 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.Channels
var 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.cs
index 187e0c9b3..701c7b61d 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.Collections
var 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.Collections
var 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.cs
index 736b8125d..4055b0ba1 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.cs
index 9d44fd9d1..36fdfc8f2 100644
--- a/Emby.Server.Implementations/Data/SqliteItemRepository.cs
+++ b/Emby.Server.Implementations/Data/SqliteItemRepository.cs
@@ -691,7 +691,7 @@ namespace Emby.Server.Implementations.Data
private string GetPathToSave(string path)
{
- if (path == null)
+ if (path is null)
{
return null;
}
@@ -890,7 +890,7 @@ namespace Emby.Server.Implementations.Data
saveItemStatement.TryBind("@UnratedType", item.GetBlockUnratedType().ToString());
- if (topParent == null)
+ if (topParent is null)
{
saveItemStatement.TryBindNull("@TopParentId");
}
@@ -1414,7 +1414,7 @@ namespace Emby.Server.Implementations.Data
var 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.Data
private 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.Data
if (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.Data
return 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.cs
index f6d37421a..e0e3366b4 100644
--- a/Emby.Server.Implementations/Dto/DtoService.cs
+++ b/Emby.Server.Implementations/Dto/DtoService.cs
@@ -235,14 +235,14 @@ namespace Emby.Server.Implementations.Dto
if (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.Dto
return 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.Dto
if (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.Dto
if (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.Dto
var 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.cs
index d5e4a636e..fb6f52332 100644
--- a/Emby.Server.Implementations/EntryPoints/LibraryChangedNotifier.cs
+++ b/Emby.Server.Implementations/EntryPoints/LibraryChangedNotifier.cs
@@ -191,7 +191,7 @@ namespace Emby.Server.Implementations.EntryPoints
lock (_libraryChangedSyncLock)
{
- if (LibraryUpdateTimer == null)
+ if (LibraryUpdateTimer is null)
{
LibraryUpdateTimer = new Timer(
LibraryUpdateTimerCallback,
@@ -227,7 +227,7 @@ namespace Emby.Server.Implementations.EntryPoints
lock (_libraryChangedSyncLock)
{
- if (LibraryUpdateTimer == null)
+ if (LibraryUpdateTimer is null)
{
LibraryUpdateTimer = new Timer(LibraryUpdateTimerCallback, null, LibraryUpdateDuration, Timeout.Infinite);
}
@@ -254,7 +254,7 @@ namespace Emby.Server.Implementations.EntryPoints
lock (_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.cs
index 82c8d3ab6..ce81f9e42 100644
--- a/Emby.Server.Implementations/EntryPoints/UserDataChangeNotifier.cs
+++ b/Emby.Server.Implementations/EntryPoints/UserDataChangeNotifier.cs
@@ -51,7 +51,7 @@ namespace Emby.Server.Implementations.EntryPoints
lock (_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.cs
index d095248fa..b1a99853a 100644
--- a/Emby.Server.Implementations/HttpServer/WebSocketConnection.cs
+++ b/Emby.Server.Implementations/HttpServer/WebSocketConnection.cs
@@ -164,7 +164,7 @@ namespace Emby.Server.Implementations.HttpServer
ReadResult 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 consumed
reader.AdvanceTo(buffer.End);
@@ -185,7 +185,7 @@ namespace Emby.Server.Implementations.HttpServer
return;
}
- 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.cs
index 6326208f7..6337952c1 100644
--- a/Emby.Server.Implementations/IO/FileRefresher.cs
+++ b/Emby.Server.Implementations/IO/FileRefresher.cs
@@ -80,7 +80,7 @@ namespace Emby.Server.Implementations.IO
return;
}
- 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.cs
index b688af528..e8f6d2d23 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.Library
if (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.Library
public 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.Library
var 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 Id
video = 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 video
video = 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.Library
foreach (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.Library
item = 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.Library
item = 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.Library
private string GetTopFolderContentType(BaseItem item)
{
- if (item == null)
+ if (item is null)
{
return null;
}
@@ -2137,7 +2137,7 @@ namespace Emby.Server.Implementations.Library
while (!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.Library
var 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.Library
var isNew = false;
- if (item == null)
+ if (item is null)
{
Directory.CreateDirectory(path);
@@ -2289,7 +2289,7 @@ namespace Emby.Server.Implementations.Library
var isNew = false;
- if (item == null)
+ if (item is null)
{
Directory.CreateDirectory(path);
@@ -2362,7 +2362,7 @@ namespace Emby.Server.Implementations.Library
var isNew = false;
- if (item == null)
+ if (item is null)
{
Directory.CreateDirectory(path);
@@ -2459,7 +2459,7 @@ namespace Emby.Server.Implementations.Library
episodeInfo = resolver.Resolve(episode.Path, isFolder, null, null, isAbsoluteNaming);
// Resolve from parent folder if it's not the Season folder
var 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.Library
public 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.cs
index 20624cc7a..101033551 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.Library
var 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.cs
index bfccc7db7..e2474f508 100644
--- a/Emby.Server.Implementations/Library/MediaSourceManager.cs
+++ b/Emby.Server.Implementations/Library/MediaSourceManager.cs
@@ -383,7 +383,7 @@ namespace Emby.Server.Implementations.Library
var 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.Library
public 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.Library
var 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.Library
var 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.cs
index 4100a74a5..590d37b92 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 values
var 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.cs
index 7a6aea9c1..bc1f5d08a 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 music
if (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 here
var 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.cs
index b2a7abb1b..cb377136a 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.Resolvers
videoType = VideoType.Dvd;
}
- if (videoType == null)
+ if (videoType is null)
{
continue;
}
@@ -93,7 +93,7 @@ namespace Emby.Server.Implementations.Library.Resolvers
videoInfo = 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.cs
index 408e640f9..30c52e19d 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.Resolvers
public 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.cs
index 079962282..1c2de912a 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.cs
index 84d4688af..6b18ad237 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.Movies
if (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.Movies
if (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.cs
index 9ba079edf..2e2b79341 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.TV
var 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.cs
index ec411aa3b..c294a63db 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 media
var 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.cs
index 88b93a211..df45793c3 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.Validators
try
{
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 it
if (movieIds.Count >= 2)
diff --git a/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs
index cf9be5a54..2f4854a6d 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.EmbyTV
programInfo = 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.EmbyTV
var 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.EmbyTV
programInfo = 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.EmbyTV
var 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.EmbyTV
var 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.cs
index 58b798ce6..80e3e5233 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.cs
index b981ad81a..69670e811 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.Listings
using 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.Listings
using 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.Listings
private 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.Listings
EpisodeTitle = 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.Listings
using 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.cs
index 264eec947..1b72a44b4 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.Listings
HasImage = !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.cs
index c09f9cf8d..a92b473b5 100644
--- a/Emby.Server.Implementations/LiveTv/LiveTvDtoService.cs
+++ b/Emby.Server.Implementations/LiveTv/LiveTvDtoService.cs
@@ -150,7 +150,7 @@ namespace Emby.Server.Implementations.LiveTv
dto.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.LiveTv
DtoOptions = 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.cs
index 97c2e6e30..ea26a2227 100644
--- a/Emby.Server.Implementations/LiveTv/LiveTvManager.cs
+++ b/Emby.Server.Implementations/LiveTv/LiveTvManager.cs
@@ -434,7 +434,7 @@ namespace Emby.Server.Implementations.LiveTv
var item = _libraryManager.GetItemById(id) as LiveTvChannel;
- if (item == null)
+ if (item is null)
{
item = new LiveTvChannel
{
@@ -948,7 +948,7 @@ namespace Emby.Server.Implementations.LiveTv
var channel = _libraryManager.GetItemById(program.ChannelId);
- if (channel == null)
+ if (channel is null)
{
return score;
}
@@ -1314,7 +1314,7 @@ namespace Emby.Server.Implementations.LiveTv
private 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.LiveTv
var 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.LiveTv
var 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.LiveTv
var 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.LiveTv
var 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.cs
index e0eaa8e58..04d64e500 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.HdHomerun
var 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.cs
index b77168126..8f15a155e 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.cs
index 9e7035cb3..d8d4629c1 100644
--- a/Emby.Server.Implementations/Playlists/PlaylistManager.cs
+++ b/Emby.Server.Implementations/Playlists/PlaylistManager.cs
@@ -70,7 +70,7 @@ namespace Emby.Server.Implementations.Playlists
var 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.cs
index 8ec9f6161..e2f2e436f 100644
--- a/Emby.Server.Implementations/Playlists/PlaylistsFolder.cs
+++ b/Emby.Server.Implementations/Playlists/PlaylistsFolder.cs
@@ -39,7 +39,7 @@ namespace Emby.Server.Implementations.Playlists
protected 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.cs
index 3f7d46822..c1a38d23c 100644
--- a/Emby.Server.Implementations/Plugins/PluginManager.cs
+++ b/Emby.Server.Implementations/Plugins/PluginManager.cs
@@ -174,7 +174,7 @@ namespace Emby.Server.Implementations.Plugins
foreach (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.Plugins
ArgumentNullException.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 plugins
var 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.cs
index b370e06ef..25515f778 100644
--- a/Emby.Server.Implementations/ScheduledTasks/ScheduledTaskWorker.cs
+++ b/Emby.Server.Implementations/ScheduledTasks/ScheduledTaskWorker.cs
@@ -128,7 +128,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
lock (_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.cs
index 0431858fc..63f0beb10 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.cs
index 3eb800199..e9b8a8257 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.Triggers
DateTime triggerDate;
- if (lastResult == null)
+ if (lastResult is null)
{
// Task has never been completed before
triggerDate = DateTime.UtcNow.AddHours(1);
diff --git a/Emby.Server.Implementations/Session/SessionManager.cs b/Emby.Server.Implementations/Session/SessionManager.cs
index 0d1029882..a1e3b9dbd 100644
--- a/Emby.Server.Implementations/Session/SessionManager.cs
+++ b/Emby.Server.Implementations/Session/SessionManager.cs
@@ -377,11 +377,11 @@ namespace Emby.Server.Implementations.Session
info.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.Session
sessionInfo.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.Session
sessionInfo.ApplicationVersion = appVersion;
- if (user == null)
+ if (user is null)
{
sessionInfo.AdditionalUsers = Array.Empty<SessionUserInfo>();
}
@@ -536,7 +536,7 @@ namespace Emby.Server.Implementations.Session
sessionInfo.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.Session
var 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.Session
await 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.Session
info.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.Session
private 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 id
var 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.Session
true).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.Session
foreach (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.Session
var 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.cs
index c654828b1..bab934578 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 watcher
diff --git a/Emby.Server.Implementations/Session/WebSocketController.cs b/Emby.Server.Implementations/Session/WebSocketController.cs
index 1f3248f07..051fa5b3c 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.cs
index 2d21bd9c2..964004ecc 100644
--- a/Emby.Server.Implementations/Sorting/AiredEpisodeOrderComparer.cs
+++ b/Emby.Server.Implementations/Sorting/AiredEpisodeOrderComparer.cs
@@ -31,9 +31,9 @@ namespace Emby.Server.Implementations.Sorting
var 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.Sorting
return 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.cs
index 45c9044c5..16f1b79b3 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.cs
index b217556ef..db86b8002 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.cs
index d2022df7a..7fd1e024d 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.cs
index 52becfec6..ef2a4ef77 100644
--- a/Emby.Server.Implementations/SyncPlay/Group.cs
+++ b/Emby.Server.Implementations/SyncPlay/Group.cs
@@ -197,7 +197,7 @@ namespace Emby.Server.Implementations.SyncPlay
private 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.SyncPlay
private 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.cs
index 53e3b3577..63c4a1556 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.cs
index 5c9b9df15..57fa57c59 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.cs
index 550f0e075..84489b646 100644
--- a/Emby.Server.Implementations/Updates/InstallationManager.cs
+++ b/Emby.Server.Implementations/Updates/InstallationManager.cs
@@ -102,7 +102,7 @@ namespace Emby.Server.Implementations.Updates
PackageInfo[]? 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.Updates
var 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;
}