Table of Contents

Class PackageFolderReader

Namespace
NuGet.Packaging
Assembly
Chocolatey.NuGet.Packaging.dll

Reads an unzipped nupkg folder.

public class PackageFolderReader : PackageReaderBase, IPackageCoreReader, IPackageContentReader, IAsyncPackageCoreReader, IAsyncPackageContentReader, ISignedPackageReader, IDisposable
Inheritance
PackageFolderReader
Implements
Inherited Members
Extension Methods

Constructors

PackageFolderReader(DirectoryInfo)

Package folder reader

public PackageFolderReader(DirectoryInfo folder)

Parameters

folder DirectoryInfo

root directory of an extracted nupkg

PackageFolderReader(DirectoryInfo, IFrameworkNameProvider, IFrameworkCompatibilityProvider)

Package folder reader

public PackageFolderReader(DirectoryInfo folder, IFrameworkNameProvider frameworkProvider, IFrameworkCompatibilityProvider compatibilityProvider)

Parameters

folder DirectoryInfo

root directory of an extracted nupkg

frameworkProvider IFrameworkNameProvider

framework mappings

compatibilityProvider IFrameworkCompatibilityProvider

framework compatibility provider

PackageFolderReader(string)

Package folder reader

public PackageFolderReader(string folderPath)

Parameters

folderPath string

PackageFolderReader(string, IFrameworkNameProvider, IFrameworkCompatibilityProvider)

Package folder reader

public PackageFolderReader(string folderPath, IFrameworkNameProvider frameworkProvider, IFrameworkCompatibilityProvider compatibilityProvider)

Parameters

folderPath string

root directory of an extracted nupkg

frameworkProvider IFrameworkNameProvider

framework mappings

compatibilityProvider IFrameworkCompatibilityProvider

framework compatibility provider

Methods

CanVerifySignedPackages(SignedPackageVerifierSettings)

Indicates if the the ISignedPackageReader instance can verify signed packages.

public override bool CanVerifySignedPackages(SignedPackageVerifierSettings verifierSettings)

Parameters

verifierSettings SignedPackageVerifierSettings

Package verification settings. Include information about what is allowed.

Returns

bool

Exceptions

SignatureException

if the ISignedPackageReader does not support signed packages

CopyFiles(string, IEnumerable<string>, ExtractPackageFileDelegate, ILogger, CancellationToken)

Copies files from a package to a new location.

public override IEnumerable<string> CopyFiles(string destination, IEnumerable<string> packageFiles, ExtractPackageFileDelegate extractFile, ILogger logger, CancellationToken token)

Parameters

destination string

The destination folder path.

packageFiles IEnumerable<string>

The package files to copy.

extractFile ExtractPackageFileDelegate

A package file extraction delegate.

logger ILogger

A logger.

token CancellationToken

A cancellation token.

Returns

IEnumerable<string>

An enumerable of paths of files copied to the destination.

Dispose(bool)

protected override void Dispose(bool disposing)

Parameters

disposing bool

GetArchiveHashAsync(HashAlgorithmName, CancellationToken)

Gets the hash of an archive to be embedded in the package signature.

public override Task<byte[]> GetArchiveHashAsync(HashAlgorithmName hashAlgorithm, CancellationToken token)

Parameters

hashAlgorithm HashAlgorithmName
token CancellationToken

Returns

Task<byte[]>

GetContentHash(CancellationToken, Func<string>)

Get contenthash for a package.

public override string GetContentHash(CancellationToken token, Func<string> GetUnsignedPackageHash = null)

Parameters

token CancellationToken
GetUnsignedPackageHash Func<string>

Returns

string

GetFiles()

Gets all files in the package.

public override IEnumerable<string> GetFiles()

Returns

IEnumerable<string>

An enumerable of files in the package.

GetFiles(string)

Gets files in a folder in the package.

public override IEnumerable<string> GetFiles(string folder)

Parameters

folder string

Folder path

Returns

IEnumerable<string>

An enumerable of files under specified folder.

GetNuspecFile()

Gets a nuspec file path.

public override string GetNuspecFile()

Returns

string

The nuspec file path.

GetPrimarySignatureAsync(CancellationToken)

Get package signature.

public override Task<PrimarySignature> GetPrimarySignatureAsync(CancellationToken token)

Parameters

token CancellationToken

Returns

Task<PrimarySignature>

Remarks

Returns a null if the package is unsigned.

GetStream(string)

Opens a local file in read only mode.

public override Stream GetStream(string path)

Parameters

path string

Returns

Stream

IsSignedAsync(CancellationToken)

Check if a package contains signing information.

public override Task<bool> IsSignedAsync(CancellationToken token)

Parameters

token CancellationToken

Returns

Task<bool>

True if the package is signed.

ValidateIntegrityAsync(SignatureContent, CancellationToken)

Checks for the integrity of a package

public override Task ValidateIntegrityAsync(SignatureContent signatureContent, CancellationToken token)

Parameters

signatureContent SignatureContent

SignatureContent with expected hash value and hash algorithm used

token CancellationToken

Returns

Task