From 14de062681026157c6917779a51af6fb7046cec2 Mon Sep 17 00:00:00 2001 From: Luke Date: Sun, 13 Sep 2015 17:32:02 -0400 Subject: update file system methods --- MediaBrowser.Server.Implementations/MediaEncoder/EncodingManager.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'MediaBrowser.Server.Implementations/MediaEncoder/EncodingManager.cs') diff --git a/MediaBrowser.Server.Implementations/MediaEncoder/EncodingManager.cs b/MediaBrowser.Server.Implementations/MediaEncoder/EncodingManager.cs index 6b99883a5..9ea553d2d 100644 --- a/MediaBrowser.Server.Implementations/MediaEncoder/EncodingManager.cs +++ b/MediaBrowser.Server.Implementations/MediaEncoder/EncodingManager.cs @@ -138,7 +138,7 @@ namespace MediaBrowser.Server.Implementations.MediaEncoder try { - Directory.CreateDirectory(Path.GetDirectoryName(path)); + _fileSystem.CreateDirectory(Path.GetDirectoryName(path)); using (var stream = await _encoder.ExtractVideoImage(inputPath, protocol, video.Video3DFormat, time, cancellationToken).ConfigureAwait(false)) { -- cgit v1.2.3 From f3e9bbed2361a2b0d9024186fe8854a136921cd9 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Thu, 24 Sep 2015 13:50:49 -0400 Subject: update file system methods --- MediaBrowser.Api/ApiEntryPoint.cs | 4 ++-- MediaBrowser.Api/Library/LibraryHelpers.cs | 2 +- MediaBrowser.Api/Playback/BaseStreamingService.cs | 2 +- .../ScheduledTasks/Tasks/DeleteCacheFileTask.cs | 4 ++-- MediaBrowser.Controller/Entities/Video.cs | 2 +- .../MediaEncoding/MediaEncoderHelpers.cs | 14 ++++++++------ MediaBrowser.MediaEncoding/Encoder/BaseEncoder.cs | 2 +- MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs | 7 ++++++- MediaBrowser.Providers/MediaInfo/VideoImageProvider.cs | 7 +++++-- .../Collections/CollectionManager.cs | 4 ++-- .../Devices/DeviceRepository.cs | 4 ++-- .../FileOrganization/EpisodeFileOrganizer.cs | 4 ++-- .../FileOrganization/TvFolderOrganizer.cs | 4 ++-- .../Intros/DefaultIntroProvider.cs | 7 +++++-- .../MediaEncoder/EncodingManager.cs | 4 ++-- 15 files changed, 42 insertions(+), 29 deletions(-) (limited to 'MediaBrowser.Server.Implementations/MediaEncoder/EncodingManager.cs') diff --git a/MediaBrowser.Api/ApiEntryPoint.cs b/MediaBrowser.Api/ApiEntryPoint.cs index c2b406190..aa5cd8d5f 100644 --- a/MediaBrowser.Api/ApiEntryPoint.cs +++ b/MediaBrowser.Api/ApiEntryPoint.cs @@ -95,7 +95,7 @@ namespace MediaBrowser.Api { var path = _config.ApplicationPaths.TranscodingTempPath; - foreach (var file in Directory.EnumerateFiles(path, "*", SearchOption.AllDirectories) + foreach (var file in _fileSystem.GetFilePaths(path, true) .ToList()) { _fileSystem.DeleteFile(file); @@ -567,7 +567,7 @@ namespace MediaBrowser.Api var directory = Path.GetDirectoryName(outputFilePath); var name = Path.GetFileNameWithoutExtension(outputFilePath); - var filesToDelete = Directory.EnumerateFiles(directory) + var filesToDelete = _fileSystem.GetFilePaths(directory) .Where(f => f.IndexOf(name, StringComparison.OrdinalIgnoreCase) != -1) .ToList(); diff --git a/MediaBrowser.Api/Library/LibraryHelpers.cs b/MediaBrowser.Api/Library/LibraryHelpers.cs index 5e40ac635..877321b77 100644 --- a/MediaBrowser.Api/Library/LibraryHelpers.cs +++ b/MediaBrowser.Api/Library/LibraryHelpers.cs @@ -37,7 +37,7 @@ namespace MediaBrowser.Api.Library { throw new DirectoryNotFoundException(string.Format("The media collection {0} does not exist", virtualFolderName)); } - + var shortcut = Directory.EnumerateFiles(path, ShortcutFileSearch, SearchOption.AllDirectories).FirstOrDefault(f => fileSystem.ResolveShortcut(f).Equals(mediaPath, StringComparison.OrdinalIgnoreCase)); if (!string.IsNullOrEmpty(shortcut)) diff --git a/MediaBrowser.Api/Playback/BaseStreamingService.cs b/MediaBrowser.Api/Playback/BaseStreamingService.cs index 5d88a41aa..8e5061d62 100644 --- a/MediaBrowser.Api/Playback/BaseStreamingService.cs +++ b/MediaBrowser.Api/Playback/BaseStreamingService.cs @@ -873,7 +873,7 @@ namespace MediaBrowser.Api.Playback { if (!(state.VideoType == VideoType.Iso && state.IsoMount == null)) { - inputPath = MediaEncoderHelpers.GetInputArgument(mediaPath, state.InputProtocol, state.IsoMount, state.PlayableStreamFileNames); + inputPath = MediaEncoderHelpers.GetInputArgument(FileSystem, mediaPath, state.InputProtocol, state.IsoMount, state.PlayableStreamFileNames); } } diff --git a/MediaBrowser.Common.Implementations/ScheduledTasks/Tasks/DeleteCacheFileTask.cs b/MediaBrowser.Common.Implementations/ScheduledTasks/Tasks/DeleteCacheFileTask.cs index 6d5516ebd..ec48bb5dc 100644 --- a/MediaBrowser.Common.Implementations/ScheduledTasks/Tasks/DeleteCacheFileTask.cs +++ b/MediaBrowser.Common.Implementations/ScheduledTasks/Tasks/DeleteCacheFileTask.cs @@ -122,10 +122,10 @@ namespace MediaBrowser.Common.Implementations.ScheduledTasks.Tasks private void DeleteEmptyFolders(string parent) { - foreach (var directory in Directory.GetDirectories(parent)) + foreach (var directory in _fileSystem.GetDirectoryPaths(parent)) { DeleteEmptyFolders(directory); - if (!Directory.EnumerateFileSystemEntries(directory).Any()) + if (!_fileSystem.GetFileSystemEntryPaths(directory).Any()) { _fileSystem.DeleteDirectory(directory, false); } diff --git a/MediaBrowser.Controller/Entities/Video.cs b/MediaBrowser.Controller/Entities/Video.cs index cc0c9ee46..b9159b9f7 100644 --- a/MediaBrowser.Controller/Entities/Video.cs +++ b/MediaBrowser.Controller/Entities/Video.cs @@ -319,7 +319,7 @@ namespace MediaBrowser.Controller.Entities /// List{System.String}. public List GetPlayableStreamFiles(string rootPath) { - var allFiles = Directory.EnumerateFiles(rootPath, "*", SearchOption.AllDirectories).ToList(); + var allFiles = FileSystem.GetFilePaths(rootPath, true).ToList(); return PlayableStreamFileNames.Select(name => allFiles.FirstOrDefault(f => string.Equals(System.IO.Path.GetFileName(f), name, StringComparison.OrdinalIgnoreCase))) .Where(f => !string.IsNullOrEmpty(f)) diff --git a/MediaBrowser.Controller/MediaEncoding/MediaEncoderHelpers.cs b/MediaBrowser.Controller/MediaEncoding/MediaEncoderHelpers.cs index da9dd4dfd..6b7bddcfa 100644 --- a/MediaBrowser.Controller/MediaEncoding/MediaEncoderHelpers.cs +++ b/MediaBrowser.Controller/MediaEncoding/MediaEncoderHelpers.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Generic; using System.IO; using System.Linq; +using MediaBrowser.Common.IO; namespace MediaBrowser.Controller.MediaEncoding { @@ -15,29 +16,30 @@ namespace MediaBrowser.Controller.MediaEncoding /// /// Gets the input argument. /// + /// The file system. /// The video path. /// The protocol. /// The iso mount. /// The playable stream file names. /// System.String[][]. - public static string[] GetInputArgument(string videoPath, MediaProtocol protocol, IIsoMount isoMount, List playableStreamFileNames) + public static string[] GetInputArgument(IFileSystem fileSystem, string videoPath, MediaProtocol protocol, IIsoMount isoMount, List playableStreamFileNames) { if (playableStreamFileNames.Count > 0) { if (isoMount == null) { - return GetPlayableStreamFiles(videoPath, playableStreamFileNames).ToArray(); + return GetPlayableStreamFiles(fileSystem, videoPath, playableStreamFileNames).ToArray(); } - return GetPlayableStreamFiles(isoMount.MountedPath, playableStreamFileNames).ToArray(); + return GetPlayableStreamFiles(fileSystem, isoMount.MountedPath, playableStreamFileNames).ToArray(); } return new[] {videoPath}; } - public static List GetPlayableStreamFiles(string rootPath, IEnumerable filenames) + public static List GetPlayableStreamFiles(IFileSystem fileSystem, string rootPath, IEnumerable filenames) { - var allFiles = Directory - .EnumerateFiles(rootPath, "*", SearchOption.AllDirectories) + var allFiles = fileSystem + .GetFilePaths(rootPath, true) .ToList(); return filenames.Select(name => allFiles.FirstOrDefault(f => string.Equals(Path.GetFileName(f), name, StringComparison.OrdinalIgnoreCase))) diff --git a/MediaBrowser.MediaEncoding/Encoder/BaseEncoder.cs b/MediaBrowser.MediaEncoding/Encoder/BaseEncoder.cs index e20d5d0a2..a8ea283ae 100644 --- a/MediaBrowser.MediaEncoding/Encoder/BaseEncoder.cs +++ b/MediaBrowser.MediaEncoding/Encoder/BaseEncoder.cs @@ -468,7 +468,7 @@ namespace MediaBrowser.MediaEncoding.Encoder { if (!(job.VideoType == VideoType.Iso && job.IsoMount == null)) { - inputPath = MediaEncoderHelpers.GetInputArgument(job.MediaPath, job.InputProtocol, job.IsoMount, job.PlayableStreamFileNames); + inputPath = MediaEncoderHelpers.GetInputArgument(FileSystem, job.MediaPath, job.InputProtocol, job.IsoMount, job.PlayableStreamFileNames); } } diff --git a/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs b/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs index 6f25d4b6e..1f9826d54 100644 --- a/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs +++ b/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs @@ -132,7 +132,7 @@ namespace MediaBrowser.MediaEncoding.Encoder { var extractChapters = request.MediaType == DlnaProfileType.Video && request.ExtractChapters; - var inputFiles = MediaEncoderHelpers.GetInputArgument(request.InputPath, request.Protocol, request.MountedIso, request.PlayableStreamFileNames); + var inputFiles = MediaEncoderHelpers.GetInputArgument(FileSystem, request.InputPath, request.Protocol, request.MountedIso, request.PlayableStreamFileNames); var extractKeyFrameInterval = request.ExtractKeyFrameInterval && request.Protocol == MediaProtocol.File && request.VideoType == VideoType.VideoFile; @@ -283,6 +283,11 @@ namespace MediaBrowser.MediaEncoding.Encoder } } + if (!process.WaitForExit(5000)) + { + StopProcess(processWrapper, 100, true); + } + return mediaInfo; } } diff --git a/MediaBrowser.Providers/MediaInfo/VideoImageProvider.cs b/MediaBrowser.Providers/MediaInfo/VideoImageProvider.cs index bcea66662..46359731e 100644 --- a/MediaBrowser.Providers/MediaInfo/VideoImageProvider.cs +++ b/MediaBrowser.Providers/MediaInfo/VideoImageProvider.cs @@ -12,6 +12,7 @@ using System; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; +using MediaBrowser.Common.IO; namespace MediaBrowser.Providers.MediaInfo { @@ -22,14 +23,16 @@ namespace MediaBrowser.Providers.MediaInfo private readonly IServerConfigurationManager _config; private readonly ILibraryManager _libraryManager; private readonly ILogger _logger; + private readonly IFileSystem _fileSystem; - public VideoImageProvider(IIsoManager isoManager, IMediaEncoder mediaEncoder, IServerConfigurationManager config, ILibraryManager libraryManager, ILogger logger) + public VideoImageProvider(IIsoManager isoManager, IMediaEncoder mediaEncoder, IServerConfigurationManager config, ILibraryManager libraryManager, ILogger logger, IFileSystem fileSystem) { _isoManager = isoManager; _mediaEncoder = mediaEncoder; _config = config; _libraryManager = libraryManager; _logger = logger; + _fileSystem = fileSystem; } /// @@ -101,7 +104,7 @@ namespace MediaBrowser.Providers.MediaInfo ? MediaProtocol.Http : MediaProtocol.File; - var inputPath = MediaEncoderHelpers.GetInputArgument(item.Path, protocol, isoMount, item.PlayableStreamFileNames); + var inputPath = MediaEncoderHelpers.GetInputArgument(_fileSystem, item.Path, protocol, isoMount, item.PlayableStreamFileNames); var stream = await _mediaEncoder.ExtractVideoImage(inputPath, protocol, item.Video3DFormat, imageOffset, cancellationToken).ConfigureAwait(false); diff --git a/MediaBrowser.Server.Implementations/Collections/CollectionManager.cs b/MediaBrowser.Server.Implementations/Collections/CollectionManager.cs index b8c23224f..9968425e3 100644 --- a/MediaBrowser.Server.Implementations/Collections/CollectionManager.cs +++ b/MediaBrowser.Server.Implementations/Collections/CollectionManager.cs @@ -225,8 +225,8 @@ namespace MediaBrowser.Server.Implementations.Collections } } - var shortcutFiles = Directory - .EnumerateFiles(collection.Path, "*", SearchOption.TopDirectoryOnly) + var shortcutFiles = _fileSystem + .GetFilePaths(collection.Path) .Where(i => _fileSystem.IsShortcut(i)) .ToList(); diff --git a/MediaBrowser.Server.Implementations/Devices/DeviceRepository.cs b/MediaBrowser.Server.Implementations/Devices/DeviceRepository.cs index b8262d05f..853217826 100644 --- a/MediaBrowser.Server.Implementations/Devices/DeviceRepository.cs +++ b/MediaBrowser.Server.Implementations/Devices/DeviceRepository.cs @@ -111,8 +111,8 @@ namespace MediaBrowser.Server.Implementations.Devices try { - return Directory - .EnumerateFiles(path, "*", SearchOption.AllDirectories) + return _fileSystem + .GetFilePaths(path, true) .Where(i => string.Equals(Path.GetFileName(i), "device.json", StringComparison.OrdinalIgnoreCase)) .ToList() .Select(i => diff --git a/MediaBrowser.Server.Implementations/FileOrganization/EpisodeFileOrganizer.cs b/MediaBrowser.Server.Implementations/FileOrganization/EpisodeFileOrganizer.cs index 0389980e2..aa5a52512 100644 --- a/MediaBrowser.Server.Implementations/FileOrganization/EpisodeFileOrganizer.cs +++ b/MediaBrowser.Server.Implementations/FileOrganization/EpisodeFileOrganizer.cs @@ -256,7 +256,7 @@ namespace MediaBrowser.Server.Implementations.FileOrganization if (!string.IsNullOrWhiteSpace(originalFilenameWithoutExtension) && !string.IsNullOrWhiteSpace(directory)) { // Get all related files, e.g. metadata, images, etc - var files = Directory.EnumerateFiles(directory, "*", SearchOption.TopDirectoryOnly) + var files = _fileSystem.GetFilePaths(directory) .Where(i => (Path.GetFileNameWithoutExtension(i) ?? string.Empty).StartsWith(originalFilenameWithoutExtension, StringComparison.OrdinalIgnoreCase)) .ToList(); @@ -313,7 +313,7 @@ namespace MediaBrowser.Server.Implementations.FileOrganization try { - var filesOfOtherExtensions = Directory.EnumerateFiles(folder, "*", SearchOption.TopDirectoryOnly) + var filesOfOtherExtensions = _fileSystem.GetFilePaths(folder) .Where(i => _libraryManager.IsVideoFile(i) && string.Equals(_fileSystem.GetFileNameWithoutExtension(i), targetFileNameWithoutExtension, StringComparison.OrdinalIgnoreCase)); episodePaths.AddRange(filesOfOtherExtensions); diff --git a/MediaBrowser.Server.Implementations/FileOrganization/TvFolderOrganizer.cs b/MediaBrowser.Server.Implementations/FileOrganization/TvFolderOrganizer.cs index 54f2539ff..83fca9939 100644 --- a/MediaBrowser.Server.Implementations/FileOrganization/TvFolderOrganizer.cs +++ b/MediaBrowser.Server.Implementations/FileOrganization/TvFolderOrganizer.cs @@ -175,12 +175,12 @@ namespace MediaBrowser.Server.Implementations.FileOrganization { try { - foreach (var d in Directory.EnumerateDirectories(path)) + foreach (var d in _fileSystem.GetDirectoryPaths(path)) { DeleteEmptyFolders(d); } - var entries = Directory.EnumerateFileSystemEntries(path); + var entries = _fileSystem.GetFileSystemEntryPaths(path); if (!entries.Any()) { diff --git a/MediaBrowser.Server.Implementations/Intros/DefaultIntroProvider.cs b/MediaBrowser.Server.Implementations/Intros/DefaultIntroProvider.cs index db9841f9d..ce3f0c66c 100644 --- a/MediaBrowser.Server.Implementations/Intros/DefaultIntroProvider.cs +++ b/MediaBrowser.Server.Implementations/Intros/DefaultIntroProvider.cs @@ -15,6 +15,7 @@ using System.IO; using System.Linq; using System.Threading; using System.Threading.Tasks; +using MediaBrowser.Common.IO; namespace MediaBrowser.Server.Implementations.Intros { @@ -25,14 +26,16 @@ namespace MediaBrowser.Server.Implementations.Intros private readonly ILocalizationManager _localization; private readonly IConfigurationManager _serverConfig; private readonly ILibraryManager _libraryManager; + private readonly IFileSystem _fileSystem; - public DefaultIntroProvider(ISecurityManager security, IChannelManager channelManager, ILocalizationManager localization, IConfigurationManager serverConfig, ILibraryManager libraryManager) + public DefaultIntroProvider(ISecurityManager security, IChannelManager channelManager, ILocalizationManager localization, IConfigurationManager serverConfig, ILibraryManager libraryManager, IFileSystem fileSystem) { _security = security; _channelManager = channelManager; _localization = localization; _serverConfig = serverConfig; _libraryManager = libraryManager; + _fileSystem = fileSystem; } public async Task> GetIntros(BaseItem item, User user) @@ -232,7 +235,7 @@ namespace MediaBrowser.Server.Implementations.Intros return new List(); } - return Directory.EnumerateFiles(options.CustomIntroPath, "*", SearchOption.AllDirectories) + return _fileSystem.GetFilePaths(options.CustomIntroPath, true) .Where(_libraryManager.IsVideoFile); } diff --git a/MediaBrowser.Server.Implementations/MediaEncoder/EncodingManager.cs b/MediaBrowser.Server.Implementations/MediaEncoder/EncodingManager.cs index 9ea553d2d..550d76f44 100644 --- a/MediaBrowser.Server.Implementations/MediaEncoder/EncodingManager.cs +++ b/MediaBrowser.Server.Implementations/MediaEncoder/EncodingManager.cs @@ -134,7 +134,7 @@ namespace MediaBrowser.Server.Implementations.MediaEncoder var protocol = MediaProtocol.File; - var inputPath = MediaEncoderHelpers.GetInputArgument(video.Path, protocol, null, video.PlayableStreamFileNames); + var inputPath = MediaEncoderHelpers.GetInputArgument(_fileSystem, video.Path, protocol, null, video.PlayableStreamFileNames); try { @@ -194,7 +194,7 @@ namespace MediaBrowser.Server.Implementations.MediaEncoder try { - return Directory.EnumerateFiles(path) + return _fileSystem.GetFilePaths(path) .ToList(); } catch (DirectoryNotFoundException) -- cgit v1.2.3 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 --- Emby.Drawing/Common/ImageHeader.cs | 1 + Emby.Drawing/Emby.Drawing.csproj | 7 + Emby.Drawing/GDI/DynamicImageHelpers.cs | 1 + Emby.Drawing/GDI/GDIImageEncoder.cs | 1 + Emby.Drawing/ImageMagick/ImageMagickEncoder.cs | 1 + Emby.Drawing/ImageMagick/PlayedIndicatorDrawer.cs | 1 + Emby.Drawing/ImageMagick/StripCollageBuilder.cs | 1 + Emby.Drawing/ImageMagick/UnplayedCountIndicator.cs | 1 + Emby.Drawing/ImageProcessor.cs | 1 + Emby.Drawing/packages.config | 2 + MediaBrowser.Api/ApiEntryPoint.cs | 1 + MediaBrowser.Api/ConfigurationService.cs | 1 + MediaBrowser.Api/EnvironmentService.cs | 1 + MediaBrowser.Api/Images/ImageByNameService.cs | 1 + MediaBrowser.Api/Images/ImageService.cs | 1 + MediaBrowser.Api/Images/RemoteImageService.cs | 1 + MediaBrowser.Api/ItemLookupService.cs | 1 + MediaBrowser.Api/ItemRefreshService.cs | 1 + MediaBrowser.Api/Library/LibraryHelpers.cs | 1 + MediaBrowser.Api/Library/LibraryService.cs | 1 + .../Library/LibraryStructureService.cs | 1 + MediaBrowser.Api/MediaBrowser.Api.csproj | 7 + MediaBrowser.Api/Playback/BaseStreamingService.cs | 1 + MediaBrowser.Api/Playback/Dash/MpegDashService.cs | 1 + MediaBrowser.Api/Playback/Hls/BaseHlsService.cs | 1 + MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs | 1 + MediaBrowser.Api/Playback/Hls/VideoHlsService.cs | 1 + .../Playback/Progressive/AudioService.cs | 1 + .../Progressive/BaseProgressiveStreamingService.cs | 1 + .../Progressive/ProgressiveStreamWriter.cs | 1 + .../Playback/Progressive/VideoService.cs | 1 + MediaBrowser.Api/Subtitles/SubtitleService.cs | 1 + MediaBrowser.Api/System/SystemService.cs | 1 + MediaBrowser.Api/VideosService.cs | 1 + MediaBrowser.Api/packages.config | 2 + .../Archiving/ZipClient.cs | 1 + .../BaseApplicationHost.cs | 1 + .../Devices/DeviceId.cs | 1 + .../HttpClientManager/HttpClientManager.cs | 1 + .../IO/CommonFileSystem.cs | 559 --------------------- .../MediaBrowser.Common.Implementations.csproj | 8 +- .../ScheduledTasks/ScheduledTaskWorker.cs | 1 + .../ScheduledTasks/TaskManager.cs | 1 + .../ScheduledTasks/Tasks/DeleteCacheFileTask.cs | 1 + .../ScheduledTasks/Tasks/DeleteLogFileTask.cs | 1 + .../Serialization/JsonSerializer.cs | 1 + .../Serialization/XmlSerializer.cs | 1 + .../Updates/InstallationManager.cs | 1 + .../packages.config | 2 + MediaBrowser.Common/IO/FileSystemMetadata.cs | 32 -- MediaBrowser.Common/IO/IFileSystem.cs | 291 ----------- MediaBrowser.Common/MediaBrowser.Common.csproj | 2 - .../Entities/AggregateFolder.cs | 1 + MediaBrowser.Controller/Entities/BaseItem.cs | 1 + .../Entities/CollectionFolder.cs | 1 + MediaBrowser.Controller/Entities/Folder.cs | 1 + MediaBrowser.Controller/Entities/IHasImages.cs | 1 + MediaBrowser.Controller/Entities/Movies/Movie.cs | 1 + MediaBrowser.Controller/Entities/Video.cs | 1 + MediaBrowser.Controller/IO/FileData.cs | 1 + MediaBrowser.Controller/Library/ILibraryManager.cs | 1 + MediaBrowser.Controller/Library/ItemResolveArgs.cs | 1 + .../MediaBrowser.Controller.csproj | 7 + .../MediaEncoding/MediaEncoderHelpers.cs | 1 + .../Providers/DirectoryService.cs | 1 + .../Providers/IDirectoryService.cs | 1 + .../Providers/LocalImageInfo.cs | 1 + .../Providers/MetadataRefreshOptions.cs | 1 + MediaBrowser.Controller/Resolvers/IItemResolver.cs | 1 + MediaBrowser.Controller/packages.config | 2 + MediaBrowser.Dlna/DlnaManager.cs | 1 + MediaBrowser.Dlna/MediaBrowser.Dlna.csproj | 12 + MediaBrowser.Dlna/packages.config | 5 + MediaBrowser.LocalMetadata/BaseXmlProvider.cs | 1 + .../Images/CollectionFolderImageProvider.cs | 1 + .../Images/EpisodeLocalImageProvider.cs | 1 + .../Images/ImagesByNameImageProvider.cs | 1 + .../Images/InternalMetadataFolderImageProvider.cs | 1 + .../Images/LocalImageProvider.cs | 1 + .../MediaBrowser.LocalMetadata.csproj | 13 +- .../Parsers/EpisodeXmlParser.cs | 1 + .../Providers/BoxSetXmlProvider.cs | 1 + .../Providers/EpisodeXmlProvider.cs | 1 + .../Providers/FolderXmlProvider.cs | 1 + .../Providers/GameSystemXmlProvider.cs | 1 + .../Providers/GameXmlProvider.cs | 1 + .../Providers/MovieXmlProvider.cs | 1 + .../Providers/MusicVideoXmlProvider.cs | 1 + .../Providers/PersonXmlProvider.cs | 1 + .../Providers/PlaylistXmlProvider.cs | 1 + .../Providers/SeasonXmlProvider.cs | 1 + .../Providers/SeriesXmlProvider.cs | 1 + .../Providers/VideoXmlProvider.cs | 1 + .../Savers/BoxSetXmlSaver.cs | 1 + .../Savers/EpisodeXmlSaver.cs | 1 + .../Savers/FolderXmlSaver.cs | 1 + .../Savers/GameSystemXmlSaver.cs | 1 + MediaBrowser.LocalMetadata/Savers/GameXmlSaver.cs | 1 + MediaBrowser.LocalMetadata/Savers/MovieXmlSaver.cs | 1 + .../Savers/PersonXmlSaver.cs | 1 + .../Savers/PlaylistXmlSaver.cs | 1 + .../Savers/SeriesXmlSaver.cs | 1 + .../Savers/XmlSaverHelpers.cs | 1 + MediaBrowser.LocalMetadata/packages.config | 5 + .../Configuration/EncodingConfigurationFactory.cs | 1 + MediaBrowser.MediaEncoding/Encoder/AudioEncoder.cs | 1 + MediaBrowser.MediaEncoding/Encoder/BaseEncoder.cs | 1 + MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs | 1 + MediaBrowser.MediaEncoding/Encoder/VideoEncoder.cs | 1 + .../MediaBrowser.MediaEncoding.csproj | 7 + .../Probing/ProbeResultNormalizer.cs | 1 + .../Subtitles/SubtitleEncoder.cs | 1 + MediaBrowser.MediaEncoding/packages.config | 2 + .../Books/BookMetadataService.cs | 1 + .../BoxSets/BoxSetMetadataService.cs | 1 + .../BoxSets/MovieDbBoxSetProvider.cs | 1 + .../Channels/AudioChannelItemMetadataService.cs | 1 + .../Channels/ChannelMetadataService.cs | 1 + .../Channels/VideoChannelItemMetadataService.cs | 1 + .../Folders/FolderMetadataService.cs | 1 + .../Folders/UserViewMetadataService.cs | 1 + .../GameGenres/GameGenreImageProvider.cs | 1 + .../GameGenres/GameGenreMetadataService.cs | 1 + .../Games/GameMetadataService.cs | 1 + .../Games/GameSystemMetadataService.cs | 1 + .../Genres/GenreImageProvider.cs | 1 + .../Genres/GenreMetadataService.cs | 1 + MediaBrowser.Providers/ImagesByName/ImageUtils.cs | 1 + .../LiveTv/AudioRecordingService.cs | 1 + .../LiveTv/ChannelMetadataService.cs | 1 + .../LiveTv/ProgramMetadataService.cs | 1 + .../LiveTv/VideoRecordingService.cs | 1 + MediaBrowser.Providers/Manager/ImageSaver.cs | 1 + .../Manager/ItemImageProvider.cs | 1 + MediaBrowser.Providers/Manager/MetadataService.cs | 1 + MediaBrowser.Providers/Manager/ProviderManager.cs | 1 + .../MediaBrowser.Providers.csproj | 7 + .../MediaInfo/AudioImageProvider.cs | 1 + .../MediaInfo/FFProbeProvider.cs | 1 + .../MediaInfo/FFProbeVideoInfo.cs | 1 + .../MediaInfo/SubtitleResolver.cs | 1 + .../MediaInfo/VideoImageProvider.cs | 1 + .../Movies/FanArtMovieUpdatesPostScanTask.cs | 1 + .../Movies/FanartMovieImageProvider.cs | 1 + .../Movies/GenericMovieDbInfo.cs | 1 + MediaBrowser.Providers/Movies/MovieDbProvider.cs | 1 + .../Movies/MovieMetadataService.cs | 1 + .../Movies/MovieUpdatesPrescanTask.cs | 1 + .../Music/AlbumMetadataService.cs | 1 + .../Music/ArtistMetadataService.cs | 1 + .../Music/AudioDbAlbumProvider.cs | 1 + .../Music/AudioDbArtistProvider.cs | 1 + .../Music/AudioMetadataService.cs | 1 + .../Music/FanArtAlbumProvider.cs | 1 + .../Music/FanArtArtistProvider.cs | 1 + .../Music/FanArtUpdatesPostScanTask.cs | 1 + .../Music/MusicVideoMetadataService.cs | 1 + .../MusicGenres/MusicGenreImageProvider.cs | 1 + .../MusicGenres/MusicGenreMetadataService.cs | 1 + .../People/MovieDbPersonProvider.cs | 1 + .../People/PersonMetadataService.cs | 1 + .../Photos/PhotoAlbumMetadataService.cs | 1 + .../Photos/PhotoMetadataService.cs | 1 + .../Playlists/PlaylistMetadataService.cs | 1 + .../Studios/StudioMetadataService.cs | 1 + .../Studios/StudiosImageProvider.cs | 1 + .../Subtitles/SubtitleManager.cs | 1 + MediaBrowser.Providers/TV/DummySeasonProvider.cs | 1 + .../TV/EpisodeMetadataService.cs | 1 + MediaBrowser.Providers/TV/FanArtSeasonProvider.cs | 1 + .../TV/FanArtTvUpdatesPostScanTask.cs | 1 + MediaBrowser.Providers/TV/FanartSeriesProvider.cs | 1 + .../TV/MissingEpisodeProvider.cs | 1 + .../TV/MovieDbEpisodeImageProvider.cs | 1 + MediaBrowser.Providers/TV/MovieDbSeasonProvider.cs | 1 + MediaBrowser.Providers/TV/MovieDbSeriesProvider.cs | 1 + MediaBrowser.Providers/TV/SeasonMetadataService.cs | 1 + MediaBrowser.Providers/TV/SeriesMetadataService.cs | 1 + MediaBrowser.Providers/TV/SeriesPostScanTask.cs | 1 + .../TV/TvdbEpisodeImageProvider.cs | 1 + MediaBrowser.Providers/TV/TvdbEpisodeProvider.cs | 1 + MediaBrowser.Providers/TV/TvdbPrescanTask.cs | 1 + .../TV/TvdbSeasonImageProvider.cs | 1 + .../TV/TvdbSeriesImageProvider.cs | 1 + MediaBrowser.Providers/TV/TvdbSeriesProvider.cs | 1 + .../Users/UserMetadataService.cs | 1 + .../Videos/VideoMetadataService.cs | 1 + .../Years/YearMetadataService.cs | 1 + MediaBrowser.Providers/packages.config | 2 + .../Channels/ChannelManager.cs | 1 + .../Collections/CollectionImageProvider.cs | 1 + .../Collections/CollectionManager.cs | 1 + .../Collections/CollectionsDynamicFolder.cs | 1 + .../Configuration/ServerConfigurationManager.cs | 1 + .../Connect/ConnectEntryPoint.cs | 1 + .../Connect/ConnectManager.cs | 1 + .../Devices/CameraUploadsFolder.cs | 1 + .../Devices/DeviceManager.cs | 1 + .../Devices/DeviceRepository.cs | 1 + .../Dto/DtoService.cs | 1 + .../Notifications/RemoteNotifications.cs | 1 + .../FileOrganization/EpisodeFileOrganizer.cs | 1 + .../FileOrganization/FileOrganizationService.cs | 1 + .../FileOrganization/OrganizerScheduledTask.cs | 1 + .../FileOrganization/TvFolderOrganizer.cs | 1 + .../HttpServer/HttpResultFactory.cs | 1 + .../IO/LibraryMonitor.cs | 1 + .../Intros/DefaultIntroProvider.cs | 1 + .../Library/CoreResolutionIgnoreRule.cs | 1 + .../Library/LibraryManager.cs | 1 + .../Library/MediaSourceManager.cs | 1 + .../Library/ResolverHelper.cs | 1 + .../Library/Resolvers/Audio/MusicAlbumResolver.cs | 1 + .../Library/Resolvers/Audio/MusicArtistResolver.cs | 1 + .../Library/Resolvers/Movies/MovieResolver.cs | 1 + .../Library/Resolvers/SpecialFolderResolver.cs | 1 + .../Library/Resolvers/TV/SeriesResolver.cs | 1 + .../Library/UserManager.cs | 1 + .../Library/Validators/PeopleValidator.cs | 1 + .../LiveTv/EmbyTV/EmbyTV.cs | 1 + .../LiveTv/EmbyTV/ItemDataProvider.cs | 1 + .../LiveTv/EmbyTV/SeriesTimerManager.cs | 1 + .../LiveTv/EmbyTV/TimerManager.cs | 1 + .../LiveTv/LiveTvManager.cs | 1 + .../LiveTv/TunerHosts/M3UTunerHost.cs | 1 + .../Localization/LocalizationManager.cs | 1 + .../MediaBrowser.Server.Implementations.csproj | 4 + .../MediaEncoder/EncodingManager.cs | 1 + .../News/NewsEntryPoint.cs | 1 + .../Persistence/CleanDatabaseScheduledTask.cs | 1 + .../Photos/BaseDynamicImageProvider.cs | 1 + .../Photos/PhotoAlbumImageProvider.cs | 1 + .../Playlists/ManualPlaylistsFolder.cs | 1 + .../Playlists/PlaylistImageProvider.cs | 1 + .../Playlists/PlaylistManager.cs | 1 + .../ScheduledTasks/ChapterImagesTask.cs | 1 + .../ScheduledTasks/RefreshIntrosTask.cs | 1 + .../Sync/MediaSync.cs | 1 + .../Sync/MultiProviderSync.cs | 1 + .../Sync/ServerSyncScheduledTask.cs | 1 + .../Sync/SyncConvertScheduledTask.cs | 1 + .../Sync/SyncJobProcessor.cs | 1 + .../Sync/SyncManager.cs | 1 + .../Sync/TargetDataProvider.cs | 1 + .../UserViews/CollectionFolderImageProvider.cs | 1 + .../UserViews/DynamicImageProvider.cs | 1 + .../packages.config | 1 + .../MediaBrowser.Server.Mono.csproj | 7 + MediaBrowser.Server.Mono/Program.cs | 5 +- MediaBrowser.Server.Mono/packages.config | 2 + .../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 + MediaBrowser.ServerApplication/MainStartup.cs | 5 +- .../MediaBrowser.ServerApplication.csproj | 8 +- MediaBrowser.ServerApplication/Native/Autorun.cs | 1 + .../Native/NativeFileSystem.cs | 419 --------------- .../Native/WindowsApp.cs | 1 + MediaBrowser.ServerApplication/packages.config | 2 + MediaBrowser.WebDashboard/Api/DashboardService.cs | 1 + MediaBrowser.WebDashboard/Api/PackageCreator.cs | 1 + .../MediaBrowser.WebDashboard.csproj | 7 + MediaBrowser.WebDashboard/packages.config | 2 + .../MediaBrowser.XbmcMetadata.csproj | 12 + .../Providers/AlbumNfoProvider.cs | 1 + .../Providers/ArtistNfoProvider.cs | 1 + .../Providers/BaseNfoProvider.cs | 1 + .../Providers/BaseVideoNfoProvider.cs | 1 + .../Providers/EpisodeNfoProvider.cs | 1 + .../Providers/MovieNfoProvider.cs | 3 +- .../Providers/SeasonNfoProvider.cs | 1 + .../Providers/SeriesNfoProvider.cs | 1 + MediaBrowser.XbmcMetadata/Savers/AlbumNfoSaver.cs | 1 + MediaBrowser.XbmcMetadata/Savers/ArtistNfoSaver.cs | 1 + MediaBrowser.XbmcMetadata/Savers/BaseNfoSaver.cs | 1 + .../Savers/EpisodeNfoSaver.cs | 1 + MediaBrowser.XbmcMetadata/Savers/MovieNfoSaver.cs | 1 + MediaBrowser.XbmcMetadata/Savers/SeasonNfoSaver.cs | 1 + MediaBrowser.XbmcMetadata/Savers/SeriesNfoSaver.cs | 1 + MediaBrowser.XbmcMetadata/packages.config | 5 + 286 files changed, 459 insertions(+), 1309 deletions(-) delete mode 100644 MediaBrowser.Common.Implementations/IO/CommonFileSystem.cs delete mode 100644 MediaBrowser.Common/IO/FileSystemMetadata.cs delete mode 100644 MediaBrowser.Common/IO/IFileSystem.cs create mode 100644 MediaBrowser.Dlna/packages.config create mode 100644 MediaBrowser.LocalMetadata/packages.config create mode 100644 MediaBrowser.Server.Startup.Common/MbLinkShortcutHandler.cs delete mode 100644 MediaBrowser.ServerApplication/Native/NativeFileSystem.cs create mode 100644 MediaBrowser.XbmcMetadata/packages.config (limited to 'MediaBrowser.Server.Implementations/MediaEncoder/EncodingManager.cs') diff --git a/Emby.Drawing/Common/ImageHeader.cs b/Emby.Drawing/Common/ImageHeader.cs index 59df5c04f..266dcdfb8 100644 --- a/Emby.Drawing/Common/ImageHeader.cs +++ b/Emby.Drawing/Common/ImageHeader.cs @@ -5,6 +5,7 @@ using System; using System.Collections.Generic; using System.IO; using System.Linq; +using CommonIO; namespace Emby.Drawing.Common { diff --git a/Emby.Drawing/Emby.Drawing.csproj b/Emby.Drawing/Emby.Drawing.csproj index 800756ee9..c93538d61 100644 --- a/Emby.Drawing/Emby.Drawing.csproj +++ b/Emby.Drawing/Emby.Drawing.csproj @@ -32,10 +32,17 @@ 4 + + False + ..\packages\CommonIO.1.0.0.3\lib\net45\CommonIO.dll + False ..\packages\ImageMagickSharp.1.0.0.16\lib\net45\ImageMagickSharp.dll + + ..\packages\Patterns.Logging.1.0.0.2\lib\portable-net45+sl4+wp71+win8+wpa81\Patterns.Logging.dll + ..\packages\taglib.2.1.0.0\lib\policy.2.0.taglib-sharp.dll diff --git a/Emby.Drawing/GDI/DynamicImageHelpers.cs b/Emby.Drawing/GDI/DynamicImageHelpers.cs index b4a63b31e..5cedf820d 100644 --- a/Emby.Drawing/GDI/DynamicImageHelpers.cs +++ b/Emby.Drawing/GDI/DynamicImageHelpers.cs @@ -4,6 +4,7 @@ using System.Drawing; using System.Drawing.Drawing2D; using System.Drawing.Imaging; using System.IO; +using CommonIO; namespace Emby.Drawing.GDI { diff --git a/Emby.Drawing/GDI/GDIImageEncoder.cs b/Emby.Drawing/GDI/GDIImageEncoder.cs index 1eabce74e..6d0998662 100644 --- a/Emby.Drawing/GDI/GDIImageEncoder.cs +++ b/Emby.Drawing/GDI/GDIImageEncoder.cs @@ -8,6 +8,7 @@ using System.Drawing.Drawing2D; using System.Drawing.Imaging; using System.IO; using System.Linq; +using CommonIO; using ImageFormat = MediaBrowser.Model.Drawing.ImageFormat; namespace Emby.Drawing.GDI diff --git a/Emby.Drawing/ImageMagick/ImageMagickEncoder.cs b/Emby.Drawing/ImageMagick/ImageMagickEncoder.cs index 2f8577acc..146ee2d3f 100644 --- a/Emby.Drawing/ImageMagick/ImageMagickEncoder.cs +++ b/Emby.Drawing/ImageMagick/ImageMagickEncoder.cs @@ -8,6 +8,7 @@ using MediaBrowser.Model.Logging; using System; using System.IO; using System.Linq; +using CommonIO; using MediaBrowser.Common.IO; namespace Emby.Drawing.ImageMagick diff --git a/Emby.Drawing/ImageMagick/PlayedIndicatorDrawer.cs b/Emby.Drawing/ImageMagick/PlayedIndicatorDrawer.cs index b5912788f..0870b3767 100644 --- a/Emby.Drawing/ImageMagick/PlayedIndicatorDrawer.cs +++ b/Emby.Drawing/ImageMagick/PlayedIndicatorDrawer.cs @@ -5,6 +5,7 @@ using MediaBrowser.Model.Drawing; using System; using System.IO; using System.Threading.Tasks; +using CommonIO; using MediaBrowser.Common.IO; namespace Emby.Drawing.ImageMagick diff --git a/Emby.Drawing/ImageMagick/StripCollageBuilder.cs b/Emby.Drawing/ImageMagick/StripCollageBuilder.cs index 92eb1cd59..b096a4999 100644 --- a/Emby.Drawing/ImageMagick/StripCollageBuilder.cs +++ b/Emby.Drawing/ImageMagick/StripCollageBuilder.cs @@ -2,6 +2,7 @@ using MediaBrowser.Common.Configuration; using System; using System.Collections.Generic; +using CommonIO; using MediaBrowser.Common.IO; namespace Emby.Drawing.ImageMagick diff --git a/Emby.Drawing/ImageMagick/UnplayedCountIndicator.cs b/Emby.Drawing/ImageMagick/UnplayedCountIndicator.cs index 92601313a..d3d9c1e7a 100644 --- a/Emby.Drawing/ImageMagick/UnplayedCountIndicator.cs +++ b/Emby.Drawing/ImageMagick/UnplayedCountIndicator.cs @@ -3,6 +3,7 @@ using MediaBrowser.Common.Configuration; using MediaBrowser.Common.IO; using MediaBrowser.Model.Drawing; using System.Globalization; +using CommonIO; namespace Emby.Drawing.ImageMagick { diff --git a/Emby.Drawing/ImageProcessor.cs b/Emby.Drawing/ImageProcessor.cs index 3e5dca9b7..4eecaaced 100644 --- a/Emby.Drawing/ImageProcessor.cs +++ b/Emby.Drawing/ImageProcessor.cs @@ -16,6 +16,7 @@ using System.IO; using System.Linq; using System.Threading; using System.Threading.Tasks; +using CommonIO; using Emby.Drawing.Common; namespace Emby.Drawing diff --git a/Emby.Drawing/packages.config b/Emby.Drawing/packages.config index acbd2ee3a..bf2f4ff74 100644 --- a/Emby.Drawing/packages.config +++ b/Emby.Drawing/packages.config @@ -1,4 +1,6 @@  + + \ No newline at end of file diff --git a/MediaBrowser.Api/ApiEntryPoint.cs b/MediaBrowser.Api/ApiEntryPoint.cs index 3faa6e63b..7f4db5a89 100644 --- a/MediaBrowser.Api/ApiEntryPoint.cs +++ b/MediaBrowser.Api/ApiEntryPoint.cs @@ -15,6 +15,7 @@ using System.IO; using System.Linq; using System.Threading; using System.Threading.Tasks; +using CommonIO; namespace MediaBrowser.Api { diff --git a/MediaBrowser.Api/ConfigurationService.cs b/MediaBrowser.Api/ConfigurationService.cs index f266180a4..f33a30892 100644 --- a/MediaBrowser.Api/ConfigurationService.cs +++ b/MediaBrowser.Api/ConfigurationService.cs @@ -11,6 +11,7 @@ using ServiceStack.Web; using System.Collections.Generic; using System.IO; using System.Linq; +using CommonIO; namespace MediaBrowser.Api { diff --git a/MediaBrowser.Api/EnvironmentService.cs b/MediaBrowser.Api/EnvironmentService.cs index 81b326da8..3a31fc1d2 100644 --- a/MediaBrowser.Api/EnvironmentService.cs +++ b/MediaBrowser.Api/EnvironmentService.cs @@ -9,6 +9,7 @@ using System.Collections.Generic; using System.Globalization; using System.IO; using System.Linq; +using CommonIO; namespace MediaBrowser.Api { diff --git a/MediaBrowser.Api/Images/ImageByNameService.cs b/MediaBrowser.Api/Images/ImageByNameService.cs index a6e1af516..1e0ca3438 100644 --- a/MediaBrowser.Api/Images/ImageByNameService.cs +++ b/MediaBrowser.Api/Images/ImageByNameService.cs @@ -9,6 +9,7 @@ using System; using System.Collections.Generic; using System.IO; using System.Linq; +using CommonIO; namespace MediaBrowser.Api.Images { diff --git a/MediaBrowser.Api/Images/ImageService.cs b/MediaBrowser.Api/Images/ImageService.cs index b8ea62137..d264b896d 100644 --- a/MediaBrowser.Api/Images/ImageService.cs +++ b/MediaBrowser.Api/Images/ImageService.cs @@ -17,6 +17,7 @@ using System.IO; using System.Linq; using System.Threading; using System.Threading.Tasks; +using CommonIO; using MimeTypes = MediaBrowser.Model.Net.MimeTypes; namespace MediaBrowser.Api.Images diff --git a/MediaBrowser.Api/Images/RemoteImageService.cs b/MediaBrowser.Api/Images/RemoteImageService.cs index c67ef96c9..9683632b2 100644 --- a/MediaBrowser.Api/Images/RemoteImageService.cs +++ b/MediaBrowser.Api/Images/RemoteImageService.cs @@ -16,6 +16,7 @@ using System.IO; using System.Linq; using System.Threading; using System.Threading.Tasks; +using CommonIO; namespace MediaBrowser.Api.Images { diff --git a/MediaBrowser.Api/ItemLookupService.cs b/MediaBrowser.Api/ItemLookupService.cs index 9f7f57155..f453036d7 100644 --- a/MediaBrowser.Api/ItemLookupService.cs +++ b/MediaBrowser.Api/ItemLookupService.cs @@ -16,6 +16,7 @@ using System.IO; using System.Linq; using System.Threading; using System.Threading.Tasks; +using CommonIO; namespace MediaBrowser.Api { diff --git a/MediaBrowser.Api/ItemRefreshService.cs b/MediaBrowser.Api/ItemRefreshService.cs index 1e74b3692..af1f1c90a 100644 --- a/MediaBrowser.Api/ItemRefreshService.cs +++ b/MediaBrowser.Api/ItemRefreshService.cs @@ -4,6 +4,7 @@ using MediaBrowser.Controller.Net; using MediaBrowser.Controller.Providers; using ServiceStack; using System.Threading; +using CommonIO; using MediaBrowser.Common.IO; namespace MediaBrowser.Api diff --git a/MediaBrowser.Api/Library/LibraryHelpers.cs b/MediaBrowser.Api/Library/LibraryHelpers.cs index 877321b77..c18c90b20 100644 --- a/MediaBrowser.Api/Library/LibraryHelpers.cs +++ b/MediaBrowser.Api/Library/LibraryHelpers.cs @@ -3,6 +3,7 @@ using MediaBrowser.Controller; using System; using System.IO; using System.Linq; +using CommonIO; namespace MediaBrowser.Api.Library { diff --git a/MediaBrowser.Api/Library/LibraryService.cs b/MediaBrowser.Api/Library/LibraryService.cs index 20fd1ef40..319bc13fd 100644 --- a/MediaBrowser.Api/Library/LibraryService.cs +++ b/MediaBrowser.Api/Library/LibraryService.cs @@ -27,6 +27,7 @@ using System.IO; using System.Linq; using System.Threading; using System.Threading.Tasks; +using CommonIO; using MediaBrowser.Common.IO; namespace MediaBrowser.Api.Library diff --git a/MediaBrowser.Api/Library/LibraryStructureService.cs b/MediaBrowser.Api/Library/LibraryStructureService.cs index c8731637c..42c6ef6e5 100644 --- a/MediaBrowser.Api/Library/LibraryStructureService.cs +++ b/MediaBrowser.Api/Library/LibraryStructureService.cs @@ -10,6 +10,7 @@ using System.IO; using System.Linq; using System.Threading; using System.Threading.Tasks; +using CommonIO; namespace MediaBrowser.Api.Library { diff --git a/MediaBrowser.Api/MediaBrowser.Api.csproj b/MediaBrowser.Api/MediaBrowser.Api.csproj index 901dd11e2..9e70fc5f3 100644 --- a/MediaBrowser.Api/MediaBrowser.Api.csproj +++ b/MediaBrowser.Api/MediaBrowser.Api.csproj @@ -46,6 +46,13 @@ Always + + False + ..\packages\CommonIO.1.0.0.3\lib\net45\CommonIO.dll + + + ..\packages\Patterns.Logging.1.0.0.2\lib\portable-net45+sl4+wp71+win8+wpa81\Patterns.Logging.dll + diff --git a/MediaBrowser.Api/Playback/BaseStreamingService.cs b/MediaBrowser.Api/Playback/BaseStreamingService.cs index 8e5061d62..4cf97d48b 100644 --- a/MediaBrowser.Api/Playback/BaseStreamingService.cs +++ b/MediaBrowser.Api/Playback/BaseStreamingService.cs @@ -23,6 +23,7 @@ using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; +using CommonIO; namespace MediaBrowser.Api.Playback { diff --git a/MediaBrowser.Api/Playback/Dash/MpegDashService.cs b/MediaBrowser.Api/Playback/Dash/MpegDashService.cs index 5a36b0aa2..49d3db110 100644 --- a/MediaBrowser.Api/Playback/Dash/MpegDashService.cs +++ b/MediaBrowser.Api/Playback/Dash/MpegDashService.cs @@ -17,6 +17,7 @@ using System.IO; using System.Linq; using System.Threading; using System.Threading.Tasks; +using CommonIO; using MimeTypes = MediaBrowser.Model.Net.MimeTypes; namespace MediaBrowser.Api.Playback.Dash diff --git a/MediaBrowser.Api/Playback/Hls/BaseHlsService.cs b/MediaBrowser.Api/Playback/Hls/BaseHlsService.cs index a9a9610a9..60412159c 100644 --- a/MediaBrowser.Api/Playback/Hls/BaseHlsService.cs +++ b/MediaBrowser.Api/Playback/Hls/BaseHlsService.cs @@ -15,6 +15,7 @@ using System.IO; using System.Text; using System.Threading; using System.Threading.Tasks; +using CommonIO; namespace MediaBrowser.Api.Playback.Hls { diff --git a/MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs b/MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs index 39bdee699..6ca2677e7 100644 --- a/MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs +++ b/MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs @@ -20,6 +20,7 @@ using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; +using CommonIO; using MimeTypes = MediaBrowser.Model.Net.MimeTypes; namespace MediaBrowser.Api.Playback.Hls diff --git a/MediaBrowser.Api/Playback/Hls/VideoHlsService.cs b/MediaBrowser.Api/Playback/Hls/VideoHlsService.cs index 2d1abf7e9..c5392b38f 100644 --- a/MediaBrowser.Api/Playback/Hls/VideoHlsService.cs +++ b/MediaBrowser.Api/Playback/Hls/VideoHlsService.cs @@ -8,6 +8,7 @@ using MediaBrowser.Model.IO; using MediaBrowser.Model.Serialization; using ServiceStack; using System; +using CommonIO; namespace MediaBrowser.Api.Playback.Hls { diff --git a/MediaBrowser.Api/Playback/Progressive/AudioService.cs b/MediaBrowser.Api/Playback/Progressive/AudioService.cs index 67a9cab58..ada4761c7 100644 --- a/MediaBrowser.Api/Playback/Progressive/AudioService.cs +++ b/MediaBrowser.Api/Playback/Progressive/AudioService.cs @@ -11,6 +11,7 @@ using MediaBrowser.Model.IO; using MediaBrowser.Model.Serialization; using ServiceStack; using System.Collections.Generic; +using CommonIO; namespace MediaBrowser.Api.Playback.Progressive { diff --git a/MediaBrowser.Api/Playback/Progressive/BaseProgressiveStreamingService.cs b/MediaBrowser.Api/Playback/Progressive/BaseProgressiveStreamingService.cs index aa0cda133..61c3e9aa8 100644 --- a/MediaBrowser.Api/Playback/Progressive/BaseProgressiveStreamingService.cs +++ b/MediaBrowser.Api/Playback/Progressive/BaseProgressiveStreamingService.cs @@ -17,6 +17,7 @@ using System.Globalization; using System.IO; using System.Threading; using System.Threading.Tasks; +using CommonIO; namespace MediaBrowser.Api.Playback.Progressive { diff --git a/MediaBrowser.Api/Playback/Progressive/ProgressiveStreamWriter.cs b/MediaBrowser.Api/Playback/Progressive/ProgressiveStreamWriter.cs index adedd9461..2719b1faf 100644 --- a/MediaBrowser.Api/Playback/Progressive/ProgressiveStreamWriter.cs +++ b/MediaBrowser.Api/Playback/Progressive/ProgressiveStreamWriter.cs @@ -5,6 +5,7 @@ using System; using System.Collections.Generic; using System.IO; using System.Threading.Tasks; +using CommonIO; namespace MediaBrowser.Api.Playback.Progressive { diff --git a/MediaBrowser.Api/Playback/Progressive/VideoService.cs b/MediaBrowser.Api/Playback/Progressive/VideoService.cs index 1dfb43387..d79040dd4 100644 --- a/MediaBrowser.Api/Playback/Progressive/VideoService.cs +++ b/MediaBrowser.Api/Playback/Progressive/VideoService.cs @@ -11,6 +11,7 @@ using MediaBrowser.Model.Serialization; using ServiceStack; using System; using System.IO; +using CommonIO; namespace MediaBrowser.Api.Playback.Progressive { diff --git a/MediaBrowser.Api/Subtitles/SubtitleService.cs b/MediaBrowser.Api/Subtitles/SubtitleService.cs index 0bfe7354d..37034751d 100644 --- a/MediaBrowser.Api/Subtitles/SubtitleService.cs +++ b/MediaBrowser.Api/Subtitles/SubtitleService.cs @@ -15,6 +15,7 @@ using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; +using CommonIO; using MimeTypes = MediaBrowser.Model.Net.MimeTypes; using MediaBrowser.Common.IO; diff --git a/MediaBrowser.Api/System/SystemService.cs b/MediaBrowser.Api/System/SystemService.cs index 4ad8b3903..a95fcb542 100644 --- a/MediaBrowser.Api/System/SystemService.cs +++ b/MediaBrowser.Api/System/SystemService.cs @@ -12,6 +12,7 @@ using System.Collections.Generic; using System.IO; using System.Linq; using System.Threading.Tasks; +using CommonIO; namespace MediaBrowser.Api.System { diff --git a/MediaBrowser.Api/VideosService.cs b/MediaBrowser.Api/VideosService.cs index a65bee7ef..0cffbb42c 100644 --- a/MediaBrowser.Api/VideosService.cs +++ b/MediaBrowser.Api/VideosService.cs @@ -11,6 +11,7 @@ using System; using System.Linq; using System.Threading; using System.Threading.Tasks; +using CommonIO; namespace MediaBrowser.Api { diff --git a/MediaBrowser.Api/packages.config b/MediaBrowser.Api/packages.config index 0cdb26bd5..307021704 100644 --- a/MediaBrowser.Api/packages.config +++ b/MediaBrowser.Api/packages.config @@ -1,4 +1,6 @@  + + \ No newline at end of file diff --git a/MediaBrowser.Common.Implementations/Archiving/ZipClient.cs b/MediaBrowser.Common.Implementations/Archiving/ZipClient.cs index 1377e9d55..0009c7193 100644 --- a/MediaBrowser.Common.Implementations/Archiving/ZipClient.cs +++ b/MediaBrowser.Common.Implementations/Archiving/ZipClient.cs @@ -7,6 +7,7 @@ using SharpCompress.Reader; using SharpCompress.Reader.Zip; using System; using System.IO; +using CommonIO; using MediaBrowser.Common.IO; namespace MediaBrowser.Common.Implementations.Archiving diff --git a/MediaBrowser.Common.Implementations/BaseApplicationHost.cs b/MediaBrowser.Common.Implementations/BaseApplicationHost.cs index af41635f3..97c856035 100644 --- a/MediaBrowser.Common.Implementations/BaseApplicationHost.cs +++ b/MediaBrowser.Common.Implementations/BaseApplicationHost.cs @@ -30,6 +30,7 @@ using System.Reflection; using System.Text; using System.Threading; using System.Threading.Tasks; +using CommonIO; namespace MediaBrowser.Common.Implementations { diff --git a/MediaBrowser.Common.Implementations/Devices/DeviceId.cs b/MediaBrowser.Common.Implementations/Devices/DeviceId.cs index 39f11fabf..4cad3cd31 100644 --- a/MediaBrowser.Common.Implementations/Devices/DeviceId.cs +++ b/MediaBrowser.Common.Implementations/Devices/DeviceId.cs @@ -3,6 +3,7 @@ using MediaBrowser.Model.Logging; using System; using System.IO; using System.Text; +using CommonIO; using MediaBrowser.Common.IO; namespace MediaBrowser.Common.Implementations.Devices diff --git a/MediaBrowser.Common.Implementations/HttpClientManager/HttpClientManager.cs b/MediaBrowser.Common.Implementations/HttpClientManager/HttpClientManager.cs index 7157f6325..48d674432 100644 --- a/MediaBrowser.Common.Implementations/HttpClientManager/HttpClientManager.cs +++ b/MediaBrowser.Common.Implementations/HttpClientManager/HttpClientManager.cs @@ -17,6 +17,7 @@ using System.Net.Cache; using System.Text; using System.Threading; using System.Threading.Tasks; +using CommonIO; namespace MediaBrowser.Common.Implementations.HttpClientManager { diff --git a/MediaBrowser.Common.Implementations/IO/CommonFileSystem.cs b/MediaBrowser.Common.Implementations/IO/CommonFileSystem.cs deleted file mode 100644 index f13b9b1a9..000000000 --- a/MediaBrowser.Common.Implementations/IO/CommonFileSystem.cs +++ /dev/null @@ -1,559 +0,0 @@ -using MediaBrowser.Model.Extensions; -using MediaBrowser.Common.IO; -using MediaBrowser.Model.Logging; -using System; -using System.IO; -using System.Text; -using System.Collections.Generic; -using System.Linq; - -namespace MediaBrowser.Common.Implementations.IO -{ - /// - /// Class CommonFileSystem - /// - public class CommonFileSystem : IFileSystem - { - protected ILogger Logger; - - private readonly bool _supportsAsyncFileStreams; - private char[] _invalidFileNameChars; - - public CommonFileSystem(ILogger logger, bool supportsAsyncFileStreams, bool usePresetInvalidFileNameChars) - { - Logger = logger; - _supportsAsyncFileStreams = supportsAsyncFileStreams; - - SetInvalidFileNameChars(usePresetInvalidFileNameChars); - } - - protected void SetInvalidFileNameChars(bool usePresetInvalidFileNameChars) - { - // GetInvalidFileNameChars is less restrictive in Linux/Mac than Windows, this mimic Windows behavior for mono under Linux/Mac. - - if (usePresetInvalidFileNameChars) - { - _invalidFileNameChars = new char[41] { '\x00', '\x01', '\x02', '\x03', '\x04', '\x05', '\x06', '\x07', - '\x08', '\x09', '\x0A', '\x0B', '\x0C', '\x0D', '\x0E', '\x0F', '\x10', '\x11', '\x12', - '\x13', '\x14', '\x15', '\x16', '\x17', '\x18', '\x19', '\x1A', '\x1B', '\x1C', '\x1D', - '\x1E', '\x1F', '\x22', '\x3C', '\x3E', '\x7C', ':', '*', '?', '\\', '/' }; - } - else - { - _invalidFileNameChars = Path.GetInvalidFileNameChars(); - } - } - - /// - /// Determines whether the specified filename is shortcut. - /// - /// The filename. - /// true if the specified filename is shortcut; otherwise, false. - /// filename - public virtual bool IsShortcut(string filename) - { - if (string.IsNullOrEmpty(filename)) - { - throw new ArgumentNullException("filename"); - } - - var extension = Path.GetExtension(filename); - - return string.Equals(extension, ".mblink", StringComparison.OrdinalIgnoreCase); - } - - /// - /// Resolves the shortcut. - /// - /// The filename. - /// System.String. - /// filename - public virtual string ResolveShortcut(string filename) - { - if (string.IsNullOrEmpty(filename)) - { - throw new ArgumentNullException("filename"); - } - - if (string.Equals(Path.GetExtension(filename), ".mblink", StringComparison.OrdinalIgnoreCase)) - { - var path = ReadAllText(filename); - - return NormalizePath(path); - } - - return null; - } - - /// - /// Creates the shortcut. - /// - /// The shortcut path. - /// The target. - /// - /// shortcutPath - /// or - /// target - /// - public void CreateShortcut(string shortcutPath, string target) - { - if (string.IsNullOrEmpty(shortcutPath)) - { - throw new ArgumentNullException("shortcutPath"); - } - - if (string.IsNullOrEmpty(target)) - { - throw new ArgumentNullException("target"); - } - - File.WriteAllText(shortcutPath, target); - } - - /// - /// Gets the file system info. - /// - /// The path. - /// FileSystemInfo. - public FileSystemMetadata GetFileSystemInfo(string path) - { - if (string.IsNullOrEmpty(path)) - { - throw new ArgumentNullException("path"); - } - - // Take a guess to try and avoid two file system hits, but we'll double-check by calling Exists - if (Path.HasExtension(path)) - { - var fileInfo = new FileInfo(path); - - if (fileInfo.Exists) - { - return GetFileSystemMetadata(fileInfo); - } - - return GetFileSystemMetadata(new DirectoryInfo(path)); - } - else - { - var fileInfo = new DirectoryInfo(path); - - if (fileInfo.Exists) - { - return GetFileSystemMetadata(fileInfo); - } - - return GetFileSystemMetadata(new FileInfo(path)); - } - } - - public FileSystemMetadata GetFileInfo(string path) - { - if (string.IsNullOrEmpty(path)) - { - throw new ArgumentNullException("path"); - } - - var fileInfo = new FileInfo(path); - - return GetFileSystemMetadata(fileInfo); - } - - public FileSystemMetadata GetDirectoryInfo(string path) - { - if (string.IsNullOrEmpty(path)) - { - throw new ArgumentNullException("path"); - } - - var fileInfo = new DirectoryInfo(path); - - return GetFileSystemMetadata(fileInfo); - } - - private FileSystemMetadata GetFileSystemMetadata(FileSystemInfo info) - { - var result = new FileSystemMetadata(); - - result.Attributes = info.Attributes; - result.Exists = info.Exists; - result.FullName = info.FullName; - result.Extension = info.Extension; - result.Name = info.Name; - - if (result.Exists) - { - var fileInfo = info as FileInfo; - if (fileInfo != null) - { - result.Length = fileInfo.Length; - result.DirectoryName = fileInfo.DirectoryName; - } - - result.CreationTimeUtc = GetCreationTimeUtc(info); - result.LastWriteTimeUtc = GetLastWriteTimeUtc(info); - } - - return result; - } - - /// - /// The space char - /// - private const char SpaceChar = ' '; - - /// - /// Takes a filename and removes invalid characters - /// - /// The filename. - /// System.String. - /// filename - public string GetValidFilename(string filename) - { - if (string.IsNullOrEmpty(filename)) - { - throw new ArgumentNullException("filename"); - } - - var builder = new StringBuilder(filename); - - foreach (var c in _invalidFileNameChars) - { - builder = builder.Replace(c, SpaceChar); - } - - return builder.ToString(); - } - - /// - /// Gets the creation time UTC. - /// - /// The info. - /// DateTime. - public DateTime GetCreationTimeUtc(FileSystemInfo info) - { - // This could throw an error on some file systems that have dates out of range - try - { - return info.CreationTimeUtc; - } - catch (Exception ex) - { - Logger.ErrorException("Error determining CreationTimeUtc for {0}", ex, info.FullName); - return DateTime.MinValue; - } - } - - /// - /// Gets the creation time UTC. - /// - /// The path. - /// DateTime. - public DateTime GetCreationTimeUtc(string path) - { - return GetCreationTimeUtc(GetFileSystemInfo(path)); - } - - public DateTime GetCreationTimeUtc(FileSystemMetadata info) - { - return info.CreationTimeUtc; - } - - public DateTime GetLastWriteTimeUtc(FileSystemMetadata info) - { - return info.LastWriteTimeUtc; - } - - /// - /// Gets the creation time UTC. - /// - /// The info. - /// DateTime. - public DateTime GetLastWriteTimeUtc(FileSystemInfo info) - { - // This could throw an error on some file systems that have dates out of range - try - { - return info.LastWriteTimeUtc; - } - catch (Exception ex) - { - Logger.ErrorException("Error determining LastAccessTimeUtc for {0}", ex, info.FullName); - return DateTime.MinValue; - } - } - - /// - /// Gets the last write time UTC. - /// - /// The path. - /// DateTime. - public DateTime GetLastWriteTimeUtc(string path) - { - return GetLastWriteTimeUtc(GetFileSystemInfo(path)); - } - - /// - /// Gets the file stream. - /// - /// The path. - /// The mode. - /// The access. - /// The share. - /// if set to true [is asynchronous]. - /// FileStream. - public Stream GetFileStream(string path, FileMode mode, FileAccess access, FileShare share, bool isAsync = false) - { - if (_supportsAsyncFileStreams && isAsync) - { - return new FileStream(path, mode, access, share, StreamDefaults.DefaultFileStreamBufferSize, true); - } - - return new FileStream(path, mode, access, share, StreamDefaults.DefaultFileStreamBufferSize); - } - - /// - /// Swaps the files. - /// - /// The file1. - /// The file2. - public void SwapFiles(string file1, string file2) - { - if (string.IsNullOrEmpty(file1)) - { - throw new ArgumentNullException("file1"); - } - - if (string.IsNullOrEmpty(file2)) - { - throw new ArgumentNullException("file2"); - } - - var temp1 = Path.GetTempFileName(); - var temp2 = Path.GetTempFileName(); - - // Copying over will fail against hidden files - RemoveHiddenAttribute(file1); - RemoveHiddenAttribute(file2); - - CopyFile(file1, temp1, true); - CopyFile(file2, temp2, true); - - CopyFile(temp1, file2, true); - CopyFile(temp2, file1, true); - - DeleteFile(temp1); - DeleteFile(temp2); - } - - /// - /// Removes the hidden attribute. - /// - /// The path. - private void RemoveHiddenAttribute(string path) - { - if (string.IsNullOrEmpty(path)) - { - throw new ArgumentNullException("path"); - } - - var currentFile = new FileInfo(path); - - // This will fail if the file is hidden - if (currentFile.Exists) - { - if ((currentFile.Attributes & FileAttributes.Hidden) == FileAttributes.Hidden) - { - currentFile.Attributes &= ~FileAttributes.Hidden; - } - } - } - - public bool ContainsSubPath(string parentPath, string path) - { - if (string.IsNullOrEmpty(parentPath)) - { - throw new ArgumentNullException("parentPath"); - } - - if (string.IsNullOrEmpty(path)) - { - throw new ArgumentNullException("path"); - } - - return path.IndexOf(parentPath.TrimEnd(Path.DirectorySeparatorChar) + Path.DirectorySeparatorChar, StringComparison.OrdinalIgnoreCase) != -1; - } - - public bool IsRootPath(string path) - { - if (string.IsNullOrEmpty(path)) - { - throw new ArgumentNullException("path"); - } - - var parent = Path.GetDirectoryName(path); - - if (!string.IsNullOrEmpty(parent)) - { - return false; - } - - return true; - } - - public string NormalizePath(string path) - { - if (string.IsNullOrEmpty(path)) - { - throw new ArgumentNullException("path"); - } - - if (path.EndsWith(":\\", StringComparison.OrdinalIgnoreCase)) - { - return path; - } - - return path.TrimEnd(Path.DirectorySeparatorChar); - } - - public string GetFileNameWithoutExtension(FileSystemMetadata info) - { - if (info.IsDirectory) - { - return info.Name; - } - - return Path.GetFileNameWithoutExtension(info.FullName); - } - - public string GetFileNameWithoutExtension(string path) - { - return Path.GetFileNameWithoutExtension(path); - } - - public bool IsPathFile(string path) - { - if (string.IsNullOrWhiteSpace(path)) - { - throw new ArgumentNullException("path"); - } - - // Cannot use Path.IsPathRooted because it returns false under mono when using windows-based paths, e.g. C:\\ - - if (path.IndexOf("://", StringComparison.OrdinalIgnoreCase) != -1 && - !path.StartsWith("file://", StringComparison.OrdinalIgnoreCase)) - { - return false; - } - return true; - - //return Path.IsPathRooted(path); - } - - public void DeleteFile(string path) - { - File.Delete(path); - } - - public void DeleteDirectory(string path, bool recursive) - { - Directory.Delete(path, recursive); - } - - public void CreateDirectory(string path) - { - Directory.CreateDirectory(path); - } - - public IEnumerable GetDirectories(string path, bool recursive = false) - { - var searchOption = recursive ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly; - - return new DirectoryInfo(path).EnumerateDirectories("*", searchOption).Select(GetFileSystemMetadata); - } - - public IEnumerable GetFiles(string path, bool recursive = false) - { - var searchOption = recursive ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly; - - return new DirectoryInfo (path).EnumerateFiles("*", searchOption).Select(GetFileSystemMetadata); - } - - public IEnumerable GetFileSystemEntries(string path, bool recursive = false) - { - var directoryInfo = new DirectoryInfo (path); - var searchOption = recursive ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly; - - return directoryInfo.EnumerateDirectories("*", searchOption).Select(GetFileSystemMetadata) - .Concat(directoryInfo.EnumerateFiles("*", searchOption).Select(GetFileSystemMetadata)); - } - - public Stream OpenRead(string path) - { - return File.OpenRead(path); - } - - public void CopyFile(string source, string target, bool overwrite) - { - File.Copy(source, target, overwrite); - } - - public void MoveFile(string source, string target) - { - File.Move(source, target); - } - - public void MoveDirectory(string source, string target) - { - Directory.Move(source, target); - } - - public bool DirectoryExists(string path) - { - return Directory.Exists(path); - } - - public bool FileExists(string path) - { - return File.Exists(path); - } - - public string ReadAllText(string path) - { - return File.ReadAllText(path); - } - - public void WriteAllText(string path, string text, Encoding encoding) - { - File.WriteAllText(path, text, encoding); - } - - public void WriteAllText(string path, string text) - { - File.WriteAllText(path, text); - } - - public string ReadAllText(string path, Encoding encoding) - { - return File.ReadAllText(path, encoding); - } - - public IEnumerable GetDirectoryPaths(string path, bool recursive = false) - { - var searchOption = recursive ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly; - return Directory.EnumerateDirectories(path, "*", searchOption); - } - - public IEnumerable GetFilePaths(string path, bool recursive = false) - { - var searchOption = recursive ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly; - return Directory.EnumerateFiles(path, "*", searchOption); - } - - public IEnumerable GetFileSystemEntryPaths(string path, bool recursive = false) - { - var searchOption = recursive ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly; - return Directory.EnumerateFileSystemEntries(path, "*", searchOption); - } - } -} diff --git a/MediaBrowser.Common.Implementations/MediaBrowser.Common.Implementations.csproj b/MediaBrowser.Common.Implementations/MediaBrowser.Common.Implementations.csproj index eb1122902..a195415d0 100644 --- a/MediaBrowser.Common.Implementations/MediaBrowser.Common.Implementations.csproj +++ b/MediaBrowser.Common.Implementations/MediaBrowser.Common.Implementations.csproj @@ -48,10 +48,17 @@ Always + + False + ..\packages\CommonIO.1.0.0.3\lib\net45\CommonIO.dll + False ..\packages\NLog.4.1.1\lib\net45\NLog.dll + + ..\packages\Patterns.Logging.1.0.0.2\lib\portable-net45+sl4+wp71+win8+wpa81\Patterns.Logging.dll + False ..\ThirdParty\SharpCompress\SharpCompress.dll @@ -81,7 +88,6 @@ - diff --git a/MediaBrowser.Common.Implementations/ScheduledTasks/ScheduledTaskWorker.cs b/MediaBrowser.Common.Implementations/ScheduledTasks/ScheduledTaskWorker.cs index 906184c75..f2b235bd9 100644 --- a/MediaBrowser.Common.Implementations/ScheduledTasks/ScheduledTaskWorker.cs +++ b/MediaBrowser.Common.Implementations/ScheduledTasks/ScheduledTaskWorker.cs @@ -12,6 +12,7 @@ using System.IO; using System.Linq; using System.Threading; using System.Threading.Tasks; +using CommonIO; using MediaBrowser.Common.IO; namespace MediaBrowser.Common.Implementations.ScheduledTasks diff --git a/MediaBrowser.Common.Implementations/ScheduledTasks/TaskManager.cs b/MediaBrowser.Common.Implementations/ScheduledTasks/TaskManager.cs index 9419bdf22..6c72441aa 100644 --- a/MediaBrowser.Common.Implementations/ScheduledTasks/TaskManager.cs +++ b/MediaBrowser.Common.Implementations/ScheduledTasks/TaskManager.cs @@ -10,6 +10,7 @@ using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; +using CommonIO; using MediaBrowser.Common.IO; namespace MediaBrowser.Common.Implementations.ScheduledTasks diff --git a/MediaBrowser.Common.Implementations/ScheduledTasks/Tasks/DeleteCacheFileTask.cs b/MediaBrowser.Common.Implementations/ScheduledTasks/Tasks/DeleteCacheFileTask.cs index ec48bb5dc..0e50f9315 100644 --- a/MediaBrowser.Common.Implementations/ScheduledTasks/Tasks/DeleteCacheFileTask.cs +++ b/MediaBrowser.Common.Implementations/ScheduledTasks/Tasks/DeleteCacheFileTask.cs @@ -8,6 +8,7 @@ using System.IO; using System.Linq; using System.Threading; using System.Threading.Tasks; +using CommonIO; namespace MediaBrowser.Common.Implementations.ScheduledTasks.Tasks { diff --git a/MediaBrowser.Common.Implementations/ScheduledTasks/Tasks/DeleteLogFileTask.cs b/MediaBrowser.Common.Implementations/ScheduledTasks/Tasks/DeleteLogFileTask.cs index ffba3d9da..8507d3184 100644 --- a/MediaBrowser.Common.Implementations/ScheduledTasks/Tasks/DeleteLogFileTask.cs +++ b/MediaBrowser.Common.Implementations/ScheduledTasks/Tasks/DeleteLogFileTask.cs @@ -7,6 +7,7 @@ using System.IO; using System.Linq; using System.Threading; using System.Threading.Tasks; +using CommonIO; namespace MediaBrowser.Common.Implementations.ScheduledTasks.Tasks { diff --git a/MediaBrowser.Common.Implementations/Serialization/JsonSerializer.cs b/MediaBrowser.Common.Implementations/Serialization/JsonSerializer.cs index a758a0c1e..269294b36 100644 --- a/MediaBrowser.Common.Implementations/Serialization/JsonSerializer.cs +++ b/MediaBrowser.Common.Implementations/Serialization/JsonSerializer.cs @@ -2,6 +2,7 @@ using MediaBrowser.Model.Serialization; using System; using System.IO; +using CommonIO; namespace MediaBrowser.Common.Implementations.Serialization { diff --git a/MediaBrowser.Common.Implementations/Serialization/XmlSerializer.cs b/MediaBrowser.Common.Implementations/Serialization/XmlSerializer.cs index 41a59fb2b..449c23b2d 100644 --- a/MediaBrowser.Common.Implementations/Serialization/XmlSerializer.cs +++ b/MediaBrowser.Common.Implementations/Serialization/XmlSerializer.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Concurrent; using System.IO; using System.Xml; +using CommonIO; using MediaBrowser.Common.IO; namespace MediaBrowser.Common.Implementations.Serialization diff --git a/MediaBrowser.Common.Implementations/Updates/InstallationManager.cs b/MediaBrowser.Common.Implementations/Updates/InstallationManager.cs index 12afdd8d7..dc642a0a8 100644 --- a/MediaBrowser.Common.Implementations/Updates/InstallationManager.cs +++ b/MediaBrowser.Common.Implementations/Updates/InstallationManager.cs @@ -19,6 +19,7 @@ using System.Linq; using System.Security.Cryptography; using System.Threading; using System.Threading.Tasks; +using CommonIO; namespace MediaBrowser.Common.Implementations.Updates { diff --git a/MediaBrowser.Common.Implementations/packages.config b/MediaBrowser.Common.Implementations/packages.config index 151a3a36d..eb48d9d67 100644 --- a/MediaBrowser.Common.Implementations/packages.config +++ b/MediaBrowser.Common.Implementations/packages.config @@ -1,5 +1,7 @@  + + diff --git a/MediaBrowser.Common/IO/FileSystemMetadata.cs b/MediaBrowser.Common/IO/FileSystemMetadata.cs deleted file mode 100644 index ba8a1b8b8..000000000 --- a/MediaBrowser.Common/IO/FileSystemMetadata.cs +++ /dev/null @@ -1,32 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace MediaBrowser.Common.IO -{ - public class FileSystemMetadata - { - public FileAttributes Attributes { get; set; } - - public bool Exists { get; set; } - public string FullName { get; set; } - public string Name { get; set; } - public string Extension { get; set; } - public long Length { get; set; } - public string DirectoryName { get; set; } - - public DateTime LastWriteTimeUtc { get; set; } - public DateTime CreationTimeUtc { get; set; } - - public bool IsDirectory - { - get - { - return (Attributes & FileAttributes.Directory) == FileAttributes.Directory; - } - } - } -} diff --git a/MediaBrowser.Common/IO/IFileSystem.cs b/MediaBrowser.Common/IO/IFileSystem.cs deleted file mode 100644 index e084f94ed..000000000 --- a/MediaBrowser.Common/IO/IFileSystem.cs +++ /dev/null @@ -1,291 +0,0 @@ -using System; -using System.IO; -using System.Collections.Generic; -using System.Text; - -namespace MediaBrowser.Common.IO -{ - /// - /// Interface IFileSystem - /// - public interface IFileSystem - { - /// - /// Determines whether the specified filename is shortcut. - /// - /// The filename. - /// true if the specified filename is shortcut; otherwise, false. - bool IsShortcut(string filename); - - /// - /// Resolves the shortcut. - /// - /// The filename. - /// System.String. - string ResolveShortcut(string filename); - - /// - /// Creates the shortcut. - /// - /// The shortcut path. - /// The target. - void CreateShortcut(string shortcutPath, string target); - - /// - /// Gets the file system info. - /// - /// The path. - /// FileSystemInfo. - FileSystemMetadata GetFileSystemInfo(string path); - - /// - /// Gets the file information. - /// - /// The path. - /// FileSystemMetadata. - FileSystemMetadata GetFileInfo(string path); - - /// - /// Gets the directory information. - /// - /// The path. - /// FileSystemMetadata. - FileSystemMetadata GetDirectoryInfo(string path); - - /// - /// Gets the valid filename. - /// - /// The filename. - /// System.String. - string GetValidFilename(string filename); - - /// - /// Gets the creation time UTC. - /// - /// The information. - /// DateTime. - DateTime GetCreationTimeUtc(FileSystemMetadata info); - - /// - /// Gets the creation time UTC. - /// - /// The path. - /// DateTime. - DateTime GetCreationTimeUtc(string path); - - /// - /// Gets the last write time UTC. - /// - /// The information. - /// DateTime. - DateTime GetLastWriteTimeUtc(FileSystemMetadata info); - - /// - /// Gets the last write time UTC. - /// - /// The path. - /// DateTime. - DateTime GetLastWriteTimeUtc(string path); - - /// - /// Gets the file stream. - /// - /// The path. - /// The mode. - /// The access. - /// The share. - /// if set to true [is asynchronous]. - /// FileStream. - Stream GetFileStream(string path, FileMode mode, FileAccess access, FileShare share, bool isAsync = false); - - /// - /// Opens the read. - /// - /// The path. - /// Stream. - Stream OpenRead(String path); - - /// - /// Swaps the files. - /// - /// The file1. - /// The file2. - void SwapFiles(string file1, string file2); - - /// - /// Determines whether [contains sub path] [the specified parent path]. - /// - /// The parent path. - /// The path. - /// true if [contains sub path] [the specified parent path]; otherwise, false. - bool ContainsSubPath(string parentPath, string path); - - /// - /// Determines whether [is root path] [the specified path]. - /// - /// The path. - /// true if [is root path] [the specified path]; otherwise, false. - bool IsRootPath(string path); - - /// - /// Normalizes the path. - /// - /// The path. - /// System.String. - string NormalizePath(string path); - - /// - /// Gets the file name without extension. - /// - /// The information. - /// System.String. - string GetFileNameWithoutExtension(FileSystemMetadata info); - - /// - /// Gets the file name without extension. - /// - /// The path. - /// System.String. - string GetFileNameWithoutExtension(string path); - - /// - /// Determines whether [is path file] [the specified path]. - /// - /// The path. - /// true if [is path file] [the specified path]; otherwise, false. - bool IsPathFile(string path); - - /// - /// Deletes the file. - /// - /// The path. - void DeleteFile(string path); - - /// - /// Deletes the directory. - /// - /// The path. - /// if set to true [recursive]. - void DeleteDirectory(string path, bool recursive); - - /// - /// Gets the directories. - /// - /// The path. - /// if set to true [recursive]. - /// IEnumerable<DirectoryInfo>. - IEnumerable GetDirectories(string path, bool recursive = false); - - /// - /// Gets the files. - /// - /// The path. - /// if set to true [recursive]. - /// IEnumerable<FileInfo>. - IEnumerable GetFiles(string path, bool recursive = false); - - /// - /// Gets the file system entries. - /// - /// The path. - /// if set to true [recursive]. - /// IEnumerable<FileSystemMetadata>. - IEnumerable GetFileSystemEntries(string path, bool recursive = false); - - /// - /// Creates the directory. - /// - /// The path. - void CreateDirectory(string path); - - /// - /// Copies the file. - /// - /// The source. - /// The target. - /// if set to true [overwrite]. - void CopyFile(string source, string target, bool overwrite); - - /// - /// Moves the file. - /// - /// The source. - /// The target. - void MoveFile(string source, string target); - - /// - /// Moves the directory. - /// - /// The source. - /// The target. - void MoveDirectory(string source, string target); - - /// - /// Directories the exists. - /// - /// The path. - /// true if XXXX, false otherwise. - bool DirectoryExists(string path); - - /// - /// Files the exists. - /// - /// The path. - /// true if XXXX, false otherwise. - bool FileExists(string path); - - /// - /// Reads all text. - /// - /// The path. - /// System.String. - string ReadAllText(string path); - - /// - /// Writes all text. - /// - /// The path. - /// The text. - void WriteAllText(string path, string text); - - /// - /// Writes all text. - /// - /// The path. - /// The text. - /// The encoding. - void WriteAllText(string path, string text, Encoding encoding); - - /// - /// Reads all text. - /// - /// The path. - /// The encoding. - /// System.String. - string ReadAllText(string path, Encoding encoding); - - /// - /// Gets the directory paths. - /// - /// The path. - /// if set to true [recursive]. - /// IEnumerable<System.String>. - IEnumerable GetDirectoryPaths(string path, bool recursive = false); - - /// - /// Gets the file paths. - /// - /// The path. - /// if set to true [recursive]. - /// IEnumerable<System.String>. - IEnumerable GetFilePaths(string path, bool recursive = false); - - /// - /// Gets the file system entry paths. - /// - /// The path. - /// if set to true [recursive]. - /// IEnumerable<System.String>. - IEnumerable GetFileSystemEntryPaths(string path, bool recursive = false); - } -} diff --git a/MediaBrowser.Common/MediaBrowser.Common.csproj b/MediaBrowser.Common/MediaBrowser.Common.csproj index 0476f3f60..b2f62dd21 100644 --- a/MediaBrowser.Common/MediaBrowser.Common.csproj +++ b/MediaBrowser.Common/MediaBrowser.Common.csproj @@ -60,8 +60,6 @@ - - diff --git a/MediaBrowser.Controller/Entities/AggregateFolder.cs b/MediaBrowser.Controller/Entities/AggregateFolder.cs index 5af02e9bb..14f8c1617 100644 --- a/MediaBrowser.Controller/Entities/AggregateFolder.cs +++ b/MediaBrowser.Controller/Entities/AggregateFolder.cs @@ -6,6 +6,7 @@ using System.Collections.Generic; using System.IO; using System.Linq; using System.Runtime.Serialization; +using CommonIO; using MediaBrowser.Common.IO; using MediaBrowser.Controller.Providers; diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs index 963f4725a..796ba70ba 100644 --- a/MediaBrowser.Controller/Entities/BaseItem.cs +++ b/MediaBrowser.Controller/Entities/BaseItem.cs @@ -23,6 +23,7 @@ using System.Linq; using System.Runtime.Serialization; using System.Threading; using System.Threading.Tasks; +using CommonIO; namespace MediaBrowser.Controller.Entities { diff --git a/MediaBrowser.Controller/Entities/CollectionFolder.cs b/MediaBrowser.Controller/Entities/CollectionFolder.cs index b299929d0..946d95a0b 100644 --- a/MediaBrowser.Controller/Entities/CollectionFolder.cs +++ b/MediaBrowser.Controller/Entities/CollectionFolder.cs @@ -8,6 +8,7 @@ using System.Linq; using System.Runtime.Serialization; using System.Threading; using System.Threading.Tasks; +using CommonIO; using MediaBrowser.Common.IO; namespace MediaBrowser.Controller.Entities diff --git a/MediaBrowser.Controller/Entities/Folder.cs b/MediaBrowser.Controller/Entities/Folder.cs index 422c83d3b..c3f767c0d 100644 --- a/MediaBrowser.Controller/Entities/Folder.cs +++ b/MediaBrowser.Controller/Entities/Folder.cs @@ -13,6 +13,7 @@ using System.Linq; using System.Runtime.Serialization; using System.Threading; using System.Threading.Tasks; +using CommonIO; using MediaBrowser.Common.IO; namespace MediaBrowser.Controller.Entities diff --git a/MediaBrowser.Controller/Entities/IHasImages.cs b/MediaBrowser.Controller/Entities/IHasImages.cs index 55c5f7e11..ef478c516 100644 --- a/MediaBrowser.Controller/Entities/IHasImages.cs +++ b/MediaBrowser.Controller/Entities/IHasImages.cs @@ -3,6 +3,7 @@ using MediaBrowser.Model.Entities; using System.Collections.Generic; using System.IO; using System.Threading.Tasks; +using CommonIO; using MediaBrowser.Common.IO; namespace MediaBrowser.Controller.Entities diff --git a/MediaBrowser.Controller/Entities/Movies/Movie.cs b/MediaBrowser.Controller/Entities/Movies/Movie.cs index 8910fdbdd..1a8148edf 100644 --- a/MediaBrowser.Controller/Entities/Movies/Movie.cs +++ b/MediaBrowser.Controller/Entities/Movies/Movie.cs @@ -8,6 +8,7 @@ using System.IO; using System.Linq; using System.Threading; using System.Threading.Tasks; +using CommonIO; using MediaBrowser.Common.IO; namespace MediaBrowser.Controller.Entities.Movies diff --git a/MediaBrowser.Controller/Entities/Video.cs b/MediaBrowser.Controller/Entities/Video.cs index 5f5743b1d..45c497fcf 100644 --- a/MediaBrowser.Controller/Entities/Video.cs +++ b/MediaBrowser.Controller/Entities/Video.cs @@ -11,6 +11,7 @@ using System.Linq; using System.Runtime.Serialization; using System.Threading; using System.Threading.Tasks; +using CommonIO; using MediaBrowser.Common.IO; namespace MediaBrowser.Controller.Entities diff --git a/MediaBrowser.Controller/IO/FileData.cs b/MediaBrowser.Controller/IO/FileData.cs index 503727e14..20dfc425e 100644 --- a/MediaBrowser.Controller/IO/FileData.cs +++ b/MediaBrowser.Controller/IO/FileData.cs @@ -5,6 +5,7 @@ using MediaBrowser.Model.Logging; using System; using System.Collections.Generic; using System.IO; +using CommonIO; namespace MediaBrowser.Controller.IO { diff --git a/MediaBrowser.Controller/Library/ILibraryManager.cs b/MediaBrowser.Controller/Library/ILibraryManager.cs index 93f291aae..843fba0d0 100644 --- a/MediaBrowser.Controller/Library/ILibraryManager.cs +++ b/MediaBrowser.Controller/Library/ILibraryManager.cs @@ -11,6 +11,7 @@ using System.Collections.Generic; using System.IO; using System.Threading; using System.Threading.Tasks; +using CommonIO; using MediaBrowser.Common.IO; namespace MediaBrowser.Controller.Library diff --git a/MediaBrowser.Controller/Library/ItemResolveArgs.cs b/MediaBrowser.Controller/Library/ItemResolveArgs.cs index 653436691..90158942f 100644 --- a/MediaBrowser.Controller/Library/ItemResolveArgs.cs +++ b/MediaBrowser.Controller/Library/ItemResolveArgs.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Generic; using System.IO; using System.Linq; +using CommonIO; using MediaBrowser.Common.IO; namespace MediaBrowser.Controller.Library diff --git a/MediaBrowser.Controller/MediaBrowser.Controller.csproj b/MediaBrowser.Controller/MediaBrowser.Controller.csproj index b20f15544..946ea34d4 100644 --- a/MediaBrowser.Controller/MediaBrowser.Controller.csproj +++ b/MediaBrowser.Controller/MediaBrowser.Controller.csproj @@ -45,9 +45,16 @@ 4 + + False + ..\packages\CommonIO.1.0.0.3\lib\net45\CommonIO.dll + ..\packages\Interfaces.IO.1.0.0.5\lib\portable-net45+sl4+wp71+win8+wpa81\Interfaces.IO.dll + + ..\packages\Patterns.Logging.1.0.0.2\lib\portable-net45+sl4+wp71+win8+wpa81\Patterns.Logging.dll + diff --git a/MediaBrowser.Controller/MediaEncoding/MediaEncoderHelpers.cs b/MediaBrowser.Controller/MediaEncoding/MediaEncoderHelpers.cs index 6b7bddcfa..7985ec054 100644 --- a/MediaBrowser.Controller/MediaEncoding/MediaEncoderHelpers.cs +++ b/MediaBrowser.Controller/MediaEncoding/MediaEncoderHelpers.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Generic; using System.IO; using System.Linq; +using CommonIO; using MediaBrowser.Common.IO; namespace MediaBrowser.Controller.MediaEncoding diff --git a/MediaBrowser.Controller/Providers/DirectoryService.cs b/MediaBrowser.Controller/Providers/DirectoryService.cs index 6890b7a7c..cf1c3d286 100644 --- a/MediaBrowser.Controller/Providers/DirectoryService.cs +++ b/MediaBrowser.Controller/Providers/DirectoryService.cs @@ -4,6 +4,7 @@ using System.Collections.Concurrent; using System.Collections.Generic; using System.IO; using System.Linq; +using CommonIO; using MediaBrowser.Common.IO; namespace MediaBrowser.Controller.Providers diff --git a/MediaBrowser.Controller/Providers/IDirectoryService.cs b/MediaBrowser.Controller/Providers/IDirectoryService.cs index 06507d5d2..062a10901 100644 --- a/MediaBrowser.Controller/Providers/IDirectoryService.cs +++ b/MediaBrowser.Controller/Providers/IDirectoryService.cs @@ -1,5 +1,6 @@ using System.Collections.Generic; using System.IO; +using CommonIO; using MediaBrowser.Common.IO; namespace MediaBrowser.Controller.Providers diff --git a/MediaBrowser.Controller/Providers/LocalImageInfo.cs b/MediaBrowser.Controller/Providers/LocalImageInfo.cs index 3b51a96f0..51916268f 100644 --- a/MediaBrowser.Controller/Providers/LocalImageInfo.cs +++ b/MediaBrowser.Controller/Providers/LocalImageInfo.cs @@ -1,4 +1,5 @@ using System.IO; +using CommonIO; using MediaBrowser.Common.IO; using MediaBrowser.Model.Entities; diff --git a/MediaBrowser.Controller/Providers/MetadataRefreshOptions.cs b/MediaBrowser.Controller/Providers/MetadataRefreshOptions.cs index 097c613cb..6f217eea2 100644 --- a/MediaBrowser.Controller/Providers/MetadataRefreshOptions.cs +++ b/MediaBrowser.Controller/Providers/MetadataRefreshOptions.cs @@ -1,4 +1,5 @@ using System.Linq; +using CommonIO; using MediaBrowser.Common.IO; namespace MediaBrowser.Controller.Providers diff --git a/MediaBrowser.Controller/Resolvers/IItemResolver.cs b/MediaBrowser.Controller/Resolvers/IItemResolver.cs index 660a6a87a..f747c055e 100644 --- a/MediaBrowser.Controller/Resolvers/IItemResolver.cs +++ b/MediaBrowser.Controller/Resolvers/IItemResolver.cs @@ -3,6 +3,7 @@ using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Providers; using System.Collections.Generic; using System.IO; +using CommonIO; using MediaBrowser.Common.IO; namespace MediaBrowser.Controller.Resolvers diff --git a/MediaBrowser.Controller/packages.config b/MediaBrowser.Controller/packages.config index c320ed9d9..c03c15de8 100644 --- a/MediaBrowser.Controller/packages.config +++ b/MediaBrowser.Controller/packages.config @@ -1,5 +1,7 @@  + + \ No newline at end of file diff --git a/MediaBrowser.Dlna/DlnaManager.cs b/MediaBrowser.Dlna/DlnaManager.cs index 0fd3cec89..be49c0f89 100644 --- a/MediaBrowser.Dlna/DlnaManager.cs +++ b/MediaBrowser.Dlna/DlnaManager.cs @@ -17,6 +17,7 @@ using System.IO; using System.Linq; using System.Text; using System.Text.RegularExpressions; +using CommonIO; namespace MediaBrowser.Dlna { diff --git a/MediaBrowser.Dlna/MediaBrowser.Dlna.csproj b/MediaBrowser.Dlna/MediaBrowser.Dlna.csproj index c49cbc654..325df86d1 100644 --- a/MediaBrowser.Dlna/MediaBrowser.Dlna.csproj +++ b/MediaBrowser.Dlna/MediaBrowser.Dlna.csproj @@ -13,6 +13,8 @@ 10.0.0 2.0 v4.5 + ..\ + true true @@ -39,6 +41,13 @@ 4 + + False + ..\packages\CommonIO.1.0.0.3\lib\net45\CommonIO.dll + + + ..\packages\Patterns.Logging.1.0.0.2\lib\portable-net45+sl4+wp71+win8+wpa81\Patterns.Logging.dll + @@ -230,6 +239,9 @@ Designer + + +