add more methods to file system interface

This commit is contained in:
Luke Pulverenti
2014-01-01 13:26:31 -05:00
parent 88b638fbd6
commit b9d17c9bc7
54 changed files with 737 additions and 459 deletions

View File

@@ -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;
}
}
}
}