Amazon.S3.Transfer.Internal.DownloadCommand.ByteRangeRemainingForDownloadAsync C# (CSharp) Method

ByteRangeRemainingForDownloadAsync() static private method

Returns the amount of bytes remaining that need to be pulled down from S3.
static private ByteRangeRemainingForDownloadAsync ( string filepath ) : Task
filepath string The fully qualified path of the file.
return Task
        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