aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/IO/FileRefresher.cs
diff options
context:
space:
mode:
authorShadowghost <Ghost_of_Stone@web.de>2022-12-07 17:40:24 +0100
committerShadowghost <Ghost_of_Stone@web.de>2022-12-07 17:40:24 +0100
commit2c86bd1875e6e85d5867618e992d850453dae663 (patch)
tree671070fb246fd3821bf6f1e58a01c402a2f969d1 /Emby.Server.Implementations/IO/FileRefresher.cs
parentdd5f90802e71083347b6095eb79a9de0b9d34615 (diff)
parent3cb7fe50127b1a8158186b390836ee25ae5a50fd (diff)
Merge branch 'master' into network-rewrite
Diffstat (limited to 'Emby.Server.Implementations/IO/FileRefresher.cs')
-rw-r--r--Emby.Server.Implementations/IO/FileRefresher.cs22
1 files changed, 8 insertions, 14 deletions
diff --git a/Emby.Server.Implementations/IO/FileRefresher.cs b/Emby.Server.Implementations/IO/FileRefresher.cs
index 6326208f7..ec8590929 100644
--- a/Emby.Server.Implementations/IO/FileRefresher.cs
+++ b/Emby.Server.Implementations/IO/FileRefresher.cs
@@ -40,10 +40,7 @@ namespace Emby.Server.Implementations.IO
private void AddAffectedPath(string path)
{
- if (string.IsNullOrEmpty(path))
- {
- throw new ArgumentNullException(nameof(path));
- }
+ ArgumentException.ThrowIfNullOrEmpty(path);
if (!_affectedPaths.Contains(path, StringComparer.Ordinal))
{
@@ -53,10 +50,7 @@ namespace Emby.Server.Implementations.IO
public void AddPath(string path)
{
- if (string.IsNullOrEmpty(path))
- {
- throw new ArgumentNullException(nameof(path));
- }
+ ArgumentException.ThrowIfNullOrEmpty(path);
lock (_timerLock)
{
@@ -80,7 +74,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));
}
@@ -138,7 +132,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())!;
@@ -178,21 +172,21 @@ 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);
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))
{
item = item.GetOwner() ?? item.GetParent();
- if (item == null)
+ if (item is null)
{
break;
}
@@ -206,7 +200,7 @@ namespace Emby.Server.Implementations.IO
{
lock (_timerLock)
{
- if (_timer != null)
+ if (_timer is not null)
{
_timer.Dispose();
_timer = null;