Class StorageService<T>
- Namespace
- PlayEveryWare.EpicOnlineServices
Contains generic functionality common to data related service classes.
public abstract class StorageService<T> : EOSService, IDisposable where T : IFileTransferRequest
Type Parameters
T
The type of file transfer request that this data service makes use of.
- Inheritance
-
StorageService<T>
- Implements
- Derived
- Inherited Members
Fields
CurrentTransferHandle
Reference to an instance of a transfer request created within the EOS SDK.
protected T CurrentTransferHandle
Field Value
- T
CurrentTransferName
Stores the name of the currently transferring file.
protected string CurrentTransferName
Field Value
MAX_CHUNK_SIZE
Indicates the maximum number of bytes that can be read at a time during data transfer operations.
protected const uint MAX_CHUNK_SIZE = 4096
Field Value
_locallyCachedData
Stores the locally cached copy of the data that the service manages.
protected Dictionary<string, string> _locallyCachedData
Field Value
_transfersInProgress
Stores the file transfers that are currently in progress for the given data service.
protected Dictionary<string, EOSTransferInProgress> _transfersInProgress
Field Value
Methods
CancelCurrentTransfer()
Cancel the current transfer.
protected void CancelCurrentTransfer()
ClearCurrentTransfer()
Clears all the current transfers that the data service is managing.
protected void ClearCurrentTransfer()
FinishFileDownload(string, Result)
Called when a file has finished downloading.
protected void FinishFileDownload(string fileName, Result result)
Parameters
fileName
stringThe file that has finished downloading.
result
ResultThe result of the file download operation.
GetLocallyCachedData()
Retrieves the current local cache of data.
public Dictionary<string, string> GetLocallyCachedData()
Returns
IsTransferring()
Indicates whether or not there is a current transfer.
protected bool IsTransferring()
Returns
- bool
True if a file is transferring, false otherwise.
ReceiveData(string, ArraySegment<byte>, uint)
Called when receiving data.
protected StorageService<T>.FileTransferResult ReceiveData(string fileName, ArraySegment<byte> data, uint totalSize)
Parameters
fileName
stringName of the file for which data is being received.
data
ArraySegment<byte>The data being received for the file in question.
totalSize
uintThe total size of the file for which data is currently being received.
Returns
- StorageService<T>.FileTransferResult
A FileTransferResult indicating the current state of the request.
TryCancelTransferHandle()
Attempts to cancel the "current" transfer handle (needs to be a field member added to derived classes).
protected bool TryCancelTransferHandle()
Returns
- bool
True if the transfer handle is not null, and canceling it was successful, false otherwise.
Events
OnFileDownloaded
Event is triggered when a file is finished downloading.
public event EOSResultEventHandler OnFileDownloaded
Event Type
- EOSResultEventHandler