Пример #1
0
 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));
     }
 }
Пример #2
0
 public StreamDownload(DownloadRequest request, StreamPartition partition)
 {
     Request   = request;
     Partition = partition;
 }
Пример #3
0
 public void AssignConnection(DownloadRequest request)
 {
 }
Пример #4
0
 public DownloadConnection(DownloadRequest request, DownloadRange range, Stream stream)
     : this(request, range, stream, -1)
 {
 }
Пример #5
0
 public DownloadConnection(DownloadRequest request, Stream stream, long startPosition)
     : this(request, DownloadRange.Empty, stream, startPosition)
 {
 }
Пример #6
0
 public DownloadConnection(DownloadRequest request, Stream stream) : this(request, stream, -1)
 {
 }