diff options
Diffstat (limited to 'Emby.Server.Implementations/Devices/DeviceManager.cs')
| -rw-r--r-- | Emby.Server.Implementations/Devices/DeviceManager.cs | 61 |
1 files changed, 33 insertions, 28 deletions
diff --git a/Emby.Server.Implementations/Devices/DeviceManager.cs b/Emby.Server.Implementations/Devices/DeviceManager.cs index f5314df6e..60d57519e 100644 --- a/Emby.Server.Implementations/Devices/DeviceManager.cs +++ b/Emby.Server.Implementations/Devices/DeviceManager.cs @@ -1,30 +1,29 @@ -using MediaBrowser.Common.Configuration; -using MediaBrowser.Common.Net; -using MediaBrowser.Controller.Devices; -using MediaBrowser.Controller.Library; -using MediaBrowser.Model.Devices; -using MediaBrowser.Model.Events; -using MediaBrowser.Model.Extensions; -using Microsoft.Extensions.Logging; -using MediaBrowser.Model.Net; -using MediaBrowser.Model.Querying; -using MediaBrowser.Model.Session; -using MediaBrowser.Model.Users; using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Threading.Tasks; -using MediaBrowser.Model.IO; +using MediaBrowser.Common.Configuration; +using MediaBrowser.Common.Extensions; +using MediaBrowser.Common.Net; using MediaBrowser.Controller.Configuration; +using MediaBrowser.Controller.Devices; using MediaBrowser.Controller.Entities; -using MediaBrowser.Model.Entities; -using MediaBrowser.Model.Configuration; +using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Plugins; -using MediaBrowser.Model.Globalization; using MediaBrowser.Controller.Security; +using MediaBrowser.Model.Configuration; +using MediaBrowser.Model.Devices; +using MediaBrowser.Model.Entities; +using MediaBrowser.Model.Events; +using MediaBrowser.Model.Globalization; +using MediaBrowser.Model.IO; +using MediaBrowser.Model.Net; +using MediaBrowser.Model.Querying; using MediaBrowser.Model.Serialization; -using MediaBrowser.Common.Extensions; +using MediaBrowser.Model.Session; +using MediaBrowser.Model.Users; +using Microsoft.Extensions.Logging; namespace Emby.Server.Implementations.Devices { @@ -48,14 +47,24 @@ namespace Emby.Server.Implementations.Devices private readonly object _cameraUploadSyncLock = new object(); private readonly object _capabilitiesSyncLock = new object(); - public DeviceManager(IAuthenticationRepository authRepo, IJsonSerializer json, ILibraryManager libraryManager, ILocalizationManager localizationManager, IUserManager userManager, IFileSystem fileSystem, ILibraryMonitor libraryMonitor, IServerConfigurationManager config, ILogger logger, INetworkManager network) + public DeviceManager( + IAuthenticationRepository authRepo, + IJsonSerializer json, + ILibraryManager libraryManager, + ILocalizationManager localizationManager, + IUserManager userManager, + IFileSystem fileSystem, + ILibraryMonitor libraryMonitor, + IServerConfigurationManager config, + ILoggerFactory loggerFactory, + INetworkManager network) { _json = json; _userManager = userManager; _fileSystem = fileSystem; _libraryMonitor = libraryMonitor; _config = config; - _logger = logger; + _logger = loggerFactory.CreateLogger(nameof(DeviceManager)); _network = network; _libraryManager = libraryManager; _localizationManager = localizationManager; @@ -99,8 +108,7 @@ namespace Emby.Server.Implementations.Devices { lock (_capabilitiesSyncLock) { - ClientCapabilities result; - if (_capabilitiesCache.TryGetValue(id, out result)) + if (_capabilitiesCache.TryGetValue(id, out var result)) { return result; } @@ -144,7 +152,7 @@ namespace Emby.Server.Implementations.Devices HasUser = true }).Items; - + // TODO: DeviceQuery doesn't seem to be used from client. Not even Swagger. if (query.SupportsSync.HasValue) { @@ -360,10 +368,7 @@ namespace Emby.Server.Implementations.Devices return path; } - private string DefaultCameraUploadsPath - { - get { return Path.Combine(_config.CommonApplicationPaths.DataPath, "camerauploads"); } - } + private string DefaultCameraUploadsPath => Path.Combine(_config.CommonApplicationPaths.DataPath, "camerauploads"); public bool CanAccessDevice(User user, string deviceId) { @@ -373,7 +378,7 @@ namespace Emby.Server.Implementations.Devices } if (string.IsNullOrEmpty(deviceId)) { - throw new ArgumentNullException("deviceId"); + throw new ArgumentNullException(nameof(deviceId)); } if (!CanAccessDevice(user.Policy, deviceId)) @@ -389,7 +394,7 @@ namespace Emby.Server.Implementations.Devices return true; } - private bool CanAccessDevice(UserPolicy policy, string id) + private static bool CanAccessDevice(UserPolicy policy, string id) { if (policy.EnableAllDevices) { |
