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

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

Public Methods

Method Description
AppendAllLines ( string path, IEnumerable contents ) : void

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

AppendAllLines ( string path, IEnumerable contents, Encoding encoding ) : void

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

AppendAllText ( string path, string contents ) : void

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 ) : void

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

CopyFile ( string sourceFileName, string destinationFileName ) : void

Copies an existing file to a new file.

CopyFile ( string sourceFileName, string destinationFileName, bool overwrite ) : void

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

CreateDirectory ( string dir ) : void

Creates a directory in the storage scope.

CreateFile ( string path ) : Stream

Creates a file in the store.

DeleteDirectory ( string dir ) : void

Deletes a directory in the storage scope.

DeleteFile ( string path ) : void

Deletes the specified file.

DirectoryExists ( string dir ) : bool

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

FileExists ( string path ) : bool

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

GetDirectoryNames ( ) : string[]

Enumerates the directories in the root of a store.

GetDirectoryNames ( string searchPattern ) : string[]

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

GetFileNames ( ) : string[]

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

GetFileNames ( string searchPattern ) : string[]

Enumerates files in storage scope that match a given pattern.

IncreaseQuotaTo ( long newQuotaSize ) : bool

Enables an application to explicitly request a larger quota size, in bytes.

MoveDirectory ( string sourceDirectoryName, string destinationDirectoryName ) : void

Moves a specified directory and its contents to a new location.

MoveFile ( string sourceFileName, string destinationFileName ) : void

Moves a specified file to a new location, and optionally lets you specify a new file name.

OpenFile ( string path, FileMode mode ) : Stream

Opens a file in the specified mode.

OpenFile ( string path, FileMode mode, FileAccess access ) : Stream

Opens a file in the specified mode with the specified file access.

OpenFile ( string path, FileMode mode, FileAccess access, FileShare share ) : Stream

Opens a file in the specified mode with read, write, or read/write access and the specified sharing option.

ReadAllBytes ( string path ) : byte[]

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.

ReadAllLines ( string path ) : string[]

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

ReadAllLines ( string path, Encoding encoding ) : string[]

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

ReadAllText ( string path ) : string

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

ReadAllText ( string path, Encoding encoding ) : string

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

ReadLines ( string path ) : IEnumerable

Reads the lines of a file.

ReadLines ( string path, Encoding encoding ) : IEnumerable

Reads the lines of a file that has a specified encoding.

WriteAllBytes ( string path, byte bytes ) : void

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.

WriteAllLines ( string path, IEnumerable contents ) : void

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

WriteAllLines ( string path, IEnumerable contents, Encoding encoding ) : void

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

WriteAllText ( string path, string contents ) : void

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.

WriteAllText ( string path, string contents, Encoding encoding ) : void

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.

Method Details

AppendAllLines() public method

Appends lines to a file, and then closes the file.
public AppendAllLines ( string path, IEnumerable contents ) : void
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 void

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 ) : void
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 void

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 ) : void
path string The file to append the specified string to.
contents string The string to append to the file.
return void

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 ) : void
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 void

CopyFile() public method

Copies an existing file to a new file.
public CopyFile ( string sourceFileName, string destinationFileName ) : void
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 void

CopyFile() public method

Copies an existing file to a new file, and optionally overwrites an existing file.
public CopyFile ( string sourceFileName, string destinationFileName, bool overwrite ) : void
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 void

CreateDirectory() public method

Creates a directory in the storage scope.
public CreateDirectory ( string dir ) : void
dir string The relative path of the directory to create within the storage.
return void

CreateFile() public method

Creates a file in the store.
public CreateFile ( string path ) : Stream
path string The relative path of the file to be created in the store.
return System.IO.Stream

DeleteDirectory() public method

Deletes a directory in the storage scope.
public DeleteDirectory ( string dir ) : void
dir string The relative path of the directory to delete within the storage scope.
return void

DeleteFile() public method

Deletes the specified file.
public DeleteFile ( string path ) : void
path string The name of the file to be deleted. Wildcard characters are not supported.
return void

DirectoryExists() public method

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

FileExists() public method

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

GetDirectoryNames() public method

Enumerates the directories in the root of a store.
public GetDirectoryNames ( ) : string[]
return string[]

GetDirectoryNames() public method

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

GetFileNames() public method

Obtains the names of files in the root of a store.
public GetFileNames ( ) : string[]
return string[]

GetFileNames() public method

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

IncreaseQuotaTo() public method

Enables an application to explicitly request a larger quota size, in bytes.
public IncreaseQuotaTo ( long newQuotaSize ) : bool
newQuotaSize long The requested size, in bytes.
return bool

MoveDirectory() public method

Moves a specified directory and its contents to a new location.
public MoveDirectory ( string sourceDirectoryName, string destinationDirectoryName ) : void
sourceDirectoryName string The name of the directory to move.
destinationDirectoryName string The path to the new location for sourceDirectoryName. This cannot be the path to an existing directory.
return void

MoveFile() public method

Moves a specified file to a new location, and optionally lets you specify a new file name.
public MoveFile ( string sourceFileName, string destinationFileName ) : void
sourceFileName string The name of the file to move.
destinationFileName string The path to the new location for the file. If a file name is included, the moved file will have that name.
return void

OpenFile() public method

Opens a file in the specified mode.
public OpenFile ( string path, FileMode mode ) : Stream
path string The relative path of the file within the store.
mode FileMode The mode in which to open the file.
return System.IO.Stream

OpenFile() public method

Opens a file in the specified mode with the specified file access.
public OpenFile ( string path, FileMode mode, FileAccess access ) : Stream
path string The relative path of the file within the store.
mode FileMode The mode in which to open the file.
access FileAccess The type of access to open the file with.
return System.IO.Stream

OpenFile() public method

Opens a file in the specified mode with read, write, or read/write access and the specified sharing option.
public OpenFile ( string path, FileMode mode, FileAccess access, FileShare share ) : Stream
path string The relative path of the file within the store.
mode FileMode The mode in which to open the file.
access FileAccess The type of access to open the file with.
share FileShare The type of access other objects have to this file.
return System.IO.Stream

ReadAllBytes() 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 ReadAllBytes ( string path ) : byte[]
path string The file to open for reading.
return byte[]

ReadAllLines() public method

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

ReadAllLines() public method

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

ReadAllText() public method

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

ReadAllText() public method

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

ReadLines() public method

Reads the lines of a file.
public ReadLines ( string path ) : IEnumerable
path string The file to read.
return IEnumerable

ReadLines() public method

Reads the lines of a file that has a specified encoding.
public ReadLines ( string path, Encoding encoding ) : IEnumerable
path string The file to read.
encoding System.Text.Encoding The encoding that is applied to the contents of the file.
return IEnumerable

WriteAllBytes() 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 WriteAllBytes ( string path, byte bytes ) : void
path string The file to write to.
bytes byte The bytes to write to the file.
return void

WriteAllLines() public method

Creates a new file, writes a collection of strings to the file, and then closes the file.
public WriteAllLines ( string path, IEnumerable contents ) : void
path string The file to write to.
contents IEnumerable The lines to write to the file.
return void

WriteAllLines() 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 WriteAllLines ( string path, IEnumerable contents, Encoding encoding ) : void
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 void

WriteAllText() 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 WriteAllText ( string path, string contents ) : void
path string The file to write to.
contents string The string to write to the file.
return void

WriteAllText() 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 WriteAllText ( string path, string contents, Encoding encoding ) : void
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 void