IUserDataStorage
Declaration
public interface Strawberry.Platform.IUserDataStorage
The storage service that reads and writes user data files in a platform-independent way.
Implements: Strawberry.Platform.IPlatformService
Methods
Open abstract
Opens a read-only stream to the specified file.
Stream Open(string path)
Parameters:
| Name | Type | Description |
|---|---|---|
path |
System.String |
Path to the file. |
Returns: A read-only stream to the specified file.
Exceptions:
System.IO.FileNotFoundException— Thrown if the file does not exist.
ReadAllBytes abstract
Reads all the bytes in the specified file.
byte[] ReadAllBytes(string path)
Parameters:
| Name | Type | Description |
|---|---|---|
path |
System.String |
Path to the file. |
Returns: Bytes in the specified file.
Exceptions:
System.IO.FileNotFoundException— Thrown if the file does not exist.
List abstract
Lists all files (not directories) in the specified directory. Non-recursive.
string[] List(string path)
Parameters:
| Name | Type | Description |
|---|---|---|
path |
System.String |
Path to the directory. |
Returns: An array of file paths in the specified directory.
Write abstract
Opens a stream for writing to the specified file, creating the file and any missing parent directories if necessary.
Stream Write(string path, bool append = false)
Parameters:
| Name | Type | Description |
|---|---|---|
path |
System.String |
Path to the file to write to. |
append |
System.Boolean = false |
If true, appends to the end of the file if it already exists; otherwise overwrites. |
Returns: A writable stream to the specified file.
Exists abstract
Checks if a file exists at the specified path. Returns false for directories.
bool Exists(string path)
Parameters:
| Name | Type | Description |
|---|---|---|
path |
System.String |
Path to the file. |
Returns: True if a file exists at the specified path, false otherwise.
Delete abstract
Deletes the file at the specified path. Does nothing if the file does not exist.
void Delete(string path)
Parameters:
| Name | Type | Description |
|---|---|---|
path |
System.String |
Path to the file to be deleted. |
CreateDirectory abstract
Creates a directory at the specified path. Does nothing if the directory already exists.
void CreateDirectory(string path)
Parameters:
| Name | Type | Description |
|---|---|---|
path |
System.String |
Path to the directory to be created. |