private static extern XSAPI_RESULT TitleStorageUploadBlob( IntPtr xboxLiveContext, IntPtr blobMetadataPointer, IntPtr blobBuffer, UInt32 cbBlobBuffer, TitleStorageETagMatchCondition etagMatchCondition, IntPtr preferredUploadBlockSize, XSAPI_UPLOAD_BLOB_COMPLETION_ROUTINE completionRoutine, IntPtr completionRoutineContext, Int64 taskGroupId);
internal static void SetEtagHeader( XboxLiveHttpRequest httpRequest, string eTag, TitleStorageETagMatchCondition eTagMatchCondition) { if (eTagMatchCondition != TitleStorageETagMatchCondition.NotUsed) { if (!string.IsNullOrEmpty(eTag)) { httpRequest.SetCustomHeader(ETagHeaderName, eTag); var headerToUse = eTagMatchCondition == TitleStorageETagMatchCondition.IfMatch ? IfMatchHeaderName : IfNoneHeaderName; httpRequest.SetCustomHeader(headerToUse, eTag); } } }
public Task <TitleStorageBlobMetadata> UploadBlobAsync(TitleStorageBlobMetadata blobMetadata, List <byte> blobBuffer, TitleStorageETagMatchCondition etagMatchCondition, uint preferredUploadBlockSize) { throw new NotImplementedException(); }
public Task <TitleStorageBlobResult> DownloadBlobAsync(TitleStorageBlobMetadata blobMetadata, List <byte> blobBuffer, TitleStorageETagMatchCondition etagMatchCondition, string selectQuery) { throw new NotImplementedException(); }
/// <summary> /// Upload blob data to title storage. /// </summary> /// <param name="blobMetadata">The blob metadata for the title storage blob to upload.</param> /// <param name="blobBuffer">The Blob content to be uploaded.</param> /// <param name="etagMatchCondition">The ETag match condition used to determine if the blob data should be uploaded.</param> /// <param name="preferredDownloadBlockSize">The preferred upload block size in bytes for binary blobs. </param> /// <returns>An instance of the <see cref="TitleStorageBlobMetadata"/> class with updated ETag and Length Properties.</returns> public Task <TitleStorageBlobMetadata> UploadBlobAsync(TitleStorageBlobMetadata blobMetadata, IList <byte> blobBuffer, TitleStorageETagMatchCondition etagMatchCondition, uint preferredUploadBlockSize) { var tcs = new TaskCompletionSource <TitleStorageBlobMetadata>(); Task.Run(() => { int contextKey; var context = XsapiCallbackContext <TitleStorageBlobMetadata, TitleStorageBlobMetadata> .CreateContext(blobMetadata, tcs, out contextKey); var buffer = Marshal.AllocHGlobal(blobBuffer.Count); Marshal.Copy(Enumerable.ToArray <byte>(blobBuffer), 0, buffer, blobBuffer.Count); context.PointersToFree = new List <IntPtr> { buffer }; var xsapiResult = TitleStorageUploadBlob( this.pCXboxLiveContext, blobMetadata.metadataPtr, buffer, (UInt32)blobBuffer.Count, etagMatchCondition, IntPtr.Zero, UploadBlobComplete, (IntPtr)contextKey, XboxLive.DefaultTaskGroupId); if (xsapiResult != XSAPI_RESULT.XSAPI_RESULT_OK) { tcs.SetException(new XboxException(xsapiResult)); } }); return(tcs.Task); }
/// <summary> /// Downloads blob data from title storage. /// </summary> /// <param name="blobMetadata">The blob metadata for the title storage blob to download.</param> /// <param name="etagMatchCondition">The ETag match condition used to determine if the blob should be downloaded.</param> /// <param name="selectQuery">A query string that contains a ConfigStorage filter string or JSONStorage json property name string to filter. (Optional)</param> /// <param name="preferredDownloadBlockSize">The preferred download block size in bytes for binary blobs. </param> /// <returns>An instance of the <see cref="TitleStorageBlobResult"/> containing the blob content and an updated /// <see cref="TitleStorageBlobMetadata"/> object.</returns> public Task <TitleStorageBlobResult> DownloadBlobAsync(TitleStorageBlobMetadata blobMetadata, TitleStorageETagMatchCondition etagMatchCondition, string selectQuery, uint preferredDownloadBlockSize) { var tcs = new TaskCompletionSource <TitleStorageBlobResult>(); Task.Run(() => { int contextKey; var context = XsapiCallbackContext <TitleStorageBlobMetadata, TitleStorageBlobResult> .CreateContext(blobMetadata, tcs, out contextKey); var buffer = Marshal.AllocHGlobal((int)blobMetadata.Length); var select = MarshalingHelpers.StringToHGlobalUtf8(selectQuery); var pPreferredDownloadBlockSize = GCHandle.Alloc(preferredDownloadBlockSize, GCHandleType.Pinned); context.PointersToFree = new List <IntPtr> { buffer, select }; context.GCHandlesToFree = new List <GCHandle> { pPreferredDownloadBlockSize }; var xsapiResult = TitleStorageDownloadBlob( this.pCXboxLiveContext, blobMetadata.metadataPtr, buffer, (UInt32)blobMetadata.Length, etagMatchCondition, select, GCHandle.ToIntPtr(pPreferredDownloadBlockSize), DownloadBlobComplete, (IntPtr)contextKey, XboxLive.DefaultTaskGroupId); if (xsapiResult != XSAPI_RESULT.XSAPI_RESULT_OK) { tcs.SetException(new XboxException(xsapiResult)); } }); return(tcs.Task); }
/// <summary> /// Downloads blob data from title storage. /// </summary> /// <param name="blobMetadata">The blob metadata for the title storage blob to download.</param> /// <param name="etagMatchCondition">The ETag match condition used to determine if the blob should be downloaded.</param> /// <param name="selectQuery">A query string that contains a ConfigStorage filter string or JSONStorage json property name string to filter. (Optional)</param> /// <returns>An instance of the <see cref="TitleStorageBlobResult"/> containing the blob content and an updated /// <see cref="TitleStorageBlobMetadata"/> object.</returns> public Task <TitleStorageBlobResult> DownloadBlobAsync(TitleStorageBlobMetadata blobMetadata, TitleStorageETagMatchCondition etagMatchCondition, string selectQuery) { return(DownloadBlobAsync(blobMetadata, etagMatchCondition, selectQuery, TitleStorageService.DefaultDownloadBlockSize)); }