From d3afa531913d94e541969f008d8065603579d9af Mon Sep 17 00:00:00 2001 From: Erwin de Haan Date: Sat, 26 Jan 2019 23:24:28 +0100 Subject: Final refactored `IFileSystem` and `ManagedFileSystem` --- MediaBrowser.Model/IO/IFileSystem.cs | 142 +++++------------------------------ 1 file changed, 18 insertions(+), 124 deletions(-) (limited to 'MediaBrowser.Model/IO/IFileSystem.cs') diff --git a/MediaBrowser.Model/IO/IFileSystem.cs b/MediaBrowser.Model/IO/IFileSystem.cs index b8a315ccc..6c9b2bd88 100644 --- a/MediaBrowser.Model/IO/IFileSystem.cs +++ b/MediaBrowser.Model/IO/IFileSystem.cs @@ -36,32 +36,32 @@ namespace MediaBrowser.Model.IO string MakeAbsolutePath(string folderPath, string filePath); /// - /// Returns a object for the specified file or directory path. + /// Returns a object for the specified file or directory path. /// /// A path to a file or directory. - /// A object. - /// If the specified path points to a directory, the returned object's - /// property will be set to true and all other properties will reflect the properties of the directory. + /// A object. + /// If the specified path points to a directory, the returned object's + /// property will be set to true and all other properties will reflect the properties of the directory. FileSystemMetadata GetFileSystemInfo(string path); /// - /// Returns a object for the specified file path. + /// Returns a object for the specified file path. /// /// A path to a file. - /// A object. - /// If the specified path points to a directory, the returned object's - /// property and the property will both be set to false. - /// For automatic handling of files and directories, use . + /// A object. + /// If the specified path points to a directory, the returned object's + /// property and the property will both be set to false. + /// For automatic handling of files and directories, use . FileSystemMetadata GetFileInfo(string path); /// - /// Returns a object for the specified directory path. + /// Returns a object for the specified directory path. /// /// A path to a directory. - /// A object. - /// If the specified path points to a file, the returned object's - /// property will be set to true and the property will be set to false. - /// For automatic handling of files and directories, use . + /// A object. + /// If the specified path points to a file, the returned object's + /// property will be set to true and the property will be set to false. + /// For automatic handling of files and directories, use . FileSystemMetadata GetDirectoryInfo(string path); /// @@ -110,14 +110,8 @@ namespace MediaBrowser.Model.IO /// FileStream. 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); - - /// - /// Opens the read. - /// - /// The path. - /// Stream. - Stream OpenRead(string path); + Stream GetFileStream(string path, FileOpenMode mode, FileAccessMode access, FileShareMode share, + FileOpenOptions fileOpenOptions); string DefaultDirectory { get; } @@ -152,8 +146,6 @@ namespace MediaBrowser.Model.IO /// System.String. string NormalizePath(string path); - string GetDirectoryName(string path); - /// /// Gets the file name without extension. /// @@ -161,13 +153,6 @@ namespace MediaBrowser.Model.IO /// 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]. /// @@ -181,13 +166,6 @@ namespace MediaBrowser.Model.IO /// 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. /// @@ -211,86 +189,6 @@ namespace MediaBrowser.Model.IO /// 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); - - byte[] ReadAllBytes(string path); - - void WriteAllBytes(string path, byte[] bytes); - - /// - /// 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); - - string[] ReadAllLines(string path); - - void WriteAllLines(string path, IEnumerable lines); - /// /// Gets the directory paths. /// @@ -306,6 +204,7 @@ namespace MediaBrowser.Model.IO /// if set to true [recursive]. /// IEnumerable<System.String>. IEnumerable GetFilePaths(string path, bool recursive = false); + IEnumerable GetFilePaths(string path, string[] extensions, bool enableCaseSensitiveExtensions, bool recursive); /// @@ -319,15 +218,10 @@ namespace MediaBrowser.Model.IO 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 GetDrives(); - void SetExecutable(string path); } + //TODO Investigate if can be replaced by the one from System.IO ? public enum FileOpenMode { -- cgit v1.2.3