From b9d17c9bc765a0c59d81db6277300a6860bf8421 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Wed, 1 Jan 2014 13:26:31 -0500 Subject: add more methods to file system interface --- .../Networking/NetworkManager.cs | 34 ++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) (limited to 'MediaBrowser.ServerApplication/Networking/NetworkManager.cs') 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 /// /// Arraylist that represents all the SV_TYPE_WORKSTATION and SV_TYPE_SERVER /// PC's in the Domain - public IEnumerable GetNetworkDevices() + private IEnumerable GetNetworkDevicesInternal() { //local fields const int MAX_PREFERRED_LENGTH = -1; @@ -131,6 +134,33 @@ namespace MediaBrowser.ServerApplication.Networking NativeMethods.NetApiBufferFree(buffer); } } + + /// + /// Gets available devices within the domain + /// + /// PC's in the Domain + public IEnumerable GetNetworkDevices() + { + return GetNetworkDevicesInternal().Select(c => new FileSystemEntryInfo + { + Name = c, + Path = NetworkPrefix + c, + Type = FileSystemEntryType.NetworkComputer + }); + } + + /// + /// Gets the network prefix. + /// + /// The network prefix. + private string NetworkPrefix + { + get + { + var separator = Path.DirectorySeparatorChar.ToString(CultureInfo.InvariantCulture); + return separator + separator; + } + } } } -- cgit v1.2.3