public void Set(ReadFileOptions other)
 {
     if (other != null)
     {
         m_ApiVersion                   = TitleStorageInterface.ReadfileoptionsApiLatest;
         LocalUserId                    = other.LocalUserId;
         Filename                       = other.Filename;
         ReadChunkLengthBytes           = other.ReadChunkLengthBytes;
         m_ReadFileDataCallback         = other.ReadFileDataCallback != null ? ReadFileDataCallback : null;
         m_FileTransferProgressCallback = other.FileTransferProgressCallback != null ? FileTransferProgressCallback : null;
     }
 }
Exemplo n.º 2
0
        public void Set(ReadFileOptions other)
        {
            if (other != null)
            {
                m_ApiVersion           = TitleStorageInterface.ReadfileoptionsApiLatest;
                LocalUserId            = other.LocalUserId;
                Filename               = other.Filename;
                ReadChunkLengthBytes   = other.ReadChunkLengthBytes;
                m_ReadFileDataCallback = other.ReadFileDataCallback != null?System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(ReadFileDataCallback) : System.IntPtr.Zero;

                m_FileTransferProgressCallback = other.FileTransferProgressCallback != null?System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(FileTransferProgressCallback) : System.IntPtr.Zero;
            }
        }
        /// <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);
        }