Class PackageFolderReader
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
DirectoryInforoot directory of an extracted nupkg
PackageFolderReader(DirectoryInfo, IFrameworkNameProvider, IFrameworkCompatibilityProvider)
Package folder reader
public PackageFolderReader(DirectoryInfo folder, IFrameworkNameProvider frameworkProvider, IFrameworkCompatibilityProvider compatibilityProvider)
Parameters
folder
DirectoryInforoot directory of an extracted nupkg
frameworkProvider
IFrameworkNameProviderframework mappings
compatibilityProvider
IFrameworkCompatibilityProviderframework 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
stringroot directory of an extracted nupkg
frameworkProvider
IFrameworkNameProviderframework mappings
compatibilityProvider
IFrameworkCompatibilityProviderframework compatibility provider
Methods
CanVerifySignedPackages(SignedPackageVerifierSettings)
Indicates if the the ISignedPackageReader instance can verify signed packages.
public override bool CanVerifySignedPackages(SignedPackageVerifierSettings verifierSettings)
Parameters
verifierSettings
SignedPackageVerifierSettingsPackage verification settings. Include information about what is allowed.
Returns
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
stringThe destination folder path.
packageFiles
IEnumerable<string>The package files to copy.
extractFile
ExtractPackageFileDelegateA package file extraction delegate.
logger
ILoggerA logger.
token
CancellationTokenA 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
HashAlgorithmNametoken
CancellationToken
Returns
GetContentHash(CancellationToken, Func<string>)
Get contenthash for a package.
public override string GetContentHash(CancellationToken token, Func<string> GetUnsignedPackageHash = null)
Parameters
token
CancellationTokenGetUnsignedPackageHash
Func<string>
Returns
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
stringFolder 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
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
IsSignedAsync(CancellationToken)
Check if a package contains signing information.
public override Task<bool> IsSignedAsync(CancellationToken token)
Parameters
token
CancellationToken
Returns
ValidateIntegrityAsync(SignatureContent, CancellationToken)
Checks for the integrity of a package
public override Task ValidateIntegrityAsync(SignatureContent signatureContent, CancellationToken token)
Parameters
signatureContent
SignatureContentSignatureContent with expected hash value and hash algorithm used
token
CancellationToken