From 5a3e9e520833540a8e986baa7800d6d78971bc3d Mon Sep 17 00:00:00 2001 From: LukePulverenti Date: Wed, 20 Mar 2013 13:28:12 -0400 Subject: [PATCH] updated to use iso mounting nuget package --- .../MediaBrowser.IsoMounter.csproj | 97 -------- MediaBrowser.IsoMounter/MyPfmFileMountUi.cs | 92 -------- MediaBrowser.IsoMounter/PismoIsoManager.cs | 214 ------------------ MediaBrowser.IsoMounter/PismoMount.cs | 94 -------- .../Properties/AssemblyInfo.cs | 30 --- .../Library/UserManager.cs | 7 +- .../MediaBrowser.ServerApplication.csproj | 12 +- .../packages.config | 1 + MediaBrowser.sln | 19 +- Nuget/MediaBrowser.Common.Internal.nuspec | 6 +- Nuget/MediaBrowser.Common.nuspec | 2 +- Nuget/MediaBrowser.Server.Core.nuspec | 4 +- 12 files changed, 20 insertions(+), 558 deletions(-) delete mode 100644 MediaBrowser.IsoMounter/MediaBrowser.IsoMounter.csproj delete mode 100644 MediaBrowser.IsoMounter/MyPfmFileMountUi.cs delete mode 100644 MediaBrowser.IsoMounter/PismoIsoManager.cs delete mode 100644 MediaBrowser.IsoMounter/PismoMount.cs delete mode 100644 MediaBrowser.IsoMounter/Properties/AssemblyInfo.cs diff --git a/MediaBrowser.IsoMounter/MediaBrowser.IsoMounter.csproj b/MediaBrowser.IsoMounter/MediaBrowser.IsoMounter.csproj deleted file mode 100644 index 154fad6b33..0000000000 --- a/MediaBrowser.IsoMounter/MediaBrowser.IsoMounter.csproj +++ /dev/null @@ -1,97 +0,0 @@ - - - - - Debug - AnyCPU - {5356AE30-6A6E-4A64-81E3-F76C50595E64} - Library - Properties - MediaBrowser.IsoMounter - MediaBrowser.IsoMounter - v4.5 - 512 - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - true - bin\x86\Debug\ - DEBUG;TRACE - full - x86 - prompt - MinimumRecommendedRules.ruleset - - - bin\x86\Release\ - TRACE - true - pdbonly - x86 - prompt - MinimumRecommendedRules.ruleset - - - - False - ..\ThirdParty\Pismo\x86\pfmclrapi.dll - False - - - - - - - - - - - - Properties\SharedVersion.cs - - - - - - - - - {9142eefa-7570-41e1-bfcc-468bb571af2f} - MediaBrowser.Common - - - {7eeeb4bb-f3e8-48fc-b4c5-70f0fff8329b} - MediaBrowser.Model - - - - - if $(ConfigurationName) == Release ( -xcopy "$(TargetPath)" "$(SolutionDir)\Nuget\dlls\" /y /d /r /i -xcopy "$(TargetDir)pfmclrapi.dll" "$(SolutionDir)\Nuget\dlls\" /y /d /r /i -) - - - \ No newline at end of file diff --git a/MediaBrowser.IsoMounter/MyPfmFileMountUi.cs b/MediaBrowser.IsoMounter/MyPfmFileMountUi.cs deleted file mode 100644 index 0a2fe6642c..0000000000 --- a/MediaBrowser.IsoMounter/MyPfmFileMountUi.cs +++ /dev/null @@ -1,92 +0,0 @@ -using MediaBrowser.Model.Logging; -using System.Security; - -namespace MediaBrowser.IsoMounter -{ - /// - /// Class MyPfmFileMountUi - /// - public class MyPfmFileMountUi : PfmFileMountUi - { - /// - /// The logger - /// - private readonly ILogger Logger; - - /// - /// Initializes a new instance of the class. - /// - /// The logger. - public MyPfmFileMountUi(ILogger logger) - { - Logger = logger; - } - - /// - /// Clears the password. - /// - public void ClearPassword() - { - } - - /// - /// Completes the specified error message. - /// - /// The error message. - public void Complete(string errorMessage) - { - if (!string.IsNullOrEmpty(errorMessage)) - { - Logger.Error("Complete {0}", errorMessage); - } - } - - /// - /// Queries the password. - /// - /// The prompt. - /// The count. - /// SecureString. - public SecureString QueryPassword(string prompt, int count) - { - return new SecureString(); - } - - /// - /// Resumes this instance. - /// - public void Resume() - { - Logger.Debug("Resume"); - } - - /// - /// Starts this instance. - /// - public void Start() - { - Logger.Debug("Start"); - } - - /// - /// Statuses the specified data. - /// - /// The data. - /// if set to true [end of line]. - public void Status(string data, bool endOfLine) - { - if (!string.IsNullOrEmpty(data)) - { - Logger.Debug("Status {0}", data); - } - } - - /// - /// Suspends this instance. - /// - public void Suspend() - { - Logger.Debug("Suspend"); - } - } -} diff --git a/MediaBrowser.IsoMounter/PismoIsoManager.cs b/MediaBrowser.IsoMounter/PismoIsoManager.cs deleted file mode 100644 index 4d22a71dda..0000000000 --- a/MediaBrowser.IsoMounter/PismoIsoManager.cs +++ /dev/null @@ -1,214 +0,0 @@ -using MediaBrowser.Common.IO; -using MediaBrowser.Model.Logging; -using System; -using System.IO; -using System.Threading; -using System.Threading.Tasks; - -namespace MediaBrowser.IsoMounter -{ - /// - /// Class IsoManager - /// - public class PismoIsoManager : IIsoManager - { - /// - /// The mount semaphore - limit to four at a time. - /// - private readonly SemaphoreSlim _mountSemaphore = new SemaphoreSlim(4,4); - - /// - /// The PFM API - /// - private PfmApi _pfmApi; - /// - /// The _PFM API initialized - /// - private bool _pfmApiInitialized; - /// - /// The _PFM API sync lock - /// - private object _pfmApiSyncLock = new object(); - /// - /// Gets the display prefs. - /// - /// The display prefs. - private PfmApi PfmApi - { - get - { - LazyInitializer.EnsureInitialized(ref _pfmApi, ref _pfmApiInitialized, ref _pfmApiSyncLock, () => - { - var err = PfmStatic.InstallCheck(); - - if (err != PfmInst.installed) - { - throw new Exception("Pismo File Mount Audit Package is not installed"); - } - - PfmApi pfmApi; - - err = PfmStatic.ApiFactory(out pfmApi); - - if (err != 0) - { - throw new IOException("Unable to open PFM Api. Pismo File Mount Audit Package is probably not installed."); - } - - return pfmApi; - }); - return _pfmApi; - } - } - - /// - /// The _has initialized - /// - private bool _hasInitialized; - - /// - /// Gets or sets the logger. - /// - /// The logger. - private ILogger Logger { get; set; } - - /// - /// Initializes a new instance of the class. - /// - /// The logger. - public PismoIsoManager(ILogger logger) - { - Logger = logger; - - _myPfmFileMountUi = new MyPfmFileMountUi(Logger); - } - - /// - /// The _my PFM file mount UI - /// - private readonly MyPfmFileMountUi _myPfmFileMountUi; - - /// - /// Mounts the specified iso path. - /// - /// The iso path. - /// The cancellation token. - /// if set to true [visible to all processes]. - /// IsoMount. - /// isoPath - /// Unable to create mount. - public async Task Mount(string isoPath, CancellationToken cancellationToken, bool visibleToAllProcesses = true) - { - if (string.IsNullOrEmpty(isoPath)) - { - throw new ArgumentNullException("isoPath"); - } - - PfmFileMount mount; - var err = PfmApi.FileMountCreate(out mount); - - if (err != 0) - { - throw new IOException("Unable to create mount for " + isoPath); - } - - _hasInitialized = true; - - var fmp = new PfmFileMountCreateParams { }; - - fmp.ui = _myPfmFileMountUi; - - fmp.fileMountFlags |= PfmFileMountFlag.inProcess; - - if (visibleToAllProcesses) - { - fmp.visibleProcessId = PfmVisibleProcessId.all; - } - - fmp.mountFileName = isoPath; - - // unc only - fmp.mountFlags |= PfmMountFlag.uncOnly; - fmp.mountFlags |= PfmMountFlag.noShellNotify; - fmp.mountFlags |= PfmMountFlag.readOnly; - - Logger.Info("Mounting {0}", isoPath); - - await _mountSemaphore.WaitAsync(cancellationToken).ConfigureAwait(false); - - err = mount.Start(fmp); - - if (err != 0) - { - _mountSemaphore.Release(); - mount.Dispose(); - throw new IOException("Unable to start mount for " + isoPath); - } - - err = mount.WaitReady(); - - if (err != 0) - { - _mountSemaphore.Release(); - mount.Dispose(); - throw new IOException("Unable to start mount for " + isoPath); - } - - return new PismoMount(mount, isoPath, this, Logger); - } - - /// - /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. - /// - public void Dispose() - { - Dispose(true); - } - - /// - /// Releases unmanaged and - optionally - managed resources. - /// - /// true to release both managed and unmanaged resources; false to release only unmanaged resources. - protected virtual void Dispose(bool dispose) - { - if (dispose) - { - if (_hasInitialized) - { - Logger.Info("Disposing PfmPapi"); - _pfmApi.Dispose(); - - Logger.Info("PfmStatic.ApiUnload"); - PfmStatic.ApiUnload(); - } - } - } - - /// - /// Gets a value indicating whether this instance can mount. - /// - /// The path. - /// true if this instance can mount the specified path; otherwise, false. - /// true if this instance can mount; otherwise, false. - public bool CanMount(string path) - { - try - { - return string.Equals(Path.GetExtension(path), ".iso", StringComparison.OrdinalIgnoreCase) && PfmApi != null; - } - catch - { - return false; - } - } - - /// - /// Called when [unmount]. - /// - /// The mount. - internal void OnUnmount(PismoMount mount) - { - _mountSemaphore.Release(); - } - } -} diff --git a/MediaBrowser.IsoMounter/PismoMount.cs b/MediaBrowser.IsoMounter/PismoMount.cs deleted file mode 100644 index f63db8dcfb..0000000000 --- a/MediaBrowser.IsoMounter/PismoMount.cs +++ /dev/null @@ -1,94 +0,0 @@ -using MediaBrowser.Common.IO; -using MediaBrowser.Model.Logging; -using System; - -namespace MediaBrowser.IsoMounter -{ - /// - /// Class IsoMount - /// - internal class PismoMount : IIsoMount - { - /// - /// Gets or sets the iso path. - /// - /// The iso path. - public string IsoPath { get; internal set; } - - /// - /// Gets the mounted path. - /// - /// The mounted path. - public string MountedPath { get; internal set; } - - /// - /// The PFM file mount - /// - private PfmFileMount _pfmFileMount; - - /// - /// The _iso manager - /// - private readonly PismoIsoManager _isoManager; - - /// - /// Gets or sets the logger. - /// - /// The logger. - private ILogger Logger { get; set; } - - /// - /// Prevents a default instance of the class from being created. - /// - /// The mount. - /// The iso path. - /// The iso manager. - /// The logger. - internal PismoMount(PfmFileMount mount, string isoPath, PismoIsoManager isoManager, ILogger logger) - { - _pfmFileMount = mount; - IsoPath = isoPath; - _isoManager = isoManager; - Logger = logger; - - MountedPath = mount.GetMount().GetUncName(); - } - - /// - /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. - /// - public void Dispose() - { - Dispose(true); - GC.SuppressFinalize(this); - } - - /// - /// Releases unmanaged and - optionally - managed resources. - /// - /// true to release both managed and unmanaged resources; false to release only unmanaged resources. - protected virtual void Dispose(bool dispose) - { - UnMount(); - } - - /// - /// Uns the mount. - /// - private void UnMount() - { - if (_pfmFileMount != null) - { - Logger.Info("Unmounting {0}", IsoPath); - - _pfmFileMount.Cancel(); - _pfmFileMount.Detach(); - - _isoManager.OnUnmount(this); - - _pfmFileMount.Dispose(); - _pfmFileMount = null; - } - } - } -} diff --git a/MediaBrowser.IsoMounter/Properties/AssemblyInfo.cs b/MediaBrowser.IsoMounter/Properties/AssemblyInfo.cs deleted file mode 100644 index f4eb2bd3cb..0000000000 --- a/MediaBrowser.IsoMounter/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System.Reflection; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("MediaBrowser.IsoMounter")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("MediaBrowser.IsoMounter")] -[assembly: AssemblyCopyright("Copyright © 2013")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("891a8cbf-e9d1-426a-a2c2-1e5761e2f3cf")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// \ No newline at end of file diff --git a/MediaBrowser.Server.Implementations/Library/UserManager.cs b/MediaBrowser.Server.Implementations/Library/UserManager.cs index e2c8115dc4..47e8093116 100644 --- a/MediaBrowser.Server.Implementations/Library/UserManager.cs +++ b/MediaBrowser.Server.Implementations/Library/UserManager.cs @@ -1,6 +1,4 @@ -using System.Security.Cryptography; -using System.Text; -using MediaBrowser.Common.Events; +using MediaBrowser.Common.Events; using MediaBrowser.Common.Extensions; using MediaBrowser.Controller; using MediaBrowser.Controller.Configuration; @@ -9,9 +7,10 @@ using MediaBrowser.Controller.Library; using MediaBrowser.Model.Connectivity; using MediaBrowser.Model.Logging; using System; -using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; +using System.Security.Cryptography; +using System.Text; using System.Threading; using System.Threading.Tasks; diff --git a/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj b/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj index 13d9e33447..a91fb19fa2 100644 --- a/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj +++ b/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj @@ -123,10 +123,18 @@ False ..\packages\DotNetZip.1.9.1.8\lib\net20\Ionic.Zip.dll + + False + ..\packages\MediaBrowser.IsoMounting.3.0.51\lib\net45\MediaBrowser.IsoMounter.dll + False ..\packages\NLog.2.0.0.2000\lib\net40\NLog.dll + + False + ..\packages\MediaBrowser.IsoMounting.3.0.51\lib\net45\pfmclrapi.dll + False ..\packages\SimpleInjector.2.0.0-beta5\lib\net40-client\SimpleInjector.dll @@ -264,10 +272,6 @@ {17e1f4e6-8abd-4fe5-9ecf-43d4b6087ba2} MediaBrowser.Controller - - {5356ae30-6a6e-4a64-81e3-f76c50595e64} - MediaBrowser.IsoMounter - {7eeeb4bb-f3e8-48fc-b4c5-70f0fff8329b} MediaBrowser.Model diff --git a/MediaBrowser.ServerApplication/packages.config b/MediaBrowser.ServerApplication/packages.config index e1beae6da2..0b68e5ca5e 100644 --- a/MediaBrowser.ServerApplication/packages.config +++ b/MediaBrowser.ServerApplication/packages.config @@ -2,6 +2,7 @@ + diff --git a/MediaBrowser.sln b/MediaBrowser.sln index 6cb9900552..c3a809c3fc 100644 --- a/MediaBrowser.sln +++ b/MediaBrowser.sln @@ -27,8 +27,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget (2)", ".nuget (2)", .nuget\NuGet.targets = .nuget\NuGet.targets EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MediaBrowser.IsoMounter", "MediaBrowser.IsoMounter\MediaBrowser.IsoMounter.csproj", "{5356AE30-6A6E-4A64-81E3-F76C50595E64}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MediaBrowser.Installer", "MediaBrowser.Installer\MediaBrowser.Installer.csproj", "{3879F78A-D6F6-45E5-B2A8-D8DCF2DABB74}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MediaBrowser.Common.Implementations", "MediaBrowser.Common.Implementations\MediaBrowser.Common.Implementations.csproj", "{C4D2573A-3FD3-441F-81AF-174AC4CD4E1D}" @@ -147,20 +145,6 @@ Global {5624B7B5-B5A7-41D8-9F10-CC5611109619}.Release|x64.ActiveCfg = Release|Any CPU {5624B7B5-B5A7-41D8-9F10-CC5611109619}.Release|x86.ActiveCfg = Release|Any CPU {5624B7B5-B5A7-41D8-9F10-CC5611109619}.Release|x86.Build.0 = Release|Any CPU - {5356AE30-6A6E-4A64-81E3-F76C50595E64}.Debug|Any CPU.ActiveCfg = Debug|x86 - {5356AE30-6A6E-4A64-81E3-F76C50595E64}.Debug|Any CPU.Build.0 = Debug|x86 - {5356AE30-6A6E-4A64-81E3-F76C50595E64}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {5356AE30-6A6E-4A64-81E3-F76C50595E64}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {5356AE30-6A6E-4A64-81E3-F76C50595E64}.Debug|Win32.ActiveCfg = Debug|Any CPU - {5356AE30-6A6E-4A64-81E3-F76C50595E64}.Debug|x64.ActiveCfg = Debug|Any CPU - {5356AE30-6A6E-4A64-81E3-F76C50595E64}.Debug|x86.ActiveCfg = Debug|Any CPU - {5356AE30-6A6E-4A64-81E3-F76C50595E64}.Release|Any CPU.ActiveCfg = Release|x86 - {5356AE30-6A6E-4A64-81E3-F76C50595E64}.Release|Any CPU.Build.0 = Release|x86 - {5356AE30-6A6E-4A64-81E3-F76C50595E64}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {5356AE30-6A6E-4A64-81E3-F76C50595E64}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {5356AE30-6A6E-4A64-81E3-F76C50595E64}.Release|Win32.ActiveCfg = Release|Any CPU - {5356AE30-6A6E-4A64-81E3-F76C50595E64}.Release|x64.ActiveCfg = Release|Any CPU - {5356AE30-6A6E-4A64-81E3-F76C50595E64}.Release|x86.ActiveCfg = Release|Any CPU {3879F78A-D6F6-45E5-B2A8-D8DCF2DABB74}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {3879F78A-D6F6-45E5-B2A8-D8DCF2DABB74}.Debug|Any CPU.Build.0 = Debug|Any CPU {3879F78A-D6F6-45E5-B2A8-D8DCF2DABB74}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU @@ -221,4 +205,7 @@ Global GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(Performance) = preSolution + HasPerformanceSessions = true + EndGlobalSection EndGlobal diff --git a/Nuget/MediaBrowser.Common.Internal.nuspec b/Nuget/MediaBrowser.Common.Internal.nuspec index f24655c848..dd6b78dc3c 100644 --- a/Nuget/MediaBrowser.Common.Internal.nuspec +++ b/Nuget/MediaBrowser.Common.Internal.nuspec @@ -2,7 +2,7 @@ MediaBrowser.Common.Internal - 3.0.51 + 3.0.52 MediaBrowser.Common.Internal Luke ebr,Luke,scottisafool @@ -12,7 +12,7 @@ Contains common components shared by Media Browser Theatre and Media Browser Server. Not intended for plugin developer consumption. Copyright © Media Browser 2013 - + @@ -20,8 +20,6 @@ - - \ No newline at end of file diff --git a/Nuget/MediaBrowser.Common.nuspec b/Nuget/MediaBrowser.Common.nuspec index 12dff529d1..c6207b81df 100644 --- a/Nuget/MediaBrowser.Common.nuspec +++ b/Nuget/MediaBrowser.Common.nuspec @@ -2,7 +2,7 @@ MediaBrowser.Common - 3.0.51 + 3.0.52 MediaBrowser.Common Media Browser Team ebr,Luke,scottisafool diff --git a/Nuget/MediaBrowser.Server.Core.nuspec b/Nuget/MediaBrowser.Server.Core.nuspec index a29bd9e3c8..5e774821fc 100644 --- a/Nuget/MediaBrowser.Server.Core.nuspec +++ b/Nuget/MediaBrowser.Server.Core.nuspec @@ -2,7 +2,7 @@ MediaBrowser.Server.Core - 3.0.51 + 3.0.52 Media Browser.Server.Core Media Browser Team ebr,Luke,scottisafool @@ -12,7 +12,7 @@ Contains core components required to build plugins for Media Browser Server. Copyright © Media Browser 2013 - +