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

Represents an implementation of the IStorageService.
Inheritance: IStorageService
Afficher le fichier Open project: Cimbalino/Cimbalino-Phone-Toolkit

Méthodes publiques

Méthode 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 méthode

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.
Résultat void

AppendAllLines() public méthode

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.
Résultat void

AppendAllText() public méthode

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.
Résultat void

AppendAllText() public méthode

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.
Résultat void

CopyFile() public méthode

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.
Résultat void

CopyFile() public méthode

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.
Résultat void

CreateDirectory() public méthode

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.
Résultat void

CreateFile() public méthode

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.
Résultat System.IO.Stream

DeleteDirectory() public méthode

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.
Résultat void

DeleteFile() public méthode

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

DirectoryExists() public méthode

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

FileExists() public méthode

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.
Résultat bool

GetDirectoryNames() public méthode

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

GetDirectoryNames() public méthode

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.
Résultat string[]

GetFileNames() public méthode

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

GetFileNames() public méthode

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.
Résultat string[]

IncreaseQuotaTo() public méthode

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

MoveDirectory() public méthode

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.
Résultat void

MoveFile() public méthode

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.
Résultat void

OpenFile() public méthode

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.
Résultat System.IO.Stream

OpenFile() public méthode

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.
Résultat System.IO.Stream

OpenFile() public méthode

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.
Résultat System.IO.Stream

ReadAllBytes() public méthode

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.
Résultat byte[]

ReadAllLines() public méthode

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.
Résultat string[]

ReadAllLines() public méthode

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.
Résultat string[]

ReadAllText() public méthode

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.
Résultat string

ReadAllText() public méthode

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.
Résultat string

ReadLines() public méthode

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

ReadLines() public méthode

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.
Résultat IEnumerable

WriteAllBytes() public méthode

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.
Résultat void

WriteAllLines() public méthode

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.
Résultat void

WriteAllLines() public méthode

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.
Résultat void

WriteAllText() public méthode

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.
Résultat void

WriteAllText() public méthode

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.
Résultat void