Class CloudStorageMethods
Extension methods for cloud data storage users
Namespace: Unity.MARS.Companion.CloudStorage
Syntax
public static class CloudStorageMethods : object
Methods
CancelAllRequests(IUsesCloudStorage)
Cancel all currently active requests
Declaration
public static void CancelAllRequests(this IUsesCloudStorage user)
Parameters
Type | Name | Description |
---|---|---|
IUsesCloudStorage | user | The functionality user |
CancelRequest(IUsesCloudStorage, RequestHandle)
Cancel a request with the given request handle
Declaration
public static void CancelRequest(this IUsesCloudStorage user, RequestHandle handle)
Parameters
Type | Name | Description |
---|---|---|
IUsesCloudStorage | user | The functionality user |
RequestHandle | handle | The handle to the request, which was returned by the method which initiated it |
CloudLoadAsync(IUsesCloudStorage, String, Action<Boolean, Int64, Byte[]>, ProgressCallback, Int32)
Load from the cloud asynchronously the byte array which was saved with a known key
Declaration
public static RequestHandle CloudLoadAsync(this IUsesCloudStorage user, string key, Action<bool, long, byte[]> callback, ProgressCallback progress = null, int timeout = null)
Parameters
Type | Name | Description |
---|---|---|
IUsesCloudStorage | user | The functionality user |
String | key | String that uniquely identifies this instance of the type |
Action<Boolean, Int64, Byte[]> | callback | A callback which returns whether the operation was successful, as well as the response code and byte array if it was. If the operation failed, the byte array will contain the error string |
ProgressCallback | progress | Called every frame while the request is in progress with two 0-1 values indicating upload and download progress, respectively |
Int32 | timeout | The timeout duration (in seconds) for this request |
Returns
Type | Description |
---|---|
RequestHandle | A handle to the request which can be used to cancel it |
CloudLoadAsync(IUsesCloudStorage, String, Action<Boolean, Int64, String>, ProgressCallback, Int32)
Load from the cloud asynchronously the data of an object which was saved with a known key
Declaration
public static RequestHandle CloudLoadAsync(this IUsesCloudStorage user, string key, Action<bool, long, string> callback, ProgressCallback progress = null, int timeout = null)
Parameters
Type | Name | Description |
---|---|---|
IUsesCloudStorage | user | The functionality user |
String | key | String that uniquely identifies this instance of the type. |
Action<Boolean, Int64, String> | callback | A callback which returns whether the operation was successful, as well as the response code and serialized string of the object if it was |
ProgressCallback | progress | Called every frame while the request is in progress with two 0-1 values indicating upload and download progress, respectively |
Int32 | timeout | The timeout duration (in seconds) for this request |
Returns
Type | Description |
---|---|
RequestHandle | A handle to the request which can be used to cancel it |
CloudLoadTextureAsync(IUsesCloudStorage, String, LoadTextureCallback, ProgressCallback, Int32)
Load a texture asynchronously from cloud storage
Declaration
public static RequestHandle CloudLoadTextureAsync(this IUsesCloudStorage user, string key, LoadTextureCallback callback, ProgressCallback progress = null, int timeout = null)
Parameters
Type | Name | Description |
---|---|---|
IUsesCloudStorage | user | The functionality user |
String | key | String that uniquely identifies this instance of the type. |
LoadTextureCallback | callback | A callback which returns whether the operation was successful, as well as the response payload if it was. If the operation failed, the byte array will contain the error string |
ProgressCallback | progress | Called every frame while the request is in progress with two 0-1 values indicating upload and download progress, respectively |
Int32 | timeout | The timeout duration (in seconds) for this request |
Returns
Type | Description |
---|---|
RequestHandle | A handle to the request which can be used to cancel it |
CloudSaveAsync(IUsesCloudStorage, String, Byte[], Action<Boolean, Int64, String>, ProgressCallback, Int32)
Save to the cloud asynchronously data in a byte array with a specified key
Declaration
public static RequestHandle CloudSaveAsync(this IUsesCloudStorage user, string key, byte[] bytes, Action<bool, long, string> callback = null, ProgressCallback progress = null, int timeout = null)
Parameters
Type | Name | Description |
---|---|---|
IUsesCloudStorage | user | The functionality user |
String | key | String that uniquely identifies this instance of the type. |
Byte[] | bytes | Bytes array of the object being saved |
Action<Boolean, Int64, String> | callback | A callback when the asynchronous call is done to show whether it was successful, with the response code and string |
ProgressCallback | progress | Called every frame while the request is in progress with two 0-1 values indicating upload and download progress, respectively |
Int32 | timeout | The timeout duration (in seconds) for this request |
Returns
Type | Description |
---|---|
RequestHandle | A handle to the request which can be used to cancel it |
CloudSaveAsync(IUsesCloudStorage, String, String, Action<Boolean, Int64, String>, ProgressCallback, Int32)
Save to the cloud asynchronously the data of an object with a specified key
Declaration
public static RequestHandle CloudSaveAsync(this IUsesCloudStorage user, string key, string serializedObject, Action<bool, long, string> callback = null, ProgressCallback progress = null, int timeout = null)
Parameters
Type | Name | Description |
---|---|---|
IUsesCloudStorage | user | The functionality user |
String | key | String that uniquely identifies this instance of the type. |
String | serializedObject | String serialization of the object being saved. |
Action<Boolean, Int64, String> | callback | A callback when the asynchronous call is done to show whether it was successful, with the response code and string |
ProgressCallback | progress | Called every frame while the request is in progress with two 0-1 values indicating upload and download progress, respectively |
Int32 | timeout | The timeout duration (in seconds) for this request |
Returns
Type | Description |
---|---|
RequestHandle | A handle to the request which can be used to cancel it |
GetProjectIdentifier(IUsesCloudStorage)
Get the current project identifier
Declaration
public static string GetProjectIdentifier(this IUsesCloudStorage user)
Parameters
Type | Name | Description |
---|---|---|
IUsesCloudStorage | user | The functionality user |
Returns
Type | Description |
---|---|
String | The current project identifier |
LoadLocalTextureAsync(IUsesCloudStorage, String, LoadTextureCallback, ProgressCallback, Int32)
Load a texture asynchronously from local storage
Declaration
public static RequestHandle LoadLocalTextureAsync(this IUsesCloudStorage user, string path, LoadTextureCallback callback, ProgressCallback progress = null, int timeout = null)
Parameters
Type | Name | Description |
---|---|---|
IUsesCloudStorage | user | The functionality user |
String | path | Path to the texture. |
LoadTextureCallback | callback | A callback which returns whether the operation was successful, as well as the response payload if it was. If the operation failed, the byte array will contain the error string |
ProgressCallback | progress | Called every frame while the request is in progress with two 0-1 values indicating upload and download progress, respectively |
Int32 | timeout | The timeout duration (in seconds) for this request |
Returns
Type | Description |
---|---|
RequestHandle | A handle to the request which can be used to cancel it |
SetProjectIdentifier(IUsesCloudStorage, String)
Set the current project identifier
Declaration
public static void SetProjectIdentifier(this IUsesCloudStorage user, string id)
Parameters
Type | Name | Description |
---|---|---|
IUsesCloudStorage | user | The functionality user |
String | id | The project identifier to set |