Interface IPackageDownloader
A package downloader.
public interface IPackageDownloader : IDisposable
- Inherited Members
Properties
ContentReader
Gets an asynchronous package content reader.
IAsyncPackageContentReader ContentReader { get; }
Property Value
Exceptions
- ObjectDisposedException
Thrown if this object is disposed.
CoreReader
Gets an asynchronous package core reader.
IAsyncPackageCoreReader CoreReader { get; }
Property Value
Exceptions
- ObjectDisposedException
Thrown if this object is disposed.
SignedPackageReader
ISignedPackageReader SignedPackageReader { get; }
Property Value
Source
string Source { get; }
Property Value
Methods
CopyNupkgFileToAsync(string, CancellationToken)
Asynchronously copies a .nupkg to a target file path.
Task<bool> CopyNupkgFileToAsync(string destinationFilePath, CancellationToken cancellationToken)
Parameters
destinationFilePath
stringThe destination file path.
cancellationToken
CancellationTokenA cancellation token.
Returns
- Task<bool>
A task that represents the asynchronous operation. The task result (Result) returns a bool indicating whether or not the copy was successful.
Exceptions
- ObjectDisposedException
Thrown if this object is disposed.
- ArgumentException
Thrown if
destinationFilePath
is eithernull
or empty.- OperationCanceledException
Thrown if
cancellationToken
is cancelled.
GetPackageHashAsync(string, CancellationToken)
Asynchronously gets a package hash.
Task<string> GetPackageHashAsync(string hashAlgorithm, CancellationToken cancellationToken)
Parameters
hashAlgorithm
stringThe hash algorithm.
cancellationToken
CancellationTokenA cancellation token.
Returns
- Task<string>
A task that represents the asynchronous operation. The task result (Result) returns a string representing the package hash.
Exceptions
- ObjectDisposedException
Thrown if this object is disposed.
- ArgumentException
Thrown if
hashAlgorithm
is eithernull
or empty.- OperationCanceledException
Thrown if
cancellationToken
is cancelled.
SetExceptionHandler(Func<Exception, Task<bool>>)
Sets an exception handler for package downloads.
void SetExceptionHandler(Func<Exception, Task<bool>> handleExceptionAsync)
Parameters
Remarks
The exception handler returns a task that represents the asynchronous operation.
The task result (Result) returns a bool
indicating whether or not the exception was handled. To handle an exception and stop its
propagation, the task should return true
. Otherwise, the exception will be rethrown.
Exceptions
- ArgumentNullException
Thrown if
handleExceptionAsync
isnull
.
SetThrottle(SemaphoreSlim)
Sets a throttle for package downloads.
void SetThrottle(SemaphoreSlim throttle)
Parameters
throttle
SemaphoreSlimA throttle. Can be
null
.