aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Model/IO
diff options
context:
space:
mode:
authorAndrew Rabert <ar@nullsum.net>2018-12-27 18:27:57 -0500
committerAndrew Rabert <ar@nullsum.net>2018-12-27 18:27:57 -0500
commita86b71899ec52c44ddc6c3018e8cc5e9d7ff4d62 (patch)
treea74f6ea4a8abfa1664a605d31d48bc38245ccf58 /MediaBrowser.Model/IO
parent9bac3ac616b01f67db98381feb09d34ebe821f9a (diff)
Add GPL modules
Diffstat (limited to 'MediaBrowser.Model/IO')
-rw-r--r--MediaBrowser.Model/IO/FileSystemEntryInfo.cs27
-rw-r--r--MediaBrowser.Model/IO/FileSystemEntryType.cs25
-rw-r--r--MediaBrowser.Model/IO/FileSystemMetadata.cs54
-rw-r--r--MediaBrowser.Model/IO/IFileSystem.cs454
-rw-r--r--MediaBrowser.Model/IO/IIsoManager.cs34
-rw-r--r--MediaBrowser.Model/IO/IIsoMount.cs22
-rw-r--r--MediaBrowser.Model/IO/IIsoMounter.cs32
-rw-r--r--MediaBrowser.Model/IO/IShortcutHandler.cs25
-rw-r--r--MediaBrowser.Model/IO/IStreamHelper.cs19
-rw-r--r--MediaBrowser.Model/IO/IZipClient.cs69
-rw-r--r--MediaBrowser.Model/IO/StreamDefaults.cs19
11 files changed, 780 insertions, 0 deletions
diff --git a/MediaBrowser.Model/IO/FileSystemEntryInfo.cs b/MediaBrowser.Model/IO/FileSystemEntryInfo.cs
new file mode 100644
index 000000000..f17e2e5c3
--- /dev/null
+++ b/MediaBrowser.Model/IO/FileSystemEntryInfo.cs
@@ -0,0 +1,27 @@
+
+namespace MediaBrowser.Model.IO
+{
+ /// <summary>
+ /// Class FileSystemEntryInfo
+ /// </summary>
+ public class FileSystemEntryInfo
+ {
+ /// <summary>
+ /// Gets or sets the name.
+ /// </summary>
+ /// <value>The name.</value>
+ public string Name { get; set; }
+
+ /// <summary>
+ /// Gets or sets the path.
+ /// </summary>
+ /// <value>The path.</value>
+ public string Path { get; set; }
+
+ /// <summary>
+ /// Gets or sets the type.
+ /// </summary>
+ /// <value>The type.</value>
+ public FileSystemEntryType Type { get; set; }
+ }
+}
diff --git a/MediaBrowser.Model/IO/FileSystemEntryType.cs b/MediaBrowser.Model/IO/FileSystemEntryType.cs
new file mode 100644
index 000000000..e7c67c606
--- /dev/null
+++ b/MediaBrowser.Model/IO/FileSystemEntryType.cs
@@ -0,0 +1,25 @@
+namespace MediaBrowser.Model.IO
+{
+ /// <summary>
+ /// Enum FileSystemEntryType
+ /// </summary>
+ public enum FileSystemEntryType
+ {
+ /// <summary>
+ /// The file
+ /// </summary>
+ File,
+ /// <summary>
+ /// The directory
+ /// </summary>
+ Directory,
+ /// <summary>
+ /// The network computer
+ /// </summary>
+ NetworkComputer,
+ /// <summary>
+ /// The network share
+ /// </summary>
+ NetworkShare
+ }
+} \ No newline at end of file
diff --git a/MediaBrowser.Model/IO/FileSystemMetadata.cs b/MediaBrowser.Model/IO/FileSystemMetadata.cs
new file mode 100644
index 000000000..665bc255c
--- /dev/null
+++ b/MediaBrowser.Model/IO/FileSystemMetadata.cs
@@ -0,0 +1,54 @@
+using System;
+
+namespace MediaBrowser.Model.IO
+{
+ public class FileSystemMetadata
+ {
+ /// <summary>
+ /// Gets or sets a value indicating whether this <see cref="FileSystemMetadata"/> is exists.
+ /// </summary>
+ /// <value><c>true</c> if exists; otherwise, <c>false</c>.</value>
+ public bool Exists { get; set; }
+ /// <summary>
+ /// Gets or sets the full name.
+ /// </summary>
+ /// <value>The full name.</value>
+ public string FullName { get; set; }
+ /// <summary>
+ /// Gets or sets the name.
+ /// </summary>
+ /// <value>The name.</value>
+ public string Name { get; set; }
+ /// <summary>
+ /// Gets or sets the extension.
+ /// </summary>
+ /// <value>The extension.</value>
+ public string Extension { get; set; }
+ /// <summary>
+ /// Gets or sets the length.
+ /// </summary>
+ /// <value>The length.</value>
+ public long Length { get; set; }
+ /// <summary>
+ /// Gets or sets the name of the directory.
+ /// </summary>
+ /// <value>The name of the directory.</value>
+ public string DirectoryName { get; set; }
+
+ /// <summary>
+ /// Gets or sets the last write time UTC.
+ /// </summary>
+ /// <value>The last write time UTC.</value>
+ public DateTime LastWriteTimeUtc { get; set; }
+ /// <summary>
+ /// Gets or sets the creation time UTC.
+ /// </summary>
+ /// <value>The creation time UTC.</value>
+ public DateTime CreationTimeUtc { get; set; }
+ /// <summary>
+ /// Gets a value indicating whether this instance is directory.
+ /// </summary>
+ /// <value><c>true</c> if this instance is directory; otherwise, <c>false</c>.</value>
+ public bool IsDirectory { get; set; }
+ }
+}
diff --git a/MediaBrowser.Model/IO/IFileSystem.cs b/MediaBrowser.Model/IO/IFileSystem.cs
new file mode 100644
index 000000000..3200affd6
--- /dev/null
+++ b/MediaBrowser.Model/IO/IFileSystem.cs
@@ -0,0 +1,454 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Text;
+
+namespace MediaBrowser.Model.IO
+{
+ /// <summary>
+ /// Interface IFileSystem
+ /// </summary>
+ public interface IFileSystem
+ {
+ void AddShortcutHandler(IShortcutHandler handler);
+
+ /// <summary>
+ /// Determines whether the specified filename is shortcut.
+ /// </summary>
+ /// <param name="filename">The filename.</param>
+ /// <returns><c>true</c> if the specified filename is shortcut; otherwise, <c>false</c>.</returns>
+ bool IsShortcut(string filename);
+
+ /// <summary>
+ /// Resolves the shortcut.
+ /// </summary>
+ /// <param name="filename">The filename.</param>
+ /// <returns>System.String.</returns>
+ string ResolveShortcut(string filename);
+
+ /// <summary>
+ /// Creates the shortcut.
+ /// </summary>
+ /// <param name="shortcutPath">The shortcut path.</param>
+ /// <param name="target">The target.</param>
+ void CreateShortcut(string shortcutPath, string target);
+
+ string MakeAbsolutePath(string folderPath, string filePath);
+
+ /// <summary>
+ /// Returns a <see cref="FileSystemMetadata"/> object for the specified file or directory path.
+ /// </summary>
+ /// <param name="path">A path to a file or directory.</param>
+ /// <returns>A <see cref="FileSystemMetadata"/> object.</returns>
+ /// <remarks>If the specified path points to a directory, the returned <see cref="FileSystemMetadata"/> object's
+ /// <see cref="FileSystemMetadata.IsDirectory"/> property will be set to true and all other properties will reflect the properties of the directory.</remarks>
+ FileSystemMetadata GetFileSystemInfo(string path);
+
+ /// <summary>
+ /// Returns a <see cref="FileSystemMetadata"/> object for the specified file path.
+ /// </summary>
+ /// <param name="path">A path to a file.</param>
+ /// <returns>A <see cref="FileSystemMetadata"/> object.</returns>
+ /// <remarks><para>If the specified path points to a directory, the returned <see cref="FileSystemMetadata"/> object's
+ /// <see cref="FileSystemMetadata.IsDirectory"/> property and the <see cref="FileSystemMetadata.Exists"/> property will both be set to false.</para>
+ /// <para>For automatic handling of files <b>and</b> directories, use <see cref="GetFileSystemInfo"/>.</para></remarks>
+ FileSystemMetadata GetFileInfo(string path);
+
+ /// <summary>
+ /// Returns a <see cref="FileSystemMetadata"/> object for the specified directory path.
+ /// </summary>
+ /// <param name="path">A path to a directory.</param>
+ /// <returns>A <see cref="FileSystemMetadata"/> object.</returns>
+ /// <remarks><para>If the specified path points to a file, the returned <see cref="FileSystemMetadata"/> object's
+ /// <see cref="FileSystemMetadata.IsDirectory"/> property will be set to true and the <see cref="FileSystemMetadata.Exists"/> property will be set to false.</para>
+ /// <para>For automatic handling of files <b>and</b> directories, use <see cref="GetFileSystemInfo"/>.</para></remarks>
+ FileSystemMetadata GetDirectoryInfo(string path);
+
+ /// <summary>
+ /// Gets the valid filename.
+ /// </summary>
+ /// <param name="filename">The filename.</param>
+ /// <returns>System.String.</returns>
+ string GetValidFilename(string filename);
+
+ /// <summary>
+ /// Gets the creation time UTC.
+ /// </summary>
+ /// <param name="info">The information.</param>
+ /// <returns>DateTime.</returns>
+ DateTime GetCreationTimeUtc(FileSystemMetadata info);
+
+ /// <summary>
+ /// Gets the creation time UTC.
+ /// </summary>
+ /// <param name="path">The path.</param>
+ /// <returns>DateTime.</returns>
+ DateTime GetCreationTimeUtc(string path);
+
+ /// <summary>
+ /// Gets the last write time UTC.
+ /// </summary>
+ /// <param name="info">The information.</param>
+ /// <returns>DateTime.</returns>
+ DateTime GetLastWriteTimeUtc(FileSystemMetadata info);
+
+ /// <summary>
+ /// Gets the last write time UTC.
+ /// </summary>
+ /// <param name="path">The path.</param>
+ /// <returns>DateTime.</returns>
+ DateTime GetLastWriteTimeUtc(string path);
+
+ /// <summary>
+ /// Gets the file stream.
+ /// </summary>
+ /// <param name="path">The path.</param>
+ /// <param name="mode">The mode.</param>
+ /// <param name="access">The access.</param>
+ /// <param name="share">The share.</param>
+ /// <param name="isAsync">if set to <c>true</c> [is asynchronous].</param>
+ /// <returns>FileStream.</returns>
+ Stream GetFileStream(string path, FileOpenMode mode, FileAccessMode access, FileShareMode share, bool isAsync = false);
+
+ Stream GetFileStream(string path, FileOpenMode mode, FileAccessMode access, FileShareMode share, FileOpenOptions fileOpenOptions);
+
+ /// <summary>
+ /// Opens the read.
+ /// </summary>
+ /// <param name="path">The path.</param>
+ /// <returns>Stream.</returns>
+ Stream OpenRead(String path);
+
+ string DefaultDirectory { get; }
+
+ /// <summary>
+ /// Swaps the files.
+ /// </summary>
+ /// <param name="file1">The file1.</param>
+ /// <param name="file2">The file2.</param>
+ void SwapFiles(string file1, string file2);
+
+ bool AreEqual(string path1, string path2);
+
+ /// <summary>
+ /// Determines whether [contains sub path] [the specified parent path].
+ /// </summary>
+ /// <param name="parentPath">The parent path.</param>
+ /// <param name="path">The path.</param>
+ /// <returns><c>true</c> if [contains sub path] [the specified parent path]; otherwise, <c>false</c>.</returns>
+ bool ContainsSubPath(string parentPath, string path);
+
+ /// <summary>
+ /// Determines whether [is root path] [the specified path].
+ /// </summary>
+ /// <param name="path">The path.</param>
+ /// <returns><c>true</c> if [is root path] [the specified path]; otherwise, <c>false</c>.</returns>
+ bool IsRootPath(string path);
+
+ /// <summary>
+ /// Normalizes the path.
+ /// </summary>
+ /// <param name="path">The path.</param>
+ /// <returns>System.String.</returns>
+ string NormalizePath(string path);
+
+ string GetDirectoryName(string path);
+
+ /// <summary>
+ /// Gets the file name without extension.
+ /// </summary>
+ /// <param name="info">The information.</param>
+ /// <returns>System.String.</returns>
+ string GetFileNameWithoutExtension(FileSystemMetadata info);
+
+ /// <summary>
+ /// Gets the file name without extension.
+ /// </summary>
+ /// <param name="path">The path.</param>
+ /// <returns>System.String.</returns>
+ string GetFileNameWithoutExtension(string path);
+
+ /// <summary>
+ /// Determines whether [is path file] [the specified path].
+ /// </summary>
+ /// <param name="path">The path.</param>
+ /// <returns><c>true</c> if [is path file] [the specified path]; otherwise, <c>false</c>.</returns>
+ bool IsPathFile(string path);
+
+ /// <summary>
+ /// Deletes the file.
+ /// </summary>
+ /// <param name="path">The path.</param>
+ void DeleteFile(string path);
+
+ /// <summary>
+ /// Deletes the directory.
+ /// </summary>
+ /// <param name="path">The path.</param>
+ /// <param name="recursive">if set to <c>true</c> [recursive].</param>
+ void DeleteDirectory(string path, bool recursive);
+
+ /// <summary>
+ /// Gets the directories.
+ /// </summary>
+ /// <param name="path">The path.</param>
+ /// <param name="recursive">if set to <c>true</c> [recursive].</param>
+ /// <returns>IEnumerable&lt;DirectoryInfo&gt;.</returns>
+ IEnumerable<FileSystemMetadata> GetDirectories(string path, bool recursive = false);
+
+ /// <summary>
+ /// Gets the files.
+ /// </summary>
+ IEnumerable<FileSystemMetadata> GetFiles(string path, bool recursive = false);
+
+ IEnumerable<FileSystemMetadata> GetFiles(string path, string [] extensions, bool enableCaseSensitiveExtensions, bool recursive);
+
+ /// <summary>
+ /// Gets the file system entries.
+ /// </summary>
+ /// <param name="path">The path.</param>
+ /// <param name="recursive">if set to <c>true</c> [recursive].</param>
+ /// <returns>IEnumerable&lt;FileSystemMetadata&gt;.</returns>
+ IEnumerable<FileSystemMetadata> GetFileSystemEntries(string path, bool recursive = false);
+
+ /// <summary>
+ /// Creates the directory.
+ /// </summary>
+ /// <param name="path">The path.</param>
+ void CreateDirectory(string path);
+
+ /// <summary>
+ /// Copies the file.
+ /// </summary>
+ /// <param name="source">The source.</param>
+ /// <param name="target">The target.</param>
+ /// <param name="overwrite">if set to <c>true</c> [overwrite].</param>
+ void CopyFile(string source, string target, bool overwrite);
+
+ /// <summary>
+ /// Moves the file.
+ /// </summary>
+ /// <param name="source">The source.</param>
+ /// <param name="target">The target.</param>
+ void MoveFile(string source, string target);
+
+ /// <summary>
+ /// Moves the directory.
+ /// </summary>
+ /// <param name="source">The source.</param>
+ /// <param name="target">The target.</param>
+ void MoveDirectory(string source, string target);
+
+ /// <summary>
+ /// Directories the exists.
+ /// </summary>
+ /// <param name="path">The path.</param>
+ /// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
+ bool DirectoryExists(string path);
+
+ /// <summary>
+ /// Files the exists.
+ /// </summary>
+ /// <param name="path">The path.</param>
+ /// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
+ bool FileExists(string path);
+
+ /// <summary>
+ /// Reads all text.
+ /// </summary>
+ /// <param name="path">The path.</param>
+ /// <returns>System.String.</returns>
+ string ReadAllText(string path);
+
+ byte[] ReadAllBytes(string path);
+
+ void WriteAllBytes(string path, byte[] bytes);
+
+ /// <summary>
+ /// Writes all text.
+ /// </summary>
+ /// <param name="path">The path.</param>
+ /// <param name="text">The text.</param>
+ void WriteAllText(string path, string text);
+
+ /// <summary>
+ /// Writes all text.
+ /// </summary>
+ /// <param name="path">The path.</param>
+ /// <param name="text">The text.</param>
+ /// <param name="encoding">The encoding.</param>
+ void WriteAllText(string path, string text, Encoding encoding);
+
+ /// <summary>
+ /// Reads all text.
+ /// </summary>
+ /// <param name="path">The path.</param>
+ /// <param name="encoding">The encoding.</param>
+ /// <returns>System.String.</returns>
+ string ReadAllText(string path, Encoding encoding);
+
+ string[] ReadAllLines(string path);
+
+ void WriteAllLines(string path, IEnumerable<string> lines);
+
+ /// <summary>
+ /// Gets the directory paths.
+ /// </summary>
+ /// <param name="path">The path.</param>
+ /// <param name="recursive">if set to <c>true</c> [recursive].</param>
+ /// <returns>IEnumerable&lt;System.String&gt;.</returns>
+ IEnumerable<string> GetDirectoryPaths(string path, bool recursive = false);
+
+ /// <summary>
+ /// Gets the file paths.
+ /// </summary>
+ /// <param name="path">The path.</param>
+ /// <param name="recursive">if set to <c>true</c> [recursive].</param>
+ /// <returns>IEnumerable&lt;System.String&gt;.</returns>
+ IEnumerable<string> GetFilePaths(string path, bool recursive = false);
+ IEnumerable<string> GetFilePaths(string path, string[] extensions, bool enableCaseSensitiveExtensions, bool recursive);
+
+ /// <summary>
+ /// Gets the file system entry paths.
+ /// </summary>
+ /// <param name="path">The path.</param>
+ /// <param name="recursive">if set to <c>true</c> [recursive].</param>
+ /// <returns>IEnumerable&lt;System.String&gt;.</returns>
+ IEnumerable<string> GetFileSystemEntryPaths(string path, bool recursive = false);
+
+ void SetHidden(string path, bool isHidden);
+ void SetReadOnly(string path, bool readOnly);
+ void SetAttributes(string path, bool isHidden, bool readOnly);
+
+ char DirectorySeparatorChar { get; }
+
+ string GetFullPath(string path);
+
+ List<FileSystemMetadata> GetDrives();
+
+ void SetExecutable(string path);
+ }
+
+ public enum FileOpenMode
+ {
+ //
+ // Summary:
+ // Specifies that the operating system should create a new file. This requires System.Security.Permissions.FileIOPermissionAccess.Write
+ // permission. If the file already exists, an System.IO.IOException exception is
+ // thrown.
+ CreateNew = 1,
+ //
+ // Summary:
+ // Specifies that the operating system should create a new file. If the file already
+ // exists, it will be overwritten. This requires System.Security.Permissions.FileIOPermissionAccess.Write
+ // permission. FileMode.Create is equivalent to requesting that if the file does
+ // not exist, use System.IO.FileMode.CreateNew; otherwise, use System.IO.FileMode.Truncate.
+ // If the file already exists but is a hidden file, an System.UnauthorizedAccessException
+ // exception is thrown.
+ Create = 2,
+ //
+ // Summary:
+ // Specifies that the operating system should open an existing file. The ability
+ // to open the file is dependent on the value specified by the System.IO.FileAccess
+ // enumeration. A System.IO.FileNotFoundException exception is thrown if the file
+ // does not exist.
+ Open = 3,
+ //
+ // Summary:
+ // Specifies that the operating system should open a file if it exists; otherwise,
+ // a new file should be created. If the file is opened with FileAccess.Read, System.Security.Permissions.FileIOPermissionAccess.Read
+ // permission is required. If the file access is FileAccess.Write, System.Security.Permissions.FileIOPermissionAccess.Write
+ // permission is required. If the file is opened with FileAccess.ReadWrite, both
+ // System.Security.Permissions.FileIOPermissionAccess.Read and System.Security.Permissions.FileIOPermissionAccess.Write
+ // permissions are required.
+ OpenOrCreate = 4
+ }
+
+ public enum FileAccessMode
+ {
+ //
+ // Summary:
+ // Read access to the file. Data can be read from the file. Combine with Write for
+ // read/write access.
+ Read = 1,
+ //
+ // Summary:
+ // Write access to the file. Data can be written to the file. Combine with Read
+ // for read/write access.
+ Write = 2
+ }
+
+ public enum FileShareMode
+ {
+ //
+ // Summary:
+ // Declines sharing of the current file. Any request to open the file (by this process
+ // or another process) will fail until the file is closed.
+ None = 0,
+ //
+ // Summary:
+ // Allows subsequent opening of the file for reading. If this flag is not specified,
+ // any request to open the file for reading (by this process or another process)
+ // will fail until the file is closed. However, even if this flag is specified,
+ // additional permissions might still be needed to access the file.
+ Read = 1,
+ //
+ // Summary:
+ // Allows subsequent opening of the file for writing. If this flag is not specified,
+ // any request to open the file for writing (by this process or another process)
+ // will fail until the file is closed. However, even if this flag is specified,
+ // additional permissions might still be needed to access the file.
+ Write = 2,
+ //
+ // Summary:
+ // Allows subsequent opening of the file for reading or writing. If this flag is
+ // not specified, any request to open the file for reading or writing (by this process
+ // or another process) will fail until the file is closed. However, even if this
+ // flag is specified, additional permissions might still be needed to access the
+ // file.
+ ReadWrite = 3
+ }
+
+ //
+ // Summary:
+ // Represents advanced options for creating a System.IO.FileStream object.
+ [Flags]
+ public enum FileOpenOptions
+ {
+ //
+ // Summary:
+ // Indicates that the system should write through any intermediate cache and go
+ // directly to disk.
+ WriteThrough = int.MinValue,
+ //
+ // Summary:
+ // Indicates that no additional options should be used when creating a System.IO.FileStream
+ // object.
+ None = 0,
+ //
+ // Summary:
+ // Indicates that a file is encrypted and can be decrypted only by using the same
+ // user account used for encryption.
+ Encrypted = 16384,
+ //
+ // Summary:
+ // Indicates that a file is automatically deleted when it is no longer in use.
+ DeleteOnClose = 67108864,
+ //
+ // Summary:
+ // Indicates that the file is to be accessed sequentially from beginning to end.
+ // The system can use this as a hint to optimize file caching. If an application
+ // moves the file pointer for random access, optimum caching may not occur; however,
+ // correct operation is still guaranteed.
+ SequentialScan = 134217728,
+ //
+ // Summary:
+ // Indicates that the file is accessed randomly. The system can use this as a hint
+ // to optimize file caching.
+ RandomAccess = 268435456,
+ //
+ // Summary:
+ // Indicates that a file can be used for asynchronous reading and writing.
+ Asynchronous = 1073741824
+ }
+}
diff --git a/MediaBrowser.Model/IO/IIsoManager.cs b/MediaBrowser.Model/IO/IIsoManager.cs
new file mode 100644
index 000000000..92c4d5aee
--- /dev/null
+++ b/MediaBrowser.Model/IO/IIsoManager.cs
@@ -0,0 +1,34 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Threading;
+using System.Threading.Tasks;
+
+namespace MediaBrowser.Model.IO
+{
+ public interface IIsoManager : IDisposable
+ {
+ /// <summary>
+ /// Mounts the specified iso path.
+ /// </summary>
+ /// <param name="isoPath">The iso path.</param>
+ /// <param name="cancellationToken">The cancellation token.</param>
+ /// <returns>IsoMount.</returns>
+ /// <exception cref="ArgumentNullException">isoPath</exception>
+ /// <exception cref="IOException">Unable to create mount.</exception>
+ Task<IIsoMount> Mount(string isoPath, CancellationToken cancellationToken);
+
+ /// <summary>
+ /// Determines whether this instance can mount the specified path.
+ /// </summary>
+ /// <param name="path">The path.</param>
+ /// <returns><c>true</c> if this instance can mount the specified path; otherwise, <c>false</c>.</returns>
+ bool CanMount(string path);
+
+ /// <summary>
+ /// Adds the parts.
+ /// </summary>
+ /// <param name="mounters">The mounters.</param>
+ void AddParts(IEnumerable<IIsoMounter> mounters);
+ }
+} \ No newline at end of file
diff --git a/MediaBrowser.Model/IO/IIsoMount.cs b/MediaBrowser.Model/IO/IIsoMount.cs
new file mode 100644
index 000000000..4f8f8b5d2
--- /dev/null
+++ b/MediaBrowser.Model/IO/IIsoMount.cs
@@ -0,0 +1,22 @@
+using System;
+
+namespace MediaBrowser.Model.IO
+{
+ /// <summary>
+ /// Interface IIsoMount
+ /// </summary>
+ public interface IIsoMount : IDisposable
+ {
+ /// <summary>
+ /// Gets or sets the iso path.
+ /// </summary>
+ /// <value>The iso path.</value>
+ string IsoPath { get; }
+
+ /// <summary>
+ /// Gets the mounted path.
+ /// </summary>
+ /// <value>The mounted path.</value>
+ string MountedPath { get; }
+ }
+} \ No newline at end of file
diff --git a/MediaBrowser.Model/IO/IIsoMounter.cs b/MediaBrowser.Model/IO/IIsoMounter.cs
new file mode 100644
index 000000000..7efbc2024
--- /dev/null
+++ b/MediaBrowser.Model/IO/IIsoMounter.cs
@@ -0,0 +1,32 @@
+using System;
+using System.Threading;
+using System.Threading.Tasks;
+
+namespace MediaBrowser.Model.IO
+{
+ public interface IIsoMounter : IDisposable
+ {
+ /// <summary>
+ /// Mounts the specified iso path.
+ /// </summary>
+ /// <param name="isoPath">The iso path.</param>
+ /// <param name="cancellationToken">The cancellation token.</param>
+ /// <returns>IsoMount.</returns>
+ /// <exception cref="ArgumentNullException">isoPath</exception>
+ /// <exception cref="IOException">Unable to create mount.</exception>
+ Task<IIsoMount> Mount(string isoPath, CancellationToken cancellationToken);
+
+ /// <summary>
+ /// Determines whether this instance can mount the specified path.
+ /// </summary>
+ /// <param name="path">The path.</param>
+ /// <returns><c>true</c> if this instance can mount the specified path; otherwise, <c>false</c>.</returns>
+ bool CanMount(string path);
+
+ /// <summary>
+ /// Gets the name.
+ /// </summary>
+ /// <value>The name.</value>
+ string Name { get; }
+ }
+}
diff --git a/MediaBrowser.Model/IO/IShortcutHandler.cs b/MediaBrowser.Model/IO/IShortcutHandler.cs
new file mode 100644
index 000000000..16255e51f
--- /dev/null
+++ b/MediaBrowser.Model/IO/IShortcutHandler.cs
@@ -0,0 +1,25 @@
+
+namespace MediaBrowser.Model.IO
+{
+ public interface IShortcutHandler
+ {
+ /// <summary>
+ /// Gets the extension.
+ /// </summary>
+ /// <value>The extension.</value>
+ string Extension { get; }
+ /// <summary>
+ /// Resolves the specified shortcut path.
+ /// </summary>
+ /// <param name="shortcutPath">The shortcut path.</param>
+ /// <returns>System.String.</returns>
+ string Resolve(string shortcutPath);
+ /// <summary>
+ /// Creates the specified shortcut path.
+ /// </summary>
+ /// <param name="shortcutPath">The shortcut path.</param>
+ /// <param name="targetPath">The target path.</param>
+ /// <returns>System.String.</returns>
+ void Create(string shortcutPath, string targetPath);
+ }
+}
diff --git a/MediaBrowser.Model/IO/IStreamHelper.cs b/MediaBrowser.Model/IO/IStreamHelper.cs
new file mode 100644
index 000000000..7ed6015c0
--- /dev/null
+++ b/MediaBrowser.Model/IO/IStreamHelper.cs
@@ -0,0 +1,19 @@
+using System;
+using System.IO;
+using System.Threading;
+using System.Threading.Tasks;
+
+namespace MediaBrowser.Model.IO
+{
+ public interface IStreamHelper
+ {
+ Task CopyToAsync(Stream source, Stream destination, int bufferSize, Action onStarted, CancellationToken cancellationToken);
+
+ Task CopyToAsync(Stream source, Stream destination, int bufferSize, int emptyReadLimit, CancellationToken cancellationToken);
+
+ Task<int> CopyToAsync(Stream source, Stream destination, CancellationToken cancellationToken);
+ Task CopyToAsync(Stream source, Stream destination, long copyLength, CancellationToken cancellationToken);
+
+ Task CopyUntilCancelled(Stream source, Stream target, int bufferSize, CancellationToken cancellationToken);
+ }
+}
diff --git a/MediaBrowser.Model/IO/IZipClient.cs b/MediaBrowser.Model/IO/IZipClient.cs
new file mode 100644
index 000000000..c1dfc6cd6
--- /dev/null
+++ b/MediaBrowser.Model/IO/IZipClient.cs
@@ -0,0 +1,69 @@
+using System.IO;
+
+namespace MediaBrowser.Model.IO
+{
+ /// <summary>
+ /// Interface IZipClient
+ /// </summary>
+ public interface IZipClient
+ {
+ /// <summary>
+ /// Extracts all.
+ /// </summary>
+ /// <param name="sourceFile">The source file.</param>
+ /// <param name="targetPath">The target path.</param>
+ /// <param name="overwriteExistingFiles">if set to <c>true</c> [overwrite existing files].</param>
+ void ExtractAll(string sourceFile, string targetPath, bool overwriteExistingFiles);
+
+ /// <summary>
+ /// Extracts all.
+ /// </summary>
+ /// <param name="source">The source.</param>
+ /// <param name="targetPath">The target path.</param>
+ /// <param name="overwriteExistingFiles">if set to <c>true</c> [overwrite existing files].</param>
+ void ExtractAll(Stream source, string targetPath, bool overwriteExistingFiles);
+
+ void ExtractAllFromGz(Stream source, string targetPath, bool overwriteExistingFiles);
+ void ExtractFirstFileFromGz(Stream source, string targetPath, string defaultFileName);
+
+ /// <summary>
+ /// Extracts all from zip.
+ /// </summary>
+ /// <param name="source">The source.</param>
+ /// <param name="targetPath">The target path.</param>
+ /// <param name="overwriteExistingFiles">if set to <c>true</c> [overwrite existing files].</param>
+ void ExtractAllFromZip(Stream source, string targetPath, bool overwriteExistingFiles);
+
+ /// <summary>
+ /// Extracts all from7z.
+ /// </summary>
+ /// <param name="sourceFile">The source file.</param>
+ /// <param name="targetPath">The target path.</param>
+ /// <param name="overwriteExistingFiles">if set to <c>true</c> [overwrite existing files].</param>
+ void ExtractAllFrom7z(string sourceFile, string targetPath, bool overwriteExistingFiles);
+
+ /// <summary>
+ /// Extracts all from7z.
+ /// </summary>
+ /// <param name="source">The source.</param>
+ /// <param name="targetPath">The target path.</param>
+ /// <param name="overwriteExistingFiles">if set to <c>true</c> [overwrite existing files].</param>
+ void ExtractAllFrom7z(Stream source, string targetPath, bool overwriteExistingFiles);
+
+ /// <summary>
+ /// Extracts all from tar.
+ /// </summary>
+ /// <param name="sourceFile">The source file.</param>
+ /// <param name="targetPath">The target path.</param>
+ /// <param name="overwriteExistingFiles">if set to <c>true</c> [overwrite existing files].</param>
+ void ExtractAllFromTar(string sourceFile, string targetPath, bool overwriteExistingFiles);
+
+ /// <summary>
+ /// Extracts all from tar.
+ /// </summary>
+ /// <param name="source">The source.</param>
+ /// <param name="targetPath">The target path.</param>
+ /// <param name="overwriteExistingFiles">if set to <c>true</c> [overwrite existing files].</param>
+ void ExtractAllFromTar(Stream source, string targetPath, bool overwriteExistingFiles);
+ }
+}
diff --git a/MediaBrowser.Model/IO/StreamDefaults.cs b/MediaBrowser.Model/IO/StreamDefaults.cs
new file mode 100644
index 000000000..1e99ff4b5
--- /dev/null
+++ b/MediaBrowser.Model/IO/StreamDefaults.cs
@@ -0,0 +1,19 @@
+
+namespace MediaBrowser.Model.IO
+{
+ /// <summary>
+ /// Class StreamDefaults
+ /// </summary>
+ public static class StreamDefaults
+ {
+ /// <summary>
+ /// The default copy to buffer size
+ /// </summary>
+ public const int DefaultCopyToBufferSize = 81920;
+
+ /// <summary>
+ /// The default file stream buffer size
+ /// </summary>
+ public const int DefaultFileStreamBufferSize = 81920;
+ }
+}