public GetUploadChunkRequests ( IEnumerable options = null ) : IEnumerable |
||
options | IEnumerable | Options to be applied to each request. |
return | IEnumerable |
public virtual IEnumerable<UploadChunkRequest> GetUploadChunkRequests(IEnumerable<Option> options = null)
{
foreach (var range in this.rangesRemaining)
{
var currentRangeBegins = range.Item1;
while (currentRangeBegins <= range.Item2)
{
var nextChunkSize = NextChunkSize(currentRangeBegins, range.Item2);
var uploadRequest = new UploadChunkRequest(
this.Session.UploadUrl,
this.client,
options,
currentRangeBegins,
currentRangeBegins + nextChunkSize - 1,
this.totalUploadLength);
yield return uploadRequest;
currentRangeBegins += nextChunkSize;
}
}
}
/// <inheritdoc/> public async Task <long> GetUploadStatusAsync() { if (_uploadProvider != null && IsUploadCompleted == false) { if (Provider.AuthenticationProvider is MsaAuthenticationProvider) { var remainingRequests = _uploadProvider.GetUploadChunkRequests(); var firstChunck = remainingRequests.First <OneDriveSdk.UploadChunkRequest>(); var status = await _uploadProvider.UpdateSessionStatusAsync(); return(firstChunck.RangeBegin); } } // no more data return(0); }