diff options
| author | Bond_009 <bond.009@outlook.com> | 2019-12-10 23:00:59 +0100 |
|---|---|---|
| committer | Bond_009 <bond.009@outlook.com> | 2019-12-10 23:00:59 +0100 |
| commit | 0bf8bfbb0cfd67b387a574148022f3c554ff5173 (patch) | |
| tree | 34f12fcce7b688fc50d377f90dbccc343e03b310 /MediaBrowser.Api/EnvironmentService.cs | |
| parent | c6d48f51f608601775d98fc7866eefc367bfd63b (diff) | |
| parent | 67922dff50967c02e8c0c10f43884fd4e788b012 (diff) | |
Merge branch 'master' into mediaencoding
Diffstat (limited to 'MediaBrowser.Api/EnvironmentService.cs')
| -rw-r--r-- | MediaBrowser.Api/EnvironmentService.cs | 55 |
1 files changed, 18 insertions, 37 deletions
diff --git a/MediaBrowser.Api/EnvironmentService.cs b/MediaBrowser.Api/EnvironmentService.cs index f4813e713..c6dbfb938 100644 --- a/MediaBrowser.Api/EnvironmentService.cs +++ b/MediaBrowser.Api/EnvironmentService.cs @@ -3,10 +3,12 @@ using System.Collections.Generic; using System.IO; using System.Linq; using MediaBrowser.Common.Net; +using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Net; using MediaBrowser.Model.IO; using MediaBrowser.Model.Net; using MediaBrowser.Model.Services; +using Microsoft.Extensions.Logging; namespace MediaBrowser.Api { @@ -52,6 +54,7 @@ namespace MediaBrowser.Api public bool? IsFile { get; set; } } + [Obsolete] [Route("/Environment/NetworkShares", "GET", Summary = "Gets shares from a network device")] public class GetNetworkShares : IReturn<List<FileSystemEntryInfo>> { @@ -107,8 +110,8 @@ namespace MediaBrowser.Api [Authenticated(Roles = "Admin", AllowBeforeStartupWizard = true)] public class EnvironmentService : BaseApiService { - const char UncSeparator = '\\'; - const string UncSeparatorString = "\\"; + private const char UncSeparator = '\\'; + private const string UncSeparatorString = "\\"; /// <summary> /// The _network manager @@ -120,13 +123,14 @@ namespace MediaBrowser.Api /// Initializes a new instance of the <see cref="EnvironmentService" /> class. /// </summary> /// <param name="networkManager">The network manager.</param> - public EnvironmentService(INetworkManager networkManager, IFileSystem fileSystem) + public EnvironmentService( + ILogger<EnvironmentService> logger, + IServerConfigurationManager serverConfigurationManager, + IHttpResultFactory httpResultFactory, + INetworkManager networkManager, + IFileSystem fileSystem) + : base(logger, serverConfigurationManager, httpResultFactory) { - if (networkManager == null) - { - throw new ArgumentNullException(nameof(networkManager)); - } - _networkManager = networkManager; _fileSystem = fileSystem; } @@ -192,22 +196,18 @@ namespace MediaBrowser.Api var networkPrefix = UncSeparatorString + UncSeparatorString; - if (path.StartsWith(networkPrefix, StringComparison.OrdinalIgnoreCase) && path.LastIndexOf(UncSeparator) == 1) + if (path.StartsWith(networkPrefix, StringComparison.OrdinalIgnoreCase) + && path.LastIndexOf(UncSeparator) == 1) { - return ToOptimizedResult(GetNetworkShares(path).OrderBy(i => i.Path).ToList()); + return ToOptimizedResult(Array.Empty<FileSystemEntryInfo>()); } return ToOptimizedResult(GetFileSystemEntries(request).ToList()); } + [Obsolete] public object Get(GetNetworkShares request) - { - var path = request.Path; - - var shares = GetNetworkShares(path).OrderBy(i => i.Path).ToList(); - - return ToOptimizedResult(shares); - } + => ToOptimizedResult(Array.Empty<FileSystemEntryInfo>()); /// <summary> /// Gets the specified request. @@ -241,26 +241,7 @@ namespace MediaBrowser.Api /// <param name="request">The request.</param> /// <returns>System.Object.</returns> public object Get(GetNetworkDevices request) - { - var result = _networkManager.GetNetworkDevices().ToList(); - - return ToOptimizedResult(result); - } - - /// <summary> - /// Gets the network shares. - /// </summary> - /// <param name="path">The path.</param> - /// <returns>IEnumerable{FileSystemEntryInfo}.</returns> - private IEnumerable<FileSystemEntryInfo> GetNetworkShares(string path) - { - return _networkManager.GetNetworkShares(path).Where(s => s.ShareType == NetworkShareType.Disk).Select(c => new FileSystemEntryInfo - { - Name = c.Name, - Path = Path.Combine(path, c.Name), - Type = FileSystemEntryType.NetworkShare - }); - } + => ToOptimizedResult(Array.Empty<FileSystemEntryInfo>()); /// <summary> /// Gets the file system entries. |
