Zero Install .NET API 2.20.0
ZeroInstall.Store.Manifests.Manifest Class Reference

A manifest lists every directory, file and symlink in a directory and contains a digest of each file's content. More...

Inheritance diagram for ZeroInstall.Store.Manifests.Manifest:

Public Member Functions

 Manifest (ManifestFormat format)
 Creates a new manifest. More...
 
bool TryGetValue (string key, [NotNullWhen(true)] out IDictionary< string, ManifestElement >? value)
 
bool ContainsKey (string key)
 
SortedDictionary< string, ManifestElementAdd (string key)
 Returns an existing directory or adds a new directory (and any missing parents) to the manifest. More...
 
bool Remove (string key)
 Removes a directory and all its subdirectories from the manifest. More...
 
bool Rename (string key, string newKey)
 Moves a directory and all its subdirectories to a new path. More...
 
Manifest WithOffset (TimeSpan offset)
 Creates a copy of the manifest with all timestamps shifted by the specified offset and rounded up to an even number of seconds.
 
override string ToString ()
 The directories and ManifestElements comprising the manifest in line format. Safe for parsing.
 
void Save (string path)
 Writes the manifest to a file. More...
 
string CalculateDigest ()
 Calculates the digest for the manifest in-memory. More...
 

Static Public Member Functions

static bool RejectPath (string path)
 Determines whether a file path may not be used in implementations.
 
static Manifest Load (Stream stream, ManifestFormat format)
 Parses a manifest file stream. More...
 
static Manifest Load (string path, ManifestFormat format)
 Parses a manifest file. More...
 

Static Public Attributes

const string ManifestFile = ".manifest"
 The well-known file name used to store manifest files in directories.
 

Properties

ManifestFormat Format [get]
 The format of the manifest (which file details are listed, which digest method is used, etc.).
 
long TotalSize [get]
 The combined size of all files listed in the manifest in bytes.
 
IDictionary< string, ManifestElementthis[string key] [get]
 Gets or adds directory in the manifest. More...
 
int Count [get]
 
IEnumerable< string > Keys [get]
 
IEnumerable< IDictionary< string, ManifestElement > > Values [get]
 
IEnumerable< string > Lines [get]
 The directories and ManifestElements comprising the manifest in line format.
 

Detailed Description

A manifest lists every directory, file and symlink in a directory and contains a digest of each file's content.

See also: https://docs.0install.net/specifications/manifest/

Constructor & Destructor Documentation

◆ Manifest()

ZeroInstall.Store.Manifests.Manifest.Manifest ( ManifestFormat  format)
inline

Creates a new manifest.

Parameters
formatThe format used to calculate digests, also specifies the algorithm used in ManifestElement.Digest.

Member Function Documentation

◆ Add()

SortedDictionary< string, ManifestElement > ZeroInstall.Store.Manifests.Manifest.Add ( string  key)
inline

Returns an existing directory or adds a new directory (and any missing parents) to the manifest.

Parameters
keyThe Unix path of the directory relative to the implementation root.
Returns
A dictionary of elements inside the directory.

◆ CalculateDigest()

string ZeroInstall.Store.Manifests.Manifest.CalculateDigest ( )

Calculates the digest for the manifest in-memory.

Returns
The manifest digest.

◆ Load() [1/2]

static Manifest ZeroInstall.Store.Manifests.Manifest.Load ( Stream  stream,
ManifestFormat  format 
)
inlinestatic

Parses a manifest file stream.

Parameters
streamThe stream to load from.
formatThe format of the file and the format of the created Manifest. Comprises the digest method used and the file's format.
Returns
The parsed content of the file.
Exceptions
FormatExceptionThe file specified is not a valid manifest file.

◆ Load() [2/2]

static Manifest ZeroInstall.Store.Manifests.Manifest.Load ( string  path,
ManifestFormat  format 
)
inlinestatic

Parses a manifest file.

Parameters
pathThe path of the file to load.
formatThe format of the file and the format of the created Manifest. Comprises the digest method used and the file's format.
Returns
The parsed content of the file.
Exceptions
FormatExceptionThe file specified is not a valid manifest file.
IOExceptionThe manifest file could not be read.

◆ Remove()

bool ZeroInstall.Store.Manifests.Manifest.Remove ( string  key)

Removes a directory and all its subdirectories from the manifest.

Parameters
keyThe Unix path of the directory relative to the implementation root.
Returns
true if the directory is successfully found and removed; false otherwise.

◆ Rename()

bool ZeroInstall.Store.Manifests.Manifest.Rename ( string  key,
string  newKey 
)
inline

Moves a directory and all its subdirectories to a new path.

Parameters
keyThe Unix path of the directory relative to the implementation root.
newKeyThe new Unix path of the directory relative to the implementation root.
Returns
true if the directory is successfully found and renamed; false otherwise.

◆ Save()

void ZeroInstall.Store.Manifests.Manifest.Save ( string  path)

Writes the manifest to a file.

Parameters
pathThe path of the file to write.
Returns
The manifest digest.
Exceptions
IOExceptionA problem occurred while writing the file.
UnauthorizedAccessExceptionWrite access to the file is not permitted.

Property Documentation

◆ this[string key]

IDictionary<string, ManifestElement> ZeroInstall.Store.Manifests.Manifest.this[string key]
get

Gets or adds directory in the manifest.

Parameters
keyThe Unix path of the directory relative to the implementation root. string.Empty for root.

The documentation for this class was generated from the following file: