Class ManifestFormat
- Namespace
- ZeroInstall.Store.Manifests
- Assembly
- ZeroInstall.Store.dll
Abstract class to encapsulate the differences between the different formats that can be used to save and load Manifests.
[Serializable]
public abstract class ManifestFormat
- Inheritance
-
ManifestFormat
- Inherited Members
Remarks
Comprises: The digest method used and the format specification used to serialize and deserialize manifests.
Fields
All
All currently supported ManifestFormats listed from best (safest) to worst.
public static readonly ManifestFormat[] All
Field Value
Properties
Prefix
The prefix used to identify the format (e.g. "sha256").
public abstract string Prefix { get; }
Property Value
Separator
The separator placed between the Prefix and the actual digest.
public virtual string Separator { get; }
Property Value
Sha1New
The ManifestFormat to use for Sha1New.
public static ManifestFormat Sha1New { get; }
Property Value
Sha256
The ManifestFormat to use for Sha256.
public static ManifestFormat Sha256 { get; }
Property Value
Sha256New
The ManifestFormat to use for Sha256New.
public static ManifestFormat Sha256New { get; }
Property Value
Methods
DigestContent(Stream)
Generates the digest of a implementation file as used within the manifest file.
public string DigestContent(Stream stream)
Parameters
stream
StreamThe content of the implementation file.
Returns
- string
A string representation of the digest.
DigestManifest(Manifest)
Generates the digest of a manifest.
public string DigestManifest(Manifest manifest)
Parameters
manifest
Manifest
Returns
- string
A string representation of the digest.
FromPrefix(string)
Selects the correct ManifestFormat based on the digest prefix.
public static ManifestFormat FromPrefix(string id)
Parameters
id
stringThe digest id to extract the prefix from or only the prefix.
Returns
Exceptions
- NotSupportedException
id
does not have a supported algorithm prefix.
GetHashAlgorithm()
Retrieves a new instance of the hashing algorithm used for generating digests.
protected abstract HashAlgorithm GetHashAlgorithm()
Returns
SerializeContentDigest(byte[])
Serializes a hash as digest of an implementation file as used within the manifest file.
protected virtual string SerializeContentDigest(byte[] hash)
Parameters
hash
byte[]
Returns
SerializeManifestDigest(byte[])
Serializes a hash as a digest of a manifest file as used for the implementation directory name.
protected virtual string SerializeManifestDigest(byte[] hash)
Parameters
hash
byte[]
Returns
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
- string
A string that represents the current object.