Interface ISaveReadable
Save opened for reading.
Namespace: Unity.PlatformToolkit
Assembly: Unity.PlatformToolkit.dll
Syntax
public interface ISaveReadable : IAsyncDisposable, IDisposable
Remarks
A save must be disposed before it can be opened again. If ISaveReadable is opened, it must be disposed before calling OpenSaveReadable(string) or OpenSaveWritable(string) with the same save name.
Methods
ContainsFile(string)
Checks if a file with the given name exists in the save.
Declaration
Task<bool> ContainsFile(string name)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | The name of the file. |
Returns
| Type | Description |
|---|---|
| Task<bool> | Task containing a boolean indicating whether the file exists (true) or not (false). |
Exceptions
| Type | Condition |
|---|---|
| IOException | There was an error reading the data. |
| InvalidAccountException | IAccount is signed out. |
| InvalidSystemException | ISavingSystem is invalid. |
See Also
EnumerateFiles()
Enumerate files within the save.
Declaration
Task<IReadOnlyList<string>> EnumerateFiles()
Returns
| Type | Description |
|---|---|
| Task<IReadOnlyList<string>> | Task containing an IReadOnlyList of file name strings. |
Exceptions
| Type | Condition |
|---|---|
| IOException | There was an error reading the data. |
| InvalidAccountException | IAccount is signed out. |
| InvalidSystemException | ISavingSystem is invalid. |
See Also
ReadFile(string)
Returns data read from the given file.
Declaration
Task<byte[]> ReadFile(string name)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | The name of the file to load |
Returns
| Type | Description |
|---|---|
| Task<byte[]> | Task containing a non-null array of data read from the file. |
Exceptions
| Type | Condition |
|---|---|
| FileNotFoundException | Data for name is not found. |
| CorruptedSaveException | The save has become corrupted, an empty save from a failed commit is considered corrupted. |
| IOException | There was an error reading the data. |
| InvalidAccountException | IAccount is signed out. |
| InvalidSystemException | ISavingSystem is invalid. |