From 078277ebc29bd749045e5d109024d9d08aa8edea Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sun, 4 Oct 2015 00:23:11 -0400 Subject: continue file system rework --- .../ApplicationHost.cs | 1 + .../FFMpeg/FFMpegDownloader.cs | 1 + .../FFMpeg/FFmpegValidator.cs | 1 + .../MbLinkShortcutHandler.cs | 53 ++++++++++++++++++++++ .../MediaBrowser.Server.Startup.Common.csproj | 8 ++++ .../Migrations/DeleteDlnaProfiles.cs | 1 + .../Migrations/DeprecatePlugins.cs | 1 + .../Migrations/MigrateUserFolders.cs | 1 + MediaBrowser.Server.Startup.Common/packages.config | 2 + 9 files changed, 69 insertions(+) create mode 100644 MediaBrowser.Server.Startup.Common/MbLinkShortcutHandler.cs (limited to 'MediaBrowser.Server.Startup.Common') diff --git a/MediaBrowser.Server.Startup.Common/ApplicationHost.cs b/MediaBrowser.Server.Startup.Common/ApplicationHost.cs index 29841011bd..f1833f4fc0 100644 --- a/MediaBrowser.Server.Startup.Common/ApplicationHost.cs +++ b/MediaBrowser.Server.Startup.Common/ApplicationHost.cs @@ -99,6 +99,7 @@ using System.Linq; using System.Reflection; using System.Threading; using System.Threading.Tasks; +using CommonIO; namespace MediaBrowser.Server.Startup.Common { diff --git a/MediaBrowser.Server.Startup.Common/FFMpeg/FFMpegDownloader.cs b/MediaBrowser.Server.Startup.Common/FFMpeg/FFMpegDownloader.cs index 16864898a6..00df7593b0 100644 --- a/MediaBrowser.Server.Startup.Common/FFMpeg/FFMpegDownloader.cs +++ b/MediaBrowser.Server.Startup.Common/FFMpeg/FFMpegDownloader.cs @@ -12,6 +12,7 @@ using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; +using CommonIO; namespace MediaBrowser.Server.Startup.Common.FFMpeg { diff --git a/MediaBrowser.Server.Startup.Common/FFMpeg/FFmpegValidator.cs b/MediaBrowser.Server.Startup.Common/FFMpeg/FFmpegValidator.cs index d3388f47e5..5c3ada82b4 100644 --- a/MediaBrowser.Server.Startup.Common/FFMpeg/FFmpegValidator.cs +++ b/MediaBrowser.Server.Startup.Common/FFMpeg/FFmpegValidator.cs @@ -8,6 +8,7 @@ using System.IO; using System.Text; using MediaBrowser.Common.IO; using System.Collections.Generic; +using CommonIO; namespace MediaBrowser.Server.Startup.Common.FFMpeg { diff --git a/MediaBrowser.Server.Startup.Common/MbLinkShortcutHandler.cs b/MediaBrowser.Server.Startup.Common/MbLinkShortcutHandler.cs new file mode 100644 index 0000000000..14588b427a --- /dev/null +++ b/MediaBrowser.Server.Startup.Common/MbLinkShortcutHandler.cs @@ -0,0 +1,53 @@ +using System; +using System.IO; +using CommonIO; + +namespace MediaBrowser.Server.Startup.Common +{ + public class MbLinkShortcutHandler : IShortcutHandler + { + private readonly IFileSystem _fileSystem; + + public MbLinkShortcutHandler(IFileSystem fileSystem) + { + _fileSystem = fileSystem; + } + + public string Extension + { + get { return ".mblink"; } + } + + public string Resolve(string shortcutPath) + { + if (string.IsNullOrEmpty(shortcutPath)) + { + throw new ArgumentNullException("filenshortcutPathame"); + } + + if (string.Equals(Path.GetExtension(shortcutPath), ".mblink", StringComparison.OrdinalIgnoreCase)) + { + var path = _fileSystem.ReadAllText(shortcutPath); + + return _fileSystem.NormalizePath(path); + } + + return null; + } + + public void Create(string shortcutPath, string targetPath) + { + if (string.IsNullOrEmpty(shortcutPath)) + { + throw new ArgumentNullException("shortcutPath"); + } + + if (string.IsNullOrEmpty(targetPath)) + { + throw new ArgumentNullException("targetPath"); + } + + File.WriteAllText(shortcutPath, targetPath); + } + } +} diff --git a/MediaBrowser.Server.Startup.Common/MediaBrowser.Server.Startup.Common.csproj b/MediaBrowser.Server.Startup.Common/MediaBrowser.Server.Startup.Common.csproj index 4653e6ac77..86ceb4e6a8 100644 --- a/MediaBrowser.Server.Startup.Common/MediaBrowser.Server.Startup.Common.csproj +++ b/MediaBrowser.Server.Startup.Common/MediaBrowser.Server.Startup.Common.csproj @@ -32,10 +32,17 @@ 4 + + ..\packages\CommonIO.1.0.0.3\lib\net45\CommonIO.dll + False ..\packages\Mono.Posix.4.0.0.0\lib\net40\Mono.Posix.dll + + False + ..\packages\Patterns.Logging.1.0.0.2\lib\portable-net45+sl4+wp71+win8+wpa81\Patterns.Logging.dll + False ..\ThirdParty\ServiceStack\ServiceStack.Interfaces.dll @@ -63,6 +70,7 @@ + diff --git a/MediaBrowser.Server.Startup.Common/Migrations/DeleteDlnaProfiles.cs b/MediaBrowser.Server.Startup.Common/Migrations/DeleteDlnaProfiles.cs index 166c2627f1..7b61522202 100644 --- a/MediaBrowser.Server.Startup.Common/Migrations/DeleteDlnaProfiles.cs +++ b/MediaBrowser.Server.Startup.Common/Migrations/DeleteDlnaProfiles.cs @@ -1,6 +1,7 @@ using MediaBrowser.Common.IO; using MediaBrowser.Controller; using System.IO; +using CommonIO; namespace MediaBrowser.Server.Startup.Common.Migrations { diff --git a/MediaBrowser.Server.Startup.Common/Migrations/DeprecatePlugins.cs b/MediaBrowser.Server.Startup.Common/Migrations/DeprecatePlugins.cs index afdd4e623f..a7f1d332eb 100644 --- a/MediaBrowser.Server.Startup.Common/Migrations/DeprecatePlugins.cs +++ b/MediaBrowser.Server.Startup.Common/Migrations/DeprecatePlugins.cs @@ -1,6 +1,7 @@ using MediaBrowser.Common.IO; using MediaBrowser.Controller; using System.IO; +using CommonIO; namespace MediaBrowser.Server.Startup.Common.Migrations { diff --git a/MediaBrowser.Server.Startup.Common/Migrations/MigrateUserFolders.cs b/MediaBrowser.Server.Startup.Common/Migrations/MigrateUserFolders.cs index 1dfe4c0b5d..4a40090f06 100644 --- a/MediaBrowser.Server.Startup.Common/Migrations/MigrateUserFolders.cs +++ b/MediaBrowser.Server.Startup.Common/Migrations/MigrateUserFolders.cs @@ -3,6 +3,7 @@ using MediaBrowser.Controller; using System; using System.IO; using System.Linq; +using CommonIO; namespace MediaBrowser.Server.Startup.Common.Migrations { diff --git a/MediaBrowser.Server.Startup.Common/packages.config b/MediaBrowser.Server.Startup.Common/packages.config index 120360cd44..ddb2b92023 100644 --- a/MediaBrowser.Server.Startup.Common/packages.config +++ b/MediaBrowser.Server.Startup.Common/packages.config @@ -1,4 +1,6 @@  + + \ No newline at end of file -- cgit v1.2.3