update to re-worked iso manager

pull/702/head
Luke Pulverenti 11 years ago
parent e0c387446b
commit 058f9c11ff

@ -0,0 +1,75 @@
using MediaBrowser.Model.IO;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
namespace MediaBrowser.Common.Implementations.IO
{
/// <summary>
/// Class IsoManager
/// </summary>
public class IsoManager : IIsoManager
{
/// <summary>
/// The _mounters
/// </summary>
private readonly List<IIsoMounter> _mounters = new List<IIsoMounter>();
/// <summary>
/// Mounts the specified iso path.
/// </summary>
/// <param name="isoPath">The iso path.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>IsoMount.</returns>
/// <exception cref="System.ArgumentNullException">isoPath</exception>
/// <exception cref="System.ArgumentException"></exception>
public Task<IIsoMount> Mount(string isoPath, CancellationToken cancellationToken)
{
if (string.IsNullOrEmpty(isoPath))
{
throw new ArgumentNullException("isoPath");
}
var mounter = _mounters.FirstOrDefault(i => i.CanMount(isoPath));
if (mounter == null)
{
throw new ArgumentException(string.Format("No mounters are able to mount {0}", isoPath));
}
return mounter.Mount(isoPath, cancellationToken);
}
/// <summary>
/// Determines whether this instance can mount the specified path.
/// </summary>
/// <param name="path">The path.</param>
/// <returns><c>true</c> if this instance can mount the specified path; otherwise, <c>false</c>.</returns>
public bool CanMount(string path)
{
return _mounters.Any(i => i.CanMount(path));
}
/// <summary>
/// Adds the parts.
/// </summary>
/// <param name="mounters">The mounters.</param>
public void AddParts(IEnumerable<IIsoMounter> mounters)
{
_mounters.AddRange(mounters);
}
/// <summary>
/// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
/// </summary>
public void Dispose()
{
foreach (var mounter in _mounters)
{
mounter.Dispose();
}
}
}
}

@ -66,6 +66,7 @@
<Compile Include="Configuration\BaseConfigurationManager.cs" />
<Compile Include="HttpClientManager\HttpClientInfo.cs" />
<Compile Include="HttpClientManager\HttpClientManager.cs" />
<Compile Include="IO\IsoManager.cs" />
<Compile Include="Logging\LogHelper.cs" />
<Compile Include="Logging\NLogger.cs" />
<Compile Include="Logging\NlogManager.cs" />

@ -4,6 +4,7 @@ using MediaBrowser.Common.Configuration;
using MediaBrowser.Common.Constants;
using MediaBrowser.Common.Extensions;
using MediaBrowser.Common.Implementations;
using MediaBrowser.Common.Implementations.IO;
using MediaBrowser.Common.Implementations.ScheduledTasks;
using MediaBrowser.Common.Implementations.Updates;
using MediaBrowser.Common.IO;
@ -161,6 +162,8 @@ namespace MediaBrowser.ServerApplication
/// <value>The media encoder.</value>
private IMediaEncoder MediaEncoder { get; set; }
private IIsoManager IsoManager { get; set; }
private ILocalizationManager LocalizationManager { get; set; }
/// <summary>
@ -238,7 +241,9 @@ namespace MediaBrowser.ServerApplication
RegisterSingleInstance<IWebSocketServer>(() => new AlchemyServer(Logger));
//RegisterSingleInstance<IIsoManager>(() => new PismoIsoManager(Logger));
IsoManager = new IsoManager();
RegisterSingleInstance(IsoManager);
RegisterSingleInstance<IBlurayExaminer>(() => new BdInfoExaminer());
ZipClient = new DotNetZipClient();
@ -442,6 +447,8 @@ namespace MediaBrowser.ServerApplication
GetExports<IMetadataSaver>());
ProviderManager.AddParts(GetExports<BaseMetadataProvider>().ToArray());
IsoManager.AddParts(GetExports<IIsoMounter>().ToArray());
}
/// <summary>

@ -126,8 +126,9 @@
<Reference Include="MahApps.Metro">
<HintPath>..\packages\MahApps.Metro.0.11.0.17-ALPHA\lib\net45\MahApps.Metro.dll</HintPath>
</Reference>
<Reference Include="MediaBrowser.IsoMounter">
<HintPath>..\packages\MediaBrowser.IsoMounting.3.0.55\lib\net45\MediaBrowser.IsoMounter.dll</HintPath>
<Reference Include="MediaBrowser.IsoMounter, Version=1.0.4969.36586, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\MediaBrowser.IsoMounting.3.0.56\lib\net45\MediaBrowser.IsoMounter.dll</HintPath>
</Reference>
<Reference Include="MoreLinq, Version=1.0.16006.0, Culture=neutral, PublicKeyToken=384d532d7e88985d, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
@ -137,8 +138,9 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\NLog.2.0.1.2\lib\net45\NLog.dll</HintPath>
</Reference>
<Reference Include="pfmclrapi">
<HintPath>..\packages\MediaBrowser.IsoMounting.3.0.55\lib\net45\pfmclrapi.dll</HintPath>
<Reference Include="pfmclrapi, Version=0.0.0.0, Culture=neutral, processorArchitecture=x86">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\MediaBrowser.IsoMounting.3.0.56\lib\net45\pfmclrapi.dll</HintPath>
</Reference>
<Reference Include="ServiceStack, Version=3.9.56.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>

@ -3,7 +3,7 @@
<package id="DotNetZip" version="1.9.1.8" targetFramework="net45" />
<package id="Hardcodet.Wpf.TaskbarNotification" version="1.0.4.0" targetFramework="net45" />
<package id="MahApps.Metro" version="0.11.0.17-ALPHA" targetFramework="net45" />
<package id="MediaBrowser.IsoMounting" version="3.0.55" targetFramework="net45" />
<package id="MediaBrowser.IsoMounting" version="3.0.56" targetFramework="net45" />
<package id="morelinq" version="1.0.16006" targetFramework="net45" />
<package id="NLog" version="2.0.1.2" targetFramework="net45" />
<package id="ServiceStack" version="3.9.56" targetFramework="net45" />

Loading…
Cancel
Save