Class LocalPackageArchiveDownloader
A package downloader for local archive packages.
[Obsolete("Use NuGet.Protocol.LocalPackageArchiveDownloader")]
public sealed class LocalPackageArchiveDownloader : IPackageDownloader, IDisposable
- Inheritance
-
LocalPackageArchiveDownloader
- Implements
- Inherited Members
Constructors
LocalPackageArchiveDownloader(string, string, PackageIdentity, ILogger)
Initializes a new LocalPackageArchiveDownloader class.
public LocalPackageArchiveDownloader(string source, string packageFilePath, PackageIdentity packageIdentity, ILogger logger)
Parameters
sourcestringA package source.
packageFilePathstringA source package archive file path.
packageIdentityPackageIdentityA package identity.
loggerILoggerA logger.
Exceptions
- ArgumentException
Thrown if
packageFilePathis eithernullor an empty string.- ArgumentNullException
Thrown if
packageIdentityis eithernullor an empty string.- ArgumentNullException
Thrown if
loggeris eithernullor an empty string.
Properties
ContentReader
Gets an asynchronous package content reader.
public IAsyncPackageContentReader ContentReader { get; }
Property Value
Exceptions
- ObjectDisposedException
Thrown if this object is disposed.
CoreReader
Gets an asynchronous package core reader.
public IAsyncPackageCoreReader CoreReader { get; }
Property Value
Exceptions
- ObjectDisposedException
Thrown if this object is disposed.
SignedPackageReader
public ISignedPackageReader SignedPackageReader { get; }
Property Value
Source
public string Source { get; }
Property Value
Methods
CopyNupkgFileToAsync(string, CancellationToken)
Asynchronously copies a .nupkg to a target file path.
public Task<bool> CopyNupkgFileToAsync(string destinationFilePath, CancellationToken cancellationToken)
Parameters
destinationFilePathstringThe destination file path.
cancellationTokenCancellationTokenA 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
destinationFilePathis eithernullor empty.- OperationCanceledException
Thrown if
cancellationTokenis cancelled.
Dispose()
Disposes of this instance.
public void Dispose()
GetPackageHashAsync(string, CancellationToken)
Asynchronously gets a package hash.
public Task<string> GetPackageHashAsync(string hashAlgorithm, CancellationToken cancellationToken)
Parameters
hashAlgorithmstringThe hash algorithm.
cancellationTokenCancellationTokenA 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
hashAlgorithmis eithernullor empty.- OperationCanceledException
Thrown if
cancellationTokenis cancelled.
SetExceptionHandler(Func<Exception, Task<bool>>)
Sets an exception handler for package downloads.
public 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
handleExceptionAsyncisnull.
SetThrottle(SemaphoreSlim)
Sets a throttle for package downloads.
public void SetThrottle(SemaphoreSlim throttle)
Parameters
throttleSemaphoreSlimA throttle. Can be
null.