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