aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/IO
diff options
context:
space:
mode:
Diffstat (limited to 'Emby.Server.Implementations/IO')
-rw-r--r--Emby.Server.Implementations/IO/FileRefresher.cs16
-rw-r--r--Emby.Server.Implementations/IO/LibraryMonitor.cs28
-rw-r--r--Emby.Server.Implementations/IO/ManagedFileSystem.cs8
-rw-r--r--Emby.Server.Implementations/IO/SharpCifs/Config.cs2
-rw-r--r--Emby.Server.Implementations/IO/SharpCifs/Dcerpc/DcerpcHandle.cs2
-rw-r--r--Emby.Server.Implementations/IO/SharpCifs/Netbios/Name.cs2
-rw-r--r--Emby.Server.Implementations/IO/SharpCifs/Netbios/NameServiceClient.cs8
-rw-r--r--Emby.Server.Implementations/IO/SharpCifs/Smb/NtlmContext.cs2
-rw-r--r--Emby.Server.Implementations/IO/SharpCifs/Smb/SmbFile.cs20
-rw-r--r--Emby.Server.Implementations/IO/StreamHelper.cs2
10 files changed, 37 insertions, 53 deletions
diff --git a/Emby.Server.Implementations/IO/FileRefresher.cs b/Emby.Server.Implementations/IO/FileRefresher.cs
index 4be30f8b7..df484d04c 100644
--- a/Emby.Server.Implementations/IO/FileRefresher.cs
+++ b/Emby.Server.Implementations/IO/FileRefresher.cs
@@ -12,7 +12,7 @@ using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.IO;
using MediaBrowser.Controller.Library;
using MediaBrowser.Model.Extensions;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using MediaBrowser.Model.System;
using MediaBrowser.Model.Tasks;
using MediaBrowser.Model.Threading;
@@ -38,7 +38,7 @@ namespace Emby.Server.Implementations.IO
public FileRefresher(string path, IFileSystem fileSystem, IServerConfigurationManager configurationManager, ILibraryManager libraryManager, ITaskManager taskManager, ILogger logger, ITimerFactory timerFactory, IEnvironmentInfo environmentInfo, ILibraryManager libraryManager1)
{
- logger.Debug("New file refresher created for {0}", path);
+ logger.LogDebug("New file refresher created for {0}", path);
Path = path;
_fileSystem = fileSystem;
@@ -108,7 +108,7 @@ namespace Emby.Server.Implementations.IO
{
lock (_timerLock)
{
- Logger.Debug("Resetting file refresher from {0} to {1}", Path, path);
+ Logger.LogDebug("Resetting file refresher from {0} to {1}", Path, path);
Path = path;
AddAffectedPath(path);
@@ -130,7 +130,7 @@ namespace Emby.Server.Implementations.IO
paths = _affectedPaths.ToList();
}
- Logger.Debug("Timer stopped.");
+ Logger.LogDebug("Timer stopped.");
DisposeTimer();
EventHelper.FireEventIfNotNull(Completed, this, EventArgs.Empty, Logger);
@@ -141,7 +141,7 @@ namespace Emby.Server.Implementations.IO
}
catch (Exception ex)
{
- Logger.ErrorException("Error processing directory changes", ex);
+ Logger.LogError(ex, "Error processing directory changes");
}
}
@@ -161,7 +161,7 @@ namespace Emby.Server.Implementations.IO
continue;
}
- Logger.Info(item.Name + " (" + item.Path + ") will be refreshed.");
+ Logger.LogInformation("{name} ({path}}) will be refreshed.", item.Name, item.Path);
try
{
@@ -172,11 +172,11 @@ namespace Emby.Server.Implementations.IO
// For now swallow and log.
// Research item: If an IOException occurs, the item may be in a disconnected state (media unavailable)
// Should we remove it from it's parent?
- Logger.ErrorException("Error refreshing {0}", ex, item.Name);
+ Logger.LogError(ex, "Error refreshing {name}", item.Name);
}
catch (Exception ex)
{
- Logger.ErrorException("Error refreshing {0}", ex, item.Name);
+ Logger.LogError(ex, "Error refreshing {name}", item.Name);
}
}
}
diff --git a/Emby.Server.Implementations/IO/LibraryMonitor.cs b/Emby.Server.Implementations/IO/LibraryMonitor.cs
index 00fe447f0..ca5810fd6 100644
--- a/Emby.Server.Implementations/IO/LibraryMonitor.cs
+++ b/Emby.Server.Implementations/IO/LibraryMonitor.cs
@@ -9,7 +9,7 @@ using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Plugins;
using MediaBrowser.Model.IO;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using MediaBrowser.Model.System;
using MediaBrowser.Model.Tasks;
using MediaBrowser.Model.Threading;
@@ -114,7 +114,7 @@ namespace Emby.Server.Implementations.IO
}
catch (Exception ex)
{
- Logger.ErrorException("Error in ReportFileSystemChanged for {0}", ex, path);
+ Logger.LogError(ex, "Error in ReportFileSystemChanged for {path}", path);
}
}
}
@@ -141,7 +141,7 @@ namespace Emby.Server.Implementations.IO
/// <summary>
/// Initializes a new instance of the <see cref="LibraryMonitor" /> class.
/// </summary>
- public LibraryMonitor(ILogManager logManager, ITaskManager taskManager, ILibraryManager libraryManager, IServerConfigurationManager configurationManager, IFileSystem fileSystem, ITimerFactory timerFactory, ISystemEvents systemEvents, IEnvironmentInfo environmentInfo)
+ public LibraryMonitor(ILoggerFactory loggerFactory, ITaskManager taskManager, ILibraryManager libraryManager, IServerConfigurationManager configurationManager, IFileSystem fileSystem, ITimerFactory timerFactory, ISystemEvents systemEvents, IEnvironmentInfo environmentInfo)
{
if (taskManager == null)
{
@@ -150,7 +150,7 @@ namespace Emby.Server.Implementations.IO
LibraryManager = libraryManager;
TaskManager = taskManager;
- Logger = logManager.GetLogger(GetType().Name);
+ Logger = loggerFactory.CreateLogger(GetType().Name);
ConfigurationManager = configurationManager;
_fileSystem = fileSystem;
_timerFactory = timerFactory;
@@ -291,7 +291,7 @@ namespace Emby.Server.Implementations.IO
if (!_fileSystem.DirectoryExists(path))
{
// Seeing a crash in the mono runtime due to an exception being thrown on a different thread
- Logger.Info("Skipping realtime monitor for {0} because the path does not exist", path);
+ Logger.LogInformation("Skipping realtime monitor for {0} because the path does not exist", path);
return;
}
@@ -344,7 +344,7 @@ namespace Emby.Server.Implementations.IO
if (_fileSystemWatchers.TryAdd(path, newWatcher))
{
newWatcher.EnableRaisingEvents = true;
- Logger.Info("Watching directory " + path);
+ Logger.LogInformation("Watching directory " + path);
}
else
{
@@ -354,7 +354,7 @@ namespace Emby.Server.Implementations.IO
}
catch (Exception ex)
{
- Logger.ErrorException("Error watching path: {0}", ex, path);
+ Logger.LogError(ex, "Error watching path: {path}", path);
}
});
}
@@ -382,7 +382,7 @@ namespace Emby.Server.Implementations.IO
{
using (watcher)
{
- Logger.Info("Stopping directory watching for path {0}", watcher.Path);
+ Logger.LogInformation("Stopping directory watching for path {path}", watcher.Path);
watcher.Created -= watcher_Changed;
watcher.Deleted -= watcher_Changed;
@@ -439,7 +439,7 @@ namespace Emby.Server.Implementations.IO
var ex = e.GetException();
var dw = (FileSystemWatcher)sender;
- Logger.ErrorException("Error in Directory watcher for: " + dw.Path, ex);
+ Logger.LogError(ex, "Error in Directory watcher for: {path}", dw.Path);
DisposeWatcher(dw, true);
}
@@ -453,7 +453,7 @@ namespace Emby.Server.Implementations.IO
{
try
{
- //Logger.Debug("Changed detected of type " + e.ChangeType + " to " + e.FullPath);
+ //logger.LogDebug("Changed detected of type " + e.ChangeType + " to " + e.FullPath);
var path = e.FullPath;
@@ -461,7 +461,7 @@ namespace Emby.Server.Implementations.IO
}
catch (Exception ex)
{
- Logger.ErrorException("Exception in ReportFileSystemChanged. Path: {0}", ex, e.FullPath);
+ Logger.LogError(ex, "Exception in ReportFileSystemChanged. Path: {FullPath}", e.FullPath);
}
}
@@ -487,13 +487,13 @@ namespace Emby.Server.Implementations.IO
{
if (_fileSystem.AreEqual(i, path))
{
- //Logger.Debug("Ignoring change to {0}", path);
+ Logger.LogDebug("Ignoring change to {path}", path);
return true;
}
if (_fileSystem.ContainsSubPath(i, path))
{
- //Logger.Debug("Ignoring change to {0}", path);
+ Logger.LogDebug("Ignoring change to {path}", path);
return true;
}
@@ -503,7 +503,7 @@ namespace Emby.Server.Implementations.IO
{
if (_fileSystem.AreEqual(parent, path))
{
- //Logger.Debug("Ignoring change to {0}", path);
+ Logger.LogDebug("Ignoring change to {path}", path);
return true;
}
}
diff --git a/Emby.Server.Implementations/IO/ManagedFileSystem.cs b/Emby.Server.Implementations/IO/ManagedFileSystem.cs
index 66d7802c6..8819449b5 100644
--- a/Emby.Server.Implementations/IO/ManagedFileSystem.cs
+++ b/Emby.Server.Implementations/IO/ManagedFileSystem.cs
@@ -5,7 +5,7 @@ using System.IO;
using System.Linq;
using System.Text;
using MediaBrowser.Model.IO;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using MediaBrowser.Model.System;
namespace Emby.Server.Implementations.IO
@@ -175,7 +175,7 @@ namespace Emby.Server.Implementations.IO
path = System.IO.Path.GetFullPath(path);
return path;
}
- catch (ArgumentException ex)
+ catch (ArgumentException)
{
return filePath;
}
@@ -395,7 +395,7 @@ namespace Emby.Server.Implementations.IO
}
catch (Exception ex)
{
- Logger.ErrorException("Error determining CreationTimeUtc for {0}", ex, info.FullName);
+ Logger.LogError(ex, "Error determining CreationTimeUtc for {FullName}", info.FullName);
return DateTime.MinValue;
}
}
@@ -434,7 +434,7 @@ namespace Emby.Server.Implementations.IO
}
catch (Exception ex)
{
- Logger.ErrorException("Error determining LastAccessTimeUtc for {0}", ex, info.FullName);
+ Logger.LogError(ex, "Error determining LastAccessTimeUtc for {FullName}", info.FullName);
return DateTime.MinValue;
}
}
diff --git a/Emby.Server.Implementations/IO/SharpCifs/Config.cs b/Emby.Server.Implementations/IO/SharpCifs/Config.cs
index 3fd0e5bd6..324a9c494 100644
--- a/Emby.Server.Implementations/IO/SharpCifs/Config.cs
+++ b/Emby.Server.Implementations/IO/SharpCifs/Config.cs
@@ -89,7 +89,7 @@ namespace SharpCifs
{
Runtime.GetBytesForString(string.Empty, DefaultOemEncoding);
}
- catch (Exception ex)
+ catch (Exception)
{
if (_log.Level >= 2)
{
diff --git a/Emby.Server.Implementations/IO/SharpCifs/Dcerpc/DcerpcHandle.cs b/Emby.Server.Implementations/IO/SharpCifs/Dcerpc/DcerpcHandle.cs
index 786b0ac12..e82af2b0c 100644
--- a/Emby.Server.Implementations/IO/SharpCifs/Dcerpc/DcerpcHandle.cs
+++ b/Emby.Server.Implementations/IO/SharpCifs/Dcerpc/DcerpcHandle.cs
@@ -153,7 +153,7 @@ namespace SharpCifs.Dcerpc
DcerpcMessage bind = new DcerpcBind(Binding, this);
Sendrecv(bind);
}
- catch (IOException ioe)
+ catch (IOException)
{
State = 0;
throw;
diff --git a/Emby.Server.Implementations/IO/SharpCifs/Netbios/Name.cs b/Emby.Server.Implementations/IO/SharpCifs/Netbios/Name.cs
index 6c37d57a4..15ae494be 100644
--- a/Emby.Server.Implementations/IO/SharpCifs/Netbios/Name.cs
+++ b/Emby.Server.Implementations/IO/SharpCifs/Netbios/Name.cs
@@ -130,7 +130,7 @@ namespace SharpCifs.Netbios
{
name = Runtime.GetStringForBytes(tmp, 0, length).Trim();
}
- catch (Exception ex)
+ catch (Exception)
{
}
diff --git a/Emby.Server.Implementations/IO/SharpCifs/Netbios/NameServiceClient.cs b/Emby.Server.Implementations/IO/SharpCifs/Netbios/NameServiceClient.cs
index 01700e64a..0d7840a64 100644
--- a/Emby.Server.Implementations/IO/SharpCifs/Netbios/NameServiceClient.cs
+++ b/Emby.Server.Implementations/IO/SharpCifs/Netbios/NameServiceClient.cs
@@ -117,8 +117,9 @@ namespace SharpCifs.Netbios
{
Baddr = Config.GetInetAddress("jcifs.netbios.baddr", Extensions.GetAddressByName("255.255.255.255"));
}
- catch (Exception ex)
+ catch (Exception)
{
+
}
_sndBuf = new byte[SndBufSize];
@@ -302,7 +303,10 @@ namespace SharpCifs.Netbios
}
}
- catch (TimeoutException) { }
+ catch (TimeoutException)
+ {
+
+ }
catch (Exception ex)
{
if (_log.Level > 2)
diff --git a/Emby.Server.Implementations/IO/SharpCifs/Smb/NtlmContext.cs b/Emby.Server.Implementations/IO/SharpCifs/Smb/NtlmContext.cs
index 44266f974..aa52ee1db 100644
--- a/Emby.Server.Implementations/IO/SharpCifs/Smb/NtlmContext.cs
+++ b/Emby.Server.Implementations/IO/SharpCifs/Smb/NtlmContext.cs
@@ -192,7 +192,7 @@ namespace SharpCifs.Smb
catch (Exception e)
{
throw new SmbException(e.Message, e);
- }
+ }
}
default:
diff --git a/Emby.Server.Implementations/IO/SharpCifs/Smb/SmbFile.cs b/Emby.Server.Implementations/IO/SharpCifs/Smb/SmbFile.cs
index 151ec35c4..7fd9f0d84 100644
--- a/Emby.Server.Implementations/IO/SharpCifs/Smb/SmbFile.cs
+++ b/Emby.Server.Implementations/IO/SharpCifs/Smb/SmbFile.cs
@@ -3381,26 +3381,6 @@ namespace SharpCifs.Smb
}
/// <summary>
- /// Returns a
- /// <see cref="System.Uri">System.Uri</see>
- /// for this <code>SmbFile</code>. The
- /// <code>URL</code> may be used as any other <code>URL</code> might to
- /// access an SMB resource. Currently only retrieving data and information
- /// is supported (i.e. no <tt>doOutput</tt>).
- /// </summary>
- /// <returns>
- /// A new <code>
- /// <see cref="System.Uri">System.Uri</see>
- /// </code> for this <code>SmbFile</code>
- /// </returns>
- /// <exception cref="System.UriFormatException">System.UriFormatException</exception>
- [Obsolete(@"Use getURL() instead")]
- public virtual Uri ToUrl()
- {
- return Url;
- }
-
- /// <summary>
/// Computes a hashCode for this file based on the URL string and IP
/// address if the server.
/// </summary>
diff --git a/Emby.Server.Implementations/IO/StreamHelper.cs b/Emby.Server.Implementations/IO/StreamHelper.cs
index 48a5063e8..e91817611 100644
--- a/Emby.Server.Implementations/IO/StreamHelper.cs
+++ b/Emby.Server.Implementations/IO/StreamHelper.cs
@@ -163,7 +163,7 @@ namespace Emby.Server.Implementations.IO
var bytesRead = await CopyToAsyncInternal(source, target, buffer, cancellationToken).ConfigureAwait(false);
//var position = fs.Position;
- //_logger.Debug("Streamed {0} bytes to position {1} from file {2}", bytesRead, position, path);
+ //_logger.LogDebug("Streamed {0} bytes to position {1} from file {2}", bytesRead, position, path);
if (bytesRead == 0)
{