public DownloadConnection(DownloadRequest request, DownloadRange range, Stream stream, long startPosition) { if (startPosition < -1) { throw new ArgumentException("Negative download length is invalid.", nameof(startPosition)); } Request = request; Range = range; Stream = stream; TotalDownloaded = startPosition >= 0 ? startPosition : (Stream.CanSeek ? Stream.Length : 0); ShrinkStream(TotalDownloaded, CancellationToken.None).Wait(); if (Range.HasLength && (TotalWritten > Range.Length)) { throw new ArgumentException("Invalid stream specified. Size is bigger than the requested portion.", nameof(stream)); } }
public StreamDownload(DownloadRequest request, StreamPartition partition) { Request = request; Partition = partition; }
public void AssignConnection(DownloadRequest request) { }
public DownloadConnection(DownloadRequest request, DownloadRange range, Stream stream) : this(request, range, stream, -1) { }
public DownloadConnection(DownloadRequest request, Stream stream, long startPosition) : this(request, DownloadRange.Empty, stream, startPosition) { }
public DownloadConnection(DownloadRequest request, Stream stream) : this(request, stream, -1) { }