C# Class ModernApp4Me.Universal.Cache.M4MFilePersistence

Enables to store some contents into a specific StorageFolder. The classe implements the singleton pattern and is thread safe !
显示文件 Open project: smartnsoft/ModernApp4Me

Public Methods

Method Description
CopyFile ( StorageFolder source, StorageFolder destination, string fileName, string destinationFileName = null ) : Task

Copy a file from a source StorageFolder to a destination StorageFolder

CopyFolder ( StorageFolder source, StorageFolder destination, string directoryName ) : Task

Copy a StorageFolder and its content to a specified directory

CreateDirectory ( StorageFolder storageFolder, string path ) : Task

Creates a directory into a specified StorageFolder by creating all missing StorageFolder

CreateFolder ( StorageFolder storageFolder, string folderName, CreationCollisionOption creationOption ) : Task

Creates a StorageFolder into a specified StorageFolder

DeleteFile ( StorageFolder storageFolder, string fileName ) : Task

Delete a file from a specified StorageFolder

DeleteFolder ( StorageFolder storageFolder, string folderName = null ) : Task

Removes a StorageFolder into a specified StorageFolder

GetFreeSpace ( StorageFolder storageFolder ) : Task

Get the free space of a StorageFolder

GetUsedSpace ( StorageFolder storageFolder ) : Task

Get the used space of a StorageFolder

IsFileExists ( StorageFolder storageFolder, string fileName ) : Task

Checks if a file exists into the StorageFolder

IsFolderExists ( StorageFolder storageFolder, string folderName ) : Task

Checks if a folder exists into the StorageFolder

MoveFile ( StorageFolder source, StorageFolder destination, string fileName, string destinationFileName = null ) : Task

Move a file from a source StorageFolder to a destination StorageFolder

MoveFolder ( StorageFolder source, StorageFolder destination, string directoryName ) : Task

Move a StorageFolder and its content to a specified directory

ReadFile ( StorageFolder storageFolder, string fileName ) : Task

Reads a file from a specified StorageFolder

WriteFile ( StorageFolder storageFolder, string fileName, string fileContent, CreationCollisionOption creationOption ) : Task

Writes a string into a file located into a specified StorageFolder

Private Methods

Method Description
M4MFilePersistence ( ) : System

Method Details

CopyFile() public method

Copy a file from a source StorageFolder to a destination StorageFolder
public CopyFile ( StorageFolder source, StorageFolder destination, string fileName, string destinationFileName = null ) : Task
source Windows.Storage.StorageFolder the source folder containing the file
destination Windows.Storage.StorageFolder the destination folder where write the new file
fileName string the file name
destinationFileName string the destination file name (if different from the source)
return Task

CopyFolder() public method

Copy a StorageFolder and its content to a specified directory
public CopyFolder ( StorageFolder source, StorageFolder destination, string directoryName ) : Task
source Windows.Storage.StorageFolder the source folder
destination Windows.Storage.StorageFolder the destination folder where create the copy
directoryName string the copy directory
return Task

CreateDirectory() public method

Creates a directory into a specified StorageFolder by creating all missing StorageFolder
public CreateDirectory ( StorageFolder storageFolder, string path ) : Task
storageFolder StorageFolder the folder where the function has to check
path string the directory path
return Task

CreateFolder() public method

Creates a StorageFolder into a specified StorageFolder
public CreateFolder ( StorageFolder storageFolder, string folderName, CreationCollisionOption creationOption ) : Task
storageFolder StorageFolder the folder where the function has to check
folderName string the folder name
creationOption CreationCollisionOption the
return Task

DeleteFile() public method

Delete a file from a specified StorageFolder
public DeleteFile ( StorageFolder storageFolder, string fileName ) : Task
storageFolder StorageFolder the folder where the function has to check
fileName string the name of the file to delete
return Task

DeleteFolder() public method

Removes a StorageFolder into a specified StorageFolder
public DeleteFolder ( StorageFolder storageFolder, string folderName = null ) : Task
storageFolder StorageFolder the folder where the function has to check
folderName string the folder name
return Task

GetFreeSpace() public method

Get the free space of a StorageFolder
public GetFreeSpace ( StorageFolder storageFolder ) : Task
storageFolder StorageFolder the folder where the function has to check
return Task

GetUsedSpace() public method

Get the used space of a StorageFolder
public GetUsedSpace ( StorageFolder storageFolder ) : Task
storageFolder StorageFolder the folder where the function has to check
return Task

IsFileExists() public method

Checks if a file exists into the StorageFolder
public IsFileExists ( StorageFolder storageFolder, string fileName ) : Task
storageFolder StorageFolder the folder where the function has to check
fileName string the name of the file
return Task

IsFolderExists() public method

Checks if a folder exists into the StorageFolder
public IsFolderExists ( StorageFolder storageFolder, string folderName ) : Task
storageFolder StorageFolder the folder where the function has to check
folderName string the name of the folder
return Task

MoveFile() public method

Move a file from a source StorageFolder to a destination StorageFolder
public MoveFile ( StorageFolder source, StorageFolder destination, string fileName, string destinationFileName = null ) : Task
source StorageFolder the source folder containing the file
destination StorageFolder the destination folder where write the new file
fileName string the file name
destinationFileName string the destination file name (if different from the source)
return Task

MoveFolder() public method

Move a StorageFolder and its content to a specified directory
public MoveFolder ( StorageFolder source, StorageFolder destination, string directoryName ) : Task
source StorageFolder the source folder
destination StorageFolder the destination folder where create the copy
directoryName string the copy directory
return Task

ReadFile() public method

Reads a file from a specified StorageFolder
public ReadFile ( StorageFolder storageFolder, string fileName ) : Task
storageFolder StorageFolder the folder where the function has to check
fileName string the name of the file to read
return Task

WriteFile() public method

Writes a string into a file located into a specified StorageFolder
public WriteFile ( StorageFolder storageFolder, string fileName, string fileContent, CreationCollisionOption creationOption ) : Task
storageFolder StorageFolder the folder where the function has to check
fileName string the file name
fileContent string the file content
creationOption CreationCollisionOption the
return Task