aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Api/EnvironmentService.cs
diff options
context:
space:
mode:
authorLukePulverenti <luke.pulverenti@gmail.com>2013-02-23 12:54:51 -0500
committerLukePulverenti <luke.pulverenti@gmail.com>2013-02-23 12:54:51 -0500
commit465f0cc1e2e4fc50a0adbef79a4a317eec5eb454 (patch)
tree1379228a1c9ae8e3d54655e24e5bb31e3a08e128 /MediaBrowser.Api/EnvironmentService.cs
parent17c1fd576057bdd2d6aea517d733fe8af6e6b2ba (diff)
moved some network code to the networking assembly
Diffstat (limited to 'MediaBrowser.Api/EnvironmentService.cs')
-rw-r--r--MediaBrowser.Api/EnvironmentService.cs29
1 files changed, 25 insertions, 4 deletions
diff --git a/MediaBrowser.Api/EnvironmentService.cs b/MediaBrowser.Api/EnvironmentService.cs
index 83678c3f2..618eeae5d 100644
--- a/MediaBrowser.Api/EnvironmentService.cs
+++ b/MediaBrowser.Api/EnvironmentService.cs
@@ -1,6 +1,7 @@
using MediaBrowser.Common.Net;
using MediaBrowser.Controller.IO;
using MediaBrowser.Model.IO;
+using MediaBrowser.Model.Net;
using ServiceStack.ServiceHost;
using System;
using System.Collections.Generic;
@@ -60,6 +61,26 @@ namespace MediaBrowser.Api
public class EnvironmentService : BaseRestService
{
/// <summary>
+ /// The _network manager
+ /// </summary>
+ private readonly INetworkManager _networkManager;
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="EnvironmentService" /> class.
+ /// </summary>
+ /// <param name="networkManager">The network manager.</param>
+ /// <exception cref="System.ArgumentNullException">networkManager</exception>
+ public EnvironmentService(INetworkManager networkManager)
+ {
+ if (networkManager == null)
+ {
+ throw new ArgumentNullException("networkManager");
+ }
+
+ _networkManager = networkManager;
+ }
+
+ /// <summary>
/// Gets the specified request.
/// </summary>
/// <param name="request">The request.</param>
@@ -131,7 +152,7 @@ namespace MediaBrowser.Api
/// <returns>IEnumerable{FileSystemEntryInfo}.</returns>
private IEnumerable<FileSystemEntryInfo> GetNetworkComputers()
{
- return NetUtils.GetNetworkComputers().Select(c => new FileSystemEntryInfo
+ return _networkManager.GetNetworkDevices().Select(c => new FileSystemEntryInfo
{
Name = c,
Path = NetworkPrefix + c,
@@ -156,10 +177,10 @@ namespace MediaBrowser.Api
/// <returns>IEnumerable{FileSystemEntryInfo}.</returns>
private IEnumerable<FileSystemEntryInfo> GetNetworkShares(string path)
{
- return new ShareCollection(path).OfType<Share>().Where(s => s.ShareType == ShareType.Disk).Select(c => new FileSystemEntryInfo
+ return _networkManager.GetNetworkShares(path).Where(s => s.ShareType == NetworkShareType.Disk).Select(c => new FileSystemEntryInfo
{
- Name = c.NetName,
- Path = Path.Combine(path, c.NetName),
+ Name = c.Name,
+ Path = Path.Combine(path, c.Name),
Type = FileSystemEntryType.NetworkShare
});
}