static async Task<ByteRange> ByteRangeRemainingForDownloadAsync(string filepath)
{
/*
* Initialize the ByteRange as the whole file.
* long.MaxValue works regardless of the size because
* S3 will stop sending bits if you specify beyond the
* size of the file anyways.
*/
ByteRange byteRange = new ByteRange(0, long.MaxValue);
var file = await PCLStorage.FileSystem.Current.GetFileFromPathAsync(filepath).ConfigureAwait(false);
if (file != null)
{
using (var stream = await file.OpenAsync(PCLStorage.FileAccess.Read).ConfigureAwait(false))
{
byteRange.Start = stream.Length;
}
}
return byteRange;
}
#endif