internal static void OnReadFileComplete(IntPtr address) { OnReadFileCompleteCallback callback = null; ReadFileCallbackInfo callbackInfo = null; if (Helper.TryGetAndRemoveCallback <OnReadFileCompleteCallback, ReadFileCallbackInfoInternal, ReadFileCallbackInfo>(address, out callback, out callbackInfo)) { callback(callbackInfo); } }
/// <summary> /// Retrieve the contents of a specific file, potentially downloading the contents if we do not have a local copy, from the cloud. This request will occur asynchronously, potentially over /// multiple frames. All callbacks for this function will come from the same thread that the SDK is ticked from. If specified, the FileTransferProgressCallback will always be called at /// least once if the request is started successfully. /// <seealso cref="PlayerDataStorageFileTransferRequest.Release" /> /// </summary> /// <param name="readOptions">Object containing properties related to which user is opening the file, what the file's name is, and related mechanisms for copying the data</param> /// <param name="clientData">Optional pointer to help clients track this request, that is returned in associated callbacks</param> /// <param name="completionCallback">This function is called when the read operation completes</param> /// <returns> /// A valid Player Data Storage File Request handle if successful, or NULL otherwise. Data contained in the completion callback will have more detailed information about issues with the request in failure cases. This handle must be released when it is no longer needed /// </returns> public PlayerDataStorageFileTransferRequest ReadFile(ReadFileOptions readOptions, object clientData, OnReadFileCompleteCallback completionCallback) { System.IntPtr readOptionsAddress = new System.IntPtr(); Helper.TryMarshalSet <ReadFileOptionsInternal, ReadFileOptions>(ref readOptionsAddress, readOptions); var clientDataAddress = System.IntPtr.Zero; var completionCallbackInternal = new OnReadFileCompleteCallbackInternal(OnReadFileCompleteCallbackInternalImplementation); Helper.AddCallback(ref clientDataAddress, clientData, completionCallback, completionCallbackInternal, readOptions.ReadFileDataCallback, ReadFileOptionsInternal.ReadFileDataCallback, readOptions.FileTransferProgressCallback, ReadFileOptionsInternal.FileTransferProgressCallback); var funcResult = EOS_PlayerDataStorage_ReadFile(InnerHandle, readOptionsAddress, clientDataAddress, completionCallbackInternal); Helper.TryMarshalDispose(ref readOptionsAddress); PlayerDataStorageFileTransferRequest funcResultReturn; Helper.TryMarshalGet(funcResult, out funcResultReturn); return(funcResultReturn); }
/// <summary> /// Retrieve the contents of a specific file, potentially downloading the contents if we do not have a local copy, from the cloud. This request will occur asynchronously, potentially over /// multiple frames. All callbacks for this function will come from the same thread that the SDK is ticked from. If specified, the FileTransferProgressCallback will always be called at /// least once if the request is started successfully. /// <seealso cref="PlayerDataStorageFileTransferRequest.Release" /> /// </summary> /// <param name="readOptions">Object containing properties related to which user is opening the file, what the file's name is, and related mechanisms for copying the data</param> /// <param name="clientData">Optional pointer to help clients track this request, that is returned in associated callbacks</param> /// <param name="completionCallback">This function is called when the read operation completes</param> /// <returns> /// A valid Player Data Storage File Request handle if successful, or NULL otherwise. Data contained in the completion callback will have more detailed information about issues with the request in failure cases. This handle must be released when it is no longer needed /// </returns> public PlayerDataStorageFileTransferRequest ReadFile(ReadFileOptions readOptions, object clientData, OnReadFileCompleteCallback completionCallback) { var readOptionsInternal = Helper.CopyProperties <ReadFileOptionsInternal>(readOptions); var completionCallbackInternal = new OnReadFileCompleteCallbackInternal(OnReadFileComplete); var clientDataAddress = IntPtr.Zero; Helper.AddCallback(ref clientDataAddress, clientData, completionCallback, completionCallbackInternal, readOptions.ReadFileDataCallback, readOptionsInternal.ReadFileDataCallback, readOptions.FileTransferProgressCallback, readOptionsInternal.FileTransferProgressCallback); var funcResult = EOS_PlayerDataStorage_ReadFile(InnerHandle, ref readOptionsInternal, clientDataAddress, completionCallbackInternal); Helper.TryMarshalDispose(ref readOptionsInternal); var funcResultReturn = Helper.GetDefault <PlayerDataStorageFileTransferRequest>(); Helper.TryMarshalGet(funcResult, out funcResultReturn); return(funcResultReturn); }