Interface IFileSystem
Assembly: MediaBrowser.Model.dll
public interface IFileSystem
Properties
Returns a list of drives and common folders for convienent folder browsing.
Declaration
IEnumerable<FileSystemMetadata> CommonFolders { get; }
Property Value
Declaration
string DefaultDirectory { get; }
Property Value
Type |
Description |
System.String |
|
Declaration
char DirectorySeparatorChar { get; }
Property Value
Type |
Description |
System.Char |
|
Methods
Declaration
bool AreEqual(ReadOnlySpan<char> path1, ReadOnlySpan<char> path2)
Parameters
Type |
Name |
Description |
System.ReadOnlySpan<System.Char> |
path1 |
|
System.ReadOnlySpan<System.Char> |
path2 |
|
Returns
Type |
Description |
System.Boolean |
|
Declaration
bool AreEqual(string path1, string path2)
Parameters
Type |
Name |
Description |
System.String |
path1 |
|
System.String |
path2 |
|
Returns
Type |
Description |
System.Boolean |
|
Determines whether [contains sub path] [the specified parent path].
Declaration
bool ContainsSubPath(ReadOnlySpan<char> parentPath, ReadOnlySpan<char> path)
Parameters
Type |
Name |
Description |
System.ReadOnlySpan<System.Char> |
parentPath |
The parent path.
|
System.ReadOnlySpan<System.Char> |
path |
The path.
|
Returns
Type |
Description |
System.Boolean |
true if [contains sub path] [the specified parent path]; otherwise, false .
|
Declaration
bool ContainsSubPath(string parentPath, string path)
Parameters
Type |
Name |
Description |
System.String |
parentPath |
|
System.String |
path |
|
Returns
Type |
Description |
System.Boolean |
|
Declaration
void CopyFile(string source, string target, bool overwrite)
Parameters
Type |
Name |
Description |
System.String |
source |
The source.
|
System.String |
target |
The target.
|
System.Boolean |
overwrite |
if set to true [overwrite].
|
Declaration
void CreateDirectory(string path)
Parameters
Type |
Name |
Description |
System.String |
path |
The path.
|
Declaration
void DeleteDirectory(string path, bool recursive)
Parameters
Type |
Name |
Description |
System.String |
path |
The path.
|
System.Boolean |
recursive |
if set to true [recursive].
|
Declaration
void DeleteDirectory(string path, bool recursive, bool sendToRecycleBin)
Parameters
Type |
Name |
Description |
System.String |
path |
|
System.Boolean |
recursive |
|
System.Boolean |
sendToRecycleBin |
|
Declaration
void DeleteFile(string path)
Parameters
Type |
Name |
Description |
System.String |
path |
The path.
|
Declaration
void DeleteFile(string path, bool sendToRecycleBin)
Parameters
Type |
Name |
Description |
System.String |
path |
|
System.Boolean |
sendToRecycleBin |
|
Declaration
bool DirectoryExists(string path)
Parameters
Type |
Name |
Description |
System.String |
path |
The path.
|
Returns
Type |
Description |
System.Boolean |
true if XXXX, false otherwise.
|
Declaration
bool DirectoryExists(string path, FileSystemCredentials credentials)
Parameters
Returns
Type |
Description |
System.Boolean |
|
Declaration
bool FileExists(string path)
Parameters
Type |
Name |
Description |
System.String |
path |
The path.
|
Returns
Type |
Description |
System.Boolean |
true if XXXX, false otherwise.
|
Declaration
bool FileExists(string path, FileSystemCredentials credentials)
Parameters
Returns
Type |
Description |
System.Boolean |
|
Gets the creation time UTC.
Declaration
DateTimeOffset GetCreationTimeUtc(FileSystemMetadata info)
Parameters
Returns
Type |
Description |
System.DateTimeOffset |
DateTime.
|
Gets the creation time UTC.
Declaration
DateTimeOffset GetCreationTimeUtc(string path)
Parameters
Type |
Name |
Description |
System.String |
path |
The path.
|
Returns
Type |
Description |
System.DateTimeOffset |
DateTime.
|
Declaration
IEnumerable<FileSystemMetadata> GetDirectories(string path, bool recursive = false)
Parameters
Type |
Name |
Description |
System.String |
path |
The path.
|
System.Boolean |
recursive |
if set to true [recursive].
|
Returns
Type |
Description |
System.Collections.Generic.IEnumerable<FileSystemMetadata> |
IEnumerable<DirectoryInfo>.
|
Declaration
FileSystemMetadata GetDirectoryInfo(string path)
Parameters
Type |
Name |
Description |
System.String |
path |
A path to a directory.
|
Returns
Declaration
FileSystemMetadata GetDirectoryInfo(string path, FileSystemCredentials credentials)
Parameters
Returns
Declaration
ReadOnlySpan<char> GetDirectoryName(ReadOnlySpan<char> path)
Parameters
Type |
Name |
Description |
System.ReadOnlySpan<System.Char> |
path |
|
Returns
Type |
Description |
System.ReadOnlySpan<System.Char> |
|
Declaration
string GetDirectoryName(string path)
Parameters
Type |
Name |
Description |
System.String |
path |
|
Returns
Type |
Description |
System.String |
|
Gets the directory paths.
Declaration
IEnumerable<string> GetDirectoryPaths(string path, bool recursive = false)
Parameters
Type |
Name |
Description |
System.String |
path |
The path.
|
System.Boolean |
recursive |
if set to true [recursive].
|
Returns
Type |
Description |
System.Collections.Generic.IEnumerable<System.String> |
IEnumerable<System.String>.
|
Declaration
DriveInfo GetDriveInfo(string path)
Parameters
Type |
Name |
Description |
System.String |
path |
|
Returns
Type |
Description |
System.IO.DriveInfo |
|
Declaration
List<FileSystemMetadata> GetDrives()
Returns
Declaration
FileSystemMetadata GetFileInfo(string path)
Parameters
Type |
Name |
Description |
System.String |
path |
A path to a file.
|
Returns
GetFileNameWithoutExtension(FileSystemMetadata)
Gets the file name without extension.
Declaration
string GetFileNameWithoutExtension(FileSystemMetadata info)
Parameters
Returns
Type |
Description |
System.String |
System.String.
|
GetFileNameWithoutExtension(ReadOnlySpan<Char>)
Gets the file name without extension.
Declaration
ReadOnlySpan<char> GetFileNameWithoutExtension(ReadOnlySpan<char> path)
Parameters
Type |
Name |
Description |
System.ReadOnlySpan<System.Char> |
path |
The path.
|
Returns
Type |
Description |
System.ReadOnlySpan<System.Char> |
System.String.
|
GetFileNameWithoutExtension(String)
Declaration
string GetFileNameWithoutExtension(string path)
Parameters
Type |
Name |
Description |
System.String |
path |
|
Returns
Type |
Description |
System.String |
|
Declaration
IEnumerable<string> GetFilePaths(string path, bool recursive = false)
Parameters
Type |
Name |
Description |
System.String |
path |
The path.
|
System.Boolean |
recursive |
if set to true [recursive].
|
Returns
Type |
Description |
System.Collections.Generic.IEnumerable<System.String> |
IEnumerable<System.String>.
|
Declaration
IEnumerable<string> GetFilePaths(string path, string[] extensions, bool enableCaseSensitiveExtensions, bool recursive)
Parameters
Type |
Name |
Description |
System.String |
path |
|
System.String[] |
extensions |
|
System.Boolean |
enableCaseSensitiveExtensions |
|
System.Boolean |
recursive |
|
Returns
Type |
Description |
System.Collections.Generic.IEnumerable<System.String> |
|
Declaration
IEnumerable<FileSystemMetadata> GetFiles(string path, bool recursive = false)
Parameters
Type |
Name |
Description |
System.String |
path |
|
System.Boolean |
recursive |
|
Returns
Declaration
IEnumerable<FileSystemMetadata> GetFiles(string path, string[] extensions, bool enableCaseSensitiveExtensions, bool recursive)
Parameters
Type |
Name |
Description |
System.String |
path |
|
System.String[] |
extensions |
|
System.Boolean |
enableCaseSensitiveExtensions |
|
System.Boolean |
recursive |
|
Returns
Declaration
Stream GetFileStream(string path, FileOpenMode mode, FileAccessMode access, FileOpenOptions fileOpenOptions)
Parameters
Returns
Type |
Description |
System.IO.Stream |
|
Declaration
Stream GetFileStream(string path, FileOpenMode mode, FileAccessMode access, FileOpenOptions fileOpenOptions, long preAllocationSize)
Parameters
Returns
Type |
Description |
System.IO.Stream |
|
Declaration
Stream GetFileStream(string path, FileOpenMode mode, FileAccessMode access, FileShareMode share, FileOpenOptions fileOpenOptions)
Parameters
Returns
Type |
Description |
System.IO.Stream |
|
Declaration
Stream GetFileStream(string path, FileOpenMode mode, FileAccessMode access, FileShareMode share, FileOpenOptions fileOpenOptions, long preAllocationSize)
Parameters
Returns
Type |
Description |
System.IO.Stream |
|
Declaration
Stream GetFileStream(string path, FileOpenMode mode, FileAccessMode access, FileShareMode share, bool isAsync = false)
Parameters
Type |
Name |
Description |
System.String |
path |
The path.
|
FileOpenMode |
mode |
The mode.
|
FileAccessMode |
access |
The access.
|
FileShareMode |
share |
The share.
|
System.Boolean |
isAsync |
if set to true [is asynchronous].
|
Returns
Type |
Description |
System.IO.Stream |
FileStream.
|
Declaration
Stream GetFileStream(string path, FileOpenMode mode, FileAccessMode access, FileShareMode share, int bufferSize, FileOpenOptions fileOpenOptions)
Parameters
Returns
Type |
Description |
System.IO.Stream |
|
Declaration
Stream GetFileStream(string path, FileOpenMode mode, FileAccessMode access, FileShareMode share, int bufferSize, FileOpenOptions fileOpenOptions, long preAllocationSize)
Parameters
Returns
Type |
Description |
System.IO.Stream |
|
Declaration
Stream GetFileStream(string path, FileOpenMode mode, FileAccessMode access, bool isAsync = false)
Parameters
Returns
Type |
Description |
System.IO.Stream |
|
Gets the file system entries.
Declaration
IEnumerable<FileSystemMetadata> GetFileSystemEntries(string path, bool recursive = false, FileSystemCredentials credentials = null)
Parameters
Type |
Name |
Description |
System.String |
path |
The path.
|
System.Boolean |
recursive |
if set to true [recursive].
|
FileSystemCredentials |
credentials |
|
Returns
Type |
Description |
System.Collections.Generic.IEnumerable<FileSystemMetadata> |
IEnumerable<FileSystemMetadata>.
|
GetFileSystemEntryPaths(String, Boolean)
Gets the file system entry paths.
Declaration
IEnumerable<string> GetFileSystemEntryPaths(string path, bool recursive = false)
Parameters
Type |
Name |
Description |
System.String |
path |
The path.
|
System.Boolean |
recursive |
if set to true [recursive].
|
Returns
Type |
Description |
System.Collections.Generic.IEnumerable<System.String> |
IEnumerable<System.String>.
|
Declaration
FileSystemMetadata GetFileSystemInfo(string path)
Parameters
Type |
Name |
Description |
System.String |
path |
A path to a file or directory.
|
Returns
Declaration
string GetFullPath(string path)
Parameters
Type |
Name |
Description |
System.String |
path |
|
Returns
Type |
Description |
System.String |
|
Gets the last write time UTC.
Declaration
DateTimeOffset GetLastWriteTimeUtc(FileSystemMetadata info)
Parameters
Returns
Type |
Description |
System.DateTimeOffset |
DateTime.
|
Gets the last write time UTC.
Declaration
DateTimeOffset GetLastWriteTimeUtc(string path)
Parameters
Type |
Name |
Description |
System.String |
path |
The path.
|
Returns
Type |
Description |
System.DateTimeOffset |
DateTime.
|
Declaration
DateTimeOffset GetLastWriteTimeUtc(string path, bool fileExists)
Parameters
Type |
Name |
Description |
System.String |
path |
|
System.Boolean |
fileExists |
|
Returns
Type |
Description |
System.DateTimeOffset |
|
Declaration
string GetValidFilename(string filename)
Parameters
Type |
Name |
Description |
System.String |
filename |
The filename.
|
Returns
Type |
Description |
System.String |
System.String.
|
Determines whether [is path file] [the specified path].
Declaration
bool IsPathFile(ReadOnlySpan<char> path)
Parameters
Type |
Name |
Description |
System.ReadOnlySpan<System.Char> |
path |
The path.
|
Returns
Type |
Description |
System.Boolean |
true if [is path file] [the specified path]; otherwise, false .
|
Determines whether [is root path] [the specified path].
Declaration
bool IsRootPath(ReadOnlySpan<char> path)
Parameters
Type |
Name |
Description |
System.ReadOnlySpan<System.Char> |
path |
The path.
|
Returns
Type |
Description |
System.Boolean |
true if [is root path] [the specified path]; otherwise, false .
|
Declaration
ReadOnlySpan<char> MakeAbsolutePath(ReadOnlySpan<char> folderPath, ReadOnlySpan<char> filePath)
Parameters
Type |
Name |
Description |
System.ReadOnlySpan<System.Char> |
folderPath |
|
System.ReadOnlySpan<System.Char> |
filePath |
|
Returns
Type |
Description |
System.ReadOnlySpan<System.Char> |
|
Declaration
void MoveDirectory(string source, string target)
Parameters
Type |
Name |
Description |
System.String |
source |
The source.
|
System.String |
target |
The target.
|
Declaration
void MoveFile(string source, string target)
Parameters
Type |
Name |
Description |
System.String |
source |
The source.
|
System.String |
target |
The target.
|
Declaration
void MoveFile(string source, string target, bool overwrite)
Parameters
Type |
Name |
Description |
System.String |
source |
|
System.String |
target |
|
System.Boolean |
overwrite |
|
Declaration
List<FileSystemMetadata> NormalizeDuplicates(FileSystemMetadata[] paths, bool checkSubPaths)
Parameters
Returns
Declaration
ReadOnlySpan<char> NormalizePath(ReadOnlySpan<char> path)
Parameters
Type |
Name |
Description |
System.ReadOnlySpan<System.Char> |
path |
The path.
|
Returns
Type |
Description |
System.ReadOnlySpan<System.Char> |
System.String.
|
Declaration
string NormalizePath(string path)
Parameters
Type |
Name |
Description |
System.String |
path |
|
Returns
Type |
Description |
System.String |
|
Declaration
Stream OpenRead(string path)
Parameters
Type |
Name |
Description |
System.String |
path |
The path.
|
Returns
Type |
Description |
System.IO.Stream |
Stream.
|
Declaration
Task<byte[]> ReadAllBytesAsync(string path, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type |
Name |
Description |
System.String |
path |
|
System.Threading.CancellationToken |
cancellationToken |
|
Returns
Type |
Description |
System.Threading.Tasks.Task<System.Byte[]> |
|
Declaration
string[] ReadAllLines(string path)
Parameters
Type |
Name |
Description |
System.String |
path |
|
Returns
Type |
Description |
System.String[] |
|
Declaration
Task<string[]> ReadAllLinesAsync(string path, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type |
Name |
Description |
System.String |
path |
|
System.Threading.CancellationToken |
cancellationToken |
|
Returns
Type |
Description |
System.Threading.Tasks.Task<System.String[]> |
|
ReadAllText(String)
Declaration
string ReadAllText(string path)
Parameters
Type |
Name |
Description |
System.String |
path |
|
Returns
Type |
Description |
System.String |
|
ReadAllTextAsync(String, Encoding, CancellationToken)
Declaration
Task<string> ReadAllTextAsync(string path, Encoding encoding, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type |
Name |
Description |
System.String |
path |
The path.
|
System.Text.Encoding |
encoding |
The encoding.
|
System.Threading.CancellationToken |
cancellationToken |
The cancellation token.
|
Returns
Type |
Description |
System.Threading.Tasks.Task<System.String> |
System.String.
|
ReadAllTextAsync(String, CancellationToken)
Declaration
Task<string> ReadAllTextAsync(string path, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type |
Name |
Description |
System.String |
path |
The path.
|
System.Threading.CancellationToken |
cancellationToken |
The cancellation token.
|
Returns
Type |
Description |
System.Threading.Tasks.Task<System.String> |
System.String.
|
Declaration
void SetAttributes(string path, bool isHidden, bool readOnly)
Parameters
Type |
Name |
Description |
System.String |
path |
|
System.Boolean |
isHidden |
|
System.Boolean |
readOnly |
|
Declaration
void SetExecutable(string path)
Parameters
Type |
Name |
Description |
System.String |
path |
|
Declaration
void SetHidden(string path, bool isHidden)
Parameters
Type |
Name |
Description |
System.String |
path |
|
System.Boolean |
isHidden |
|
Declaration
void SetLastWriteTimeUtc(string path, DateTime lastWriteTimeUtc)
Parameters
Type |
Name |
Description |
System.String |
path |
|
System.DateTime |
lastWriteTimeUtc |
|
Declaration
void SetReadOnly(string path, bool readOnly)
Parameters
Type |
Name |
Description |
System.String |
path |
|
System.Boolean |
readOnly |
|
Declaration
bool SupportsPathNatively(string path)
Parameters
Type |
Name |
Description |
System.String |
path |
|
Returns
Type |
Description |
System.Boolean |
|
Declaration
void SwapFiles(string file1, string file2)
Parameters
Type |
Name |
Description |
System.String |
file1 |
The file1.
|
System.String |
file2 |
The file2.
|
Declaration
void WriteAllBytes(string path, byte[] bytes)
Parameters
Type |
Name |
Description |
System.String |
path |
|
System.Byte[] |
bytes |
|
Declaration
Task WriteAllBytesAsync(string path, byte[] bytes, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type |
Name |
Description |
System.String |
path |
|
System.Byte[] |
bytes |
|
System.Threading.CancellationToken |
cancellationToken |
|
Returns
Type |
Description |
System.Threading.Tasks.Task |
|
Declaration
void WriteAllLines(string path, IEnumerable<string> lines)
Parameters
Type |
Name |
Description |
System.String |
path |
|
System.Collections.Generic.IEnumerable<System.String> |
lines |
|
WriteAllText(String, String)
Declaration
void WriteAllText(string path, string text)
Parameters
Type |
Name |
Description |
System.String |
path |
The path.
|
System.String |
text |
The text.
|
WriteAllText(String, String, Encoding)
Declaration
void WriteAllText(string path, string text, Encoding encoding)
Parameters
Type |
Name |
Description |
System.String |
path |
The path.
|
System.String |
text |
The text.
|
System.Text.Encoding |
encoding |
The encoding.
|
WriteAllTextAsync(String, String, Encoding, CancellationToken)
Declaration
Task WriteAllTextAsync(string path, string text, Encoding encoding, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type |
Name |
Description |
System.String |
path |
|
System.String |
text |
|
System.Text.Encoding |
encoding |
|
System.Threading.CancellationToken |
cancellationToken |
|
Returns
Type |
Description |
System.Threading.Tasks.Task |
|
WriteAllTextAsync(String, String, CancellationToken)
Declaration
Task WriteAllTextAsync(string path, string text, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type |
Name |
Description |
System.String |
path |
|
System.String |
text |
|
System.Threading.CancellationToken |
cancellationToken |
|
Returns
Type |
Description |
System.Threading.Tasks.Task |
|
Extension Methods