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); } }