C# Class Cimbalino.Phone.Toolkit.Services.AsyncStorageService

Represents an implementation of the IAsyncStorageService.
Inheritance: IAsyncStorageService
Show file Open project: Cimbalino/Cimbalino-Phone-Toolkit

Public Methods

Method Description
AppendAllLines ( string path, IEnumerable contents ) : System.Threading.Tasks.Task

Appends lines to a file, and then closes the file.

AppendAllLines ( string path, IEnumerable contents, Encoding encoding ) : System.Threading.Tasks.Task

Appends lines to a file by using a specified encoding, and then closes the file.

AppendAllText ( string path, string contents ) : System.Threading.Tasks.Task

Opens a file, appends the specified string to the file, and then closes the file. If the file does not exist, this method creates a file, writes the specified string to the file, then closes the file.

AppendAllText ( string path, string contents, Encoding encoding ) : System.Threading.Tasks.Task

Appends the specified string to the file, creating the file if it does not already exist.

CopyFileAsync ( string sourceFileName, string destinationFileName ) : System.Threading.Tasks.Task

Copies an existing file to a new file.

CopyFileAsync ( string sourceFileName, string destinationFileName, bool overwrite ) : System.Threading.Tasks.Task

Copies an existing file to a new file, and optionally overwrites an existing file.

CreateDirectoryAsync ( string dir ) : System.Threading.Tasks.Task

Creates a directory in the storage scope.

CreateFileAsync ( string path ) : Task

Creates a file in the store.

DeleteDirectoryAsync ( string dir ) : System.Threading.Tasks.Task

Deletes a directory in the storage scope.

DeleteFileAsync ( string path ) : System.Threading.Tasks.Task

Deletes the specified file.

DirectoryExistsAsync ( string dir ) : Task

Determines whether the specified path refers to an existing directory in the store.

FileExistsAsync ( string path ) : Task

Determines whether the specified path refers to an existing file in the store.

GetDirectoryNamesAsync ( ) : Task

Enumerates the directories in the root of a store.

GetDirectoryNamesAsync ( string searchPattern ) : Task

Enumerates directories in a storage scope that match a given pattern.

GetFileNamesAsync ( ) : Task

Obtains the names of files in the root of a store.

GetFileNamesAsync ( string searchPattern ) : Task

Enumerates files in storage scope that match a given pattern.

OpenFileForReadAsync ( string path ) : Task

Opens a file in the specified mode.

ReadAllBytesAsync ( string path ) : Task

Opens a binary file, reads the contents of the file into a byte array, and then closes the file. Returns null, if an exception is raised.

ReadAllLinesAsync ( string path ) : Task

Opens a text file, reads all lines of the file, and then closes the file.

ReadAllLinesAsync ( string path, Encoding encoding ) : Task

Opens a file, reads all lines of the file with the specified encoding, and then closes the file.

ReadAllTextAsync ( string path ) : Task

Opens a text file, reads all lines of the file, and then closes the file.

ReadAllTextAsync ( string path, Encoding encoding ) : Task

Opens a file, reads all lines of the file with the specified encoding, and then closes the file.

WriteAllBytesAsync ( string path, byte bytes ) : System.Threading.Tasks.Task

Creates a new file, writes the specified byte array to the file, and then closes the file. If the target file already exists, it is overwritten.

WriteAllLinesAsync ( string path, IEnumerable contents ) : System.Threading.Tasks.Task

Creates a new file, writes a collection of strings to the file, and then closes the file.

WriteAllLinesAsync ( string path, IEnumerable contents, Encoding encoding ) : System.Threading.Tasks.Task

Creates a new file by using the specified encoding, writes a collection of strings to the file, and then closes the file.

WriteAllTextAsync ( string path, string contents ) : System.Threading.Tasks.Task

Creates a new file, writes the specified string to the file, and then closes the file. If the target file already exists, it is overwritten.

WriteAllTextAsync ( string path, string contents, Encoding encoding ) : System.Threading.Tasks.Task

Creates a new file, writes the specified string to the file using the specified encoding, and then closes the file. If the target file already exists, it is overwritten.

Private Methods

Method Description
FilePatternToRegex ( string pattern ) : Regex

Method Details

AppendAllLines() public method

Appends lines to a file, and then closes the file.
public AppendAllLines ( string path, IEnumerable contents ) : System.Threading.Tasks.Task
path string The file to append the lines to. The file is created if it does not already exist.
contents IEnumerable The lines to append to the file.
return System.Threading.Tasks.Task

AppendAllLines() public method

Appends lines to a file by using a specified encoding, and then closes the file.
public AppendAllLines ( string path, IEnumerable contents, Encoding encoding ) : System.Threading.Tasks.Task
path string The file to append the lines to. The file is created if it does not already exist.
contents IEnumerable The lines to append to the file.
encoding System.Text.Encoding The character encoding to use.
return System.Threading.Tasks.Task

AppendAllText() public method

Opens a file, appends the specified string to the file, and then closes the file. If the file does not exist, this method creates a file, writes the specified string to the file, then closes the file.
public AppendAllText ( string path, string contents ) : System.Threading.Tasks.Task
path string The file to append the specified string to.
contents string The string to append to the file.
return System.Threading.Tasks.Task

AppendAllText() public method

Appends the specified string to the file, creating the file if it does not already exist.
public AppendAllText ( string path, string contents, Encoding encoding ) : System.Threading.Tasks.Task
path string The file to append the specified string to.
contents string The string to append to the file.
encoding System.Text.Encoding The character encoding to use.
return System.Threading.Tasks.Task

CopyFileAsync() public method

Copies an existing file to a new file.
public CopyFileAsync ( string sourceFileName, string destinationFileName ) : System.Threading.Tasks.Task
sourceFileName string The name of the file to copy.
destinationFileName string The name of the destination file. This cannot be a directory or an existing file.
return System.Threading.Tasks.Task

CopyFileAsync() public method

Copies an existing file to a new file, and optionally overwrites an existing file.
public CopyFileAsync ( string sourceFileName, string destinationFileName, bool overwrite ) : System.Threading.Tasks.Task
sourceFileName string The name of the file to copy.
destinationFileName string The name of the destination file. This cannot be a directory.
overwrite bool true if the destination file can be overwritten; otherwise, false.
return System.Threading.Tasks.Task

CreateDirectoryAsync() public method

Creates a directory in the storage scope.
public CreateDirectoryAsync ( string dir ) : System.Threading.Tasks.Task
dir string The relative path of the directory to create within the storage.
return System.Threading.Tasks.Task

CreateFileAsync() public method

Creates a file in the store.
public CreateFileAsync ( string path ) : Task
path string The relative path of the file to be created in the store.
return Task

DeleteDirectoryAsync() public method

Deletes a directory in the storage scope.
public DeleteDirectoryAsync ( string dir ) : System.Threading.Tasks.Task
dir string The relative path of the directory to delete within the storage scope.
return System.Threading.Tasks.Task

DeleteFileAsync() public method

Deletes the specified file.
public DeleteFileAsync ( string path ) : System.Threading.Tasks.Task
path string The name of the file to be deleted. Wildcard characters are not supported.
return System.Threading.Tasks.Task

DirectoryExistsAsync() public method

Determines whether the specified path refers to an existing directory in the store.
public DirectoryExistsAsync ( string dir ) : Task
dir string The path to test.
return Task

FileExistsAsync() public method

Determines whether the specified path refers to an existing file in the store.
public FileExistsAsync ( string path ) : Task
path string The path and file name to test.
return Task

GetDirectoryNamesAsync() public method

Enumerates the directories in the root of a store.
public GetDirectoryNamesAsync ( ) : Task
return Task

GetDirectoryNamesAsync() public method

Enumerates directories in a storage scope that match a given pattern.
public GetDirectoryNamesAsync ( string searchPattern ) : Task
searchPattern string A search pattern. Both single-character ("?") and multi-character ("*") wildcards are supported.
return Task

GetFileNamesAsync() public method

Obtains the names of files in the root of a store.
public GetFileNamesAsync ( ) : Task
return Task

GetFileNamesAsync() public method

Enumerates files in storage scope that match a given pattern.
public GetFileNamesAsync ( string searchPattern ) : Task
searchPattern string A search pattern. Both single-character ("?") and multi-character ("*") wildcards are supported.
return Task

OpenFileForReadAsync() public method

Opens a file in the specified mode.
public OpenFileForReadAsync ( string path ) : Task
path string The relative path of the file within the store.
return Task

ReadAllBytesAsync() public method

Opens a binary file, reads the contents of the file into a byte array, and then closes the file. Returns null, if an exception is raised.
public ReadAllBytesAsync ( string path ) : Task
path string The file to open for reading.
return Task

ReadAllLinesAsync() public method

Opens a text file, reads all lines of the file, and then closes the file.
public ReadAllLinesAsync ( string path ) : Task
path string The file to open for reading.
return Task

ReadAllLinesAsync() public method

Opens a file, reads all lines of the file with the specified encoding, and then closes the file.
public ReadAllLinesAsync ( string path, Encoding encoding ) : Task
path string The file to open for reading.
encoding System.Text.Encoding The encoding applied to the contents of the file.
return Task

ReadAllTextAsync() public method

Opens a text file, reads all lines of the file, and then closes the file.
public ReadAllTextAsync ( string path ) : Task
path string The file to open for reading.
return Task

ReadAllTextAsync() public method

Opens a file, reads all lines of the file with the specified encoding, and then closes the file.
public ReadAllTextAsync ( string path, Encoding encoding ) : Task
path string The file to open for reading.
encoding System.Text.Encoding The encoding applied to the contents of the file.
return Task

WriteAllBytesAsync() public method

Creates a new file, writes the specified byte array to the file, and then closes the file. If the target file already exists, it is overwritten.
public WriteAllBytesAsync ( string path, byte bytes ) : System.Threading.Tasks.Task
path string The file to write to.
bytes byte The bytes to write to the file.
return System.Threading.Tasks.Task

WriteAllLinesAsync() public method

Creates a new file, writes a collection of strings to the file, and then closes the file.
public WriteAllLinesAsync ( string path, IEnumerable contents ) : System.Threading.Tasks.Task
path string The file to write to.
contents IEnumerable The lines to write to the file.
return System.Threading.Tasks.Task

WriteAllLinesAsync() public method

Creates a new file by using the specified encoding, writes a collection of strings to the file, and then closes the file.
public WriteAllLinesAsync ( string path, IEnumerable contents, Encoding encoding ) : System.Threading.Tasks.Task
path string The file to write to.
contents IEnumerable The lines to write to the file.
encoding System.Text.Encoding The character encoding to use.
return System.Threading.Tasks.Task

WriteAllTextAsync() public method

Creates a new file, writes the specified string to the file, and then closes the file. If the target file already exists, it is overwritten.
public WriteAllTextAsync ( string path, string contents ) : System.Threading.Tasks.Task
path string The file to write to.
contents string The string to write to the file.
return System.Threading.Tasks.Task

WriteAllTextAsync() public method

Creates a new file, writes the specified string to the file using the specified encoding, and then closes the file. If the target file already exists, it is overwritten.
public WriteAllTextAsync ( string path, string contents, Encoding encoding ) : System.Threading.Tasks.Task
path string The file to write to.
contents string The string to write to the file.
encoding System.Text.Encoding The encoding to apply to the string.
return System.Threading.Tasks.Task