diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2014-01-01 13:26:31 -0500 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2014-01-01 13:26:31 -0500 |
| commit | b9d17c9bc765a0c59d81db6277300a6860bf8421 (patch) | |
| tree | 8a7c538cb73c27b7e06f0055ce4f0bb45175e7aa /MediaBrowser.ServerApplication/Networking/NetworkManager.cs | |
| parent | 88b638fbd69ed99bde7065f66af433b015977cb7 (diff) | |
add more methods to file system interface
Diffstat (limited to 'MediaBrowser.ServerApplication/Networking/NetworkManager.cs')
| -rw-r--r-- | MediaBrowser.ServerApplication/Networking/NetworkManager.cs | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/MediaBrowser.ServerApplication/Networking/NetworkManager.cs b/MediaBrowser.ServerApplication/Networking/NetworkManager.cs index 4799dcc72..e80c8ff3f 100644 --- a/MediaBrowser.ServerApplication/Networking/NetworkManager.cs +++ b/MediaBrowser.ServerApplication/Networking/NetworkManager.cs @@ -1,5 +1,8 @@ -using MediaBrowser.Common.Implementations.Networking; +using System.Globalization; +using System.IO; +using MediaBrowser.Common.Implementations.Networking; using MediaBrowser.Common.Net; +using MediaBrowser.Model.IO; using MediaBrowser.Model.Net; using System; using System.Collections.Generic; @@ -79,7 +82,7 @@ namespace MediaBrowser.ServerApplication.Networking /// </summary> /// <returns>Arraylist that represents all the SV_TYPE_WORKSTATION and SV_TYPE_SERVER /// PC's in the Domain</returns> - public IEnumerable<string> GetNetworkDevices() + private IEnumerable<string> GetNetworkDevicesInternal() { //local fields const int MAX_PREFERRED_LENGTH = -1; @@ -131,6 +134,33 @@ namespace MediaBrowser.ServerApplication.Networking NativeMethods.NetApiBufferFree(buffer); } } + + /// <summary> + /// Gets available devices within the domain + /// </summary> + /// <returns>PC's in the Domain</returns> + public IEnumerable<FileSystemEntryInfo> GetNetworkDevices() + { + return GetNetworkDevicesInternal().Select(c => new FileSystemEntryInfo + { + Name = c, + Path = NetworkPrefix + c, + Type = FileSystemEntryType.NetworkComputer + }); + } + + /// <summary> + /// Gets the network prefix. + /// </summary> + /// <value>The network prefix.</value> + private string NetworkPrefix + { + get + { + var separator = Path.DirectorySeparatorChar.ToString(CultureInfo.InvariantCulture); + return separator + separator; + } + } } } |
