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
source
stringA package source.
packageFilePath
stringA source package archive file path.
packageIdentity
PackageIdentityA package identity.
logger
ILoggerA logger.
Exceptions
- ArgumentException
Thrown if
packageFilePath
is eithernull
or an empty string.- ArgumentNullException
Thrown if
packageIdentity
is eithernull
or an empty string.- ArgumentNullException
Thrown if
logger
is eithernull
or 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
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.
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
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.
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
handleExceptionAsync
isnull
.
SetThrottle(SemaphoreSlim)
Sets a throttle for package downloads.
public void SetThrottle(SemaphoreSlim throttle)
Parameters
throttle
SemaphoreSlimA throttle. Can be
null
.