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.Common/IO/IFileSystem.cs | 57 +++++++++++++++++++++++++---------- 1 file changed, 41 insertions(+), 16 deletions(-) (limited to 'MediaBrowser.Common/IO/IFileSystem.cs') diff --git a/MediaBrowser.Common/IO/IFileSystem.cs b/MediaBrowser.Common/IO/IFileSystem.cs index 5ce84f436..60ba4c8ae 100644 --- a/MediaBrowser.Common/IO/IFileSystem.cs +++ b/MediaBrowser.Common/IO/IFileSystem.cs @@ -1,5 +1,7 @@ using System; using System.IO; +using System.Collections.Generic; +using System.Text; namespace MediaBrowser.Common.IO { @@ -73,7 +75,9 @@ namespace MediaBrowser.Common.IO /// The share. /// if set to true [is asynchronous]. /// FileStream. - FileStream GetFileStream(string path, FileMode mode, FileAccess access, FileShare share, bool isAsync = false); + Stream GetFileStream(string path, FileMode mode, FileAccess access, FileShare share, bool isAsync = false); + + Stream OpenRead(String path); /// /// Swaps the files. @@ -134,21 +138,6 @@ namespace MediaBrowser.Common.IO /// true if [is path file] [the specified path]; otherwise, false. bool IsPathFile(string path); - /// - /// Deletes the file. - /// - /// The path. - /// if set to true [send to recycle bin]. - void DeleteFile(string path, bool sendToRecycleBin); - - /// - /// Deletes the directory. - /// - /// The path. - /// if set to true [recursive]. - /// if set to true [send to recycle bin]. - void DeleteDirectory(string path, bool recursive, bool sendToRecycleBin); - /// /// Deletes the file. /// @@ -161,5 +150,41 @@ namespace MediaBrowser.Common.IO /// The path. /// if set to true [recursive]. void DeleteDirectory(string path, bool recursive); + + IEnumerable GetDirectories(string path, bool recursive = false); + + IEnumerable GetFiles(string path, bool recursive = false); + + IEnumerable GetFileSystemEntries(string path, bool recursive = false); + + void CreateDirectory(string path); + + void CopyFile(string source, string target, bool overwrite); + + void MoveFile(string source, string target); + + void MoveDirectory(string source, string target); + + bool DirectoryExists(string path); + + bool FileExists(string path); + + string ReadAllText(string path, Encoding encoding); + + string ReadAllText(string path); + + byte[] ReadAllBytes(string path); + + void WriteAllBytes(string path, byte[] bytes); + + void WriteAllText(string path, string text, Encoding encoding); + + void WriteAllText(string path, string text); + + void CreateFile(string path); + + void WriteAllLines(string path, string[] lines); + + string[] ReadAllLines(string path); } } -- cgit v1.2.3