Zero Install .NET API 2.20.0
ZeroInstall.Model.Archive Class Reference

Retrieves an implementation by downloading and extracting an archive. More...

Inheritance diagram for ZeroInstall.Model.Archive:
ZeroInstall.Model.DownloadRetrievalMethod ZeroInstall.Model.RetrievalMethod ZeroInstall.Model.IRecipeStep ZeroInstall.Model.FeedElement NanoByte.Common.ICloneable< RetrievalMethod > NanoByte.Common.ICloneable< IRecipeStep > ZeroInstall.Model.XmlUnknown

Public Member Functions

override void Normalize (FeedUri? feedUri=null)
 Converts legacy elements, sets default values, etc.. More...
 
override string ToString ()
 Returns the archive in the form "Location (MimeType, Size + StartOffset, Extract) => Destination". Not safe for parsing!
 
override RetrievalMethod Clone ()
 Creates a deep copy of this Archive instance. More...
 
bool Equals (Archive? other)
 
override bool Equals (object? obj)
 
override int GetHashCode ()
 
- Public Member Functions inherited from ZeroInstall.Model.DownloadRetrievalMethod
override void Normalize (FeedUri? feedUri=null)
 Converts legacy elements, sets default values, etc.. More...
 
override int GetHashCode ()
 
- Public Member Functions inherited from ZeroInstall.Model.FeedElement
override int GetHashCode ()
 
- Public Member Functions inherited from ZeroInstall.Model.XmlUnknown
string ToShortXml ()
 Returns a shortened XML representation (with attributes but without child elements). More...
 
override int GetHashCode ()
 
- Public Member Functions inherited from NanoByte.Common.ICloneable< RetrievalMethod >
RetrievalMethod Clone ()
 
- Public Member Functions inherited from NanoByte.Common.ICloneable< IRecipeStep >
IRecipeStep Clone ()
 

Static Public Member Functions

static string GuessMimeType (string fileName)
 Tries to guess the MIME type of an archive file by looking at its file extension. More...
 
static string GetFileExtension (string mimeType)
 Gets the default file extension for a particular archive MIME type. More...
 

Static Public Attributes

const string MimeTypeZip = "application/zip"
 A MimeType value for archives.
 
const string MimeTypeTar = "application/x-tar"
 
const string MimeTypeTarGzip = "application/x-compressed-tar"
 
const string MimeTypeTarBzip = "application/x-bzip-compressed-tar"
 
const string MimeTypeTarLzma = "application/x-lzma-compressed-tar"
 
const string MimeTypeTarLzip = "application/x-lzip-compressed-tar"
 
const string MimeTypeTarXz = "application/x-xz-compressed-tar"
 
const string MimeTypeTarZstandard = "application/x-zstd-compressed-tar"
 
const string MimeTypeRubyGem = "application/x-ruby-gem"
 
const string MimeType7Z = "application/x-7z-compressed"
 
const string MimeTypeRar = "application/vnd.rar"
 
const string MimeTypeCab = "application/vnd.ms-cab-compressed"
 
const string MimeTypeMsi = "application/x-msi"
 
const string MimeTypeDeb = "application/x-deb"
 
const string MimeTypeRpm = "application/x-rpm"
 
const string MimeTypeDmg = "application/x-apple-diskimage"
 
static readonly IEnumerable< string > KnownMimeTypes = new[] {MimeTypeZip, MimeTypeTar, MimeTypeTarGzip, MimeTypeTarBzip, MimeTypeTarLzma, MimeTypeTarLzip, MimeTypeTarXz, MimeTypeTarZstandard, MimeTypeRubyGem, MimeType7Z, MimeTypeRar, MimeTypeCab, MimeTypeMsi, MimeTypeDeb, MimeTypeRpm, MimeTypeDmg}
 All known MimeType values for archives.
 

Properties

string? MimeType [getset]
 The type of the archive as a MIME type. If missing, the type is guessed from the extension on the DownloadRetrievalMethod.Href attribute. This value is case-insensitive.
 
int StartOffset [getset]
 The number of bytes at the beginning of the file which should be ignored. The value in DownloadRetrievalMethod.Size does not include the skipped bytes. More...
 
override long DownloadSize [get]
 
string? Extract [getset]
 The directory to extract into relative to the implementation root as a Unix-style path; null or string.Empty for entire archive.
 
string? Destination [getset]
 The subdirectory below the implementation directory to extract the archive into as a Unix-style path; null or string.Empty for top-level.
 
- Properties inherited from ZeroInstall.Model.DownloadRetrievalMethod
Uri Href = default! [getset]
 The URL to download the file from. Relative URLs are only allowed in local feed files.
 
string? HrefString [getset]
 Used for XML serialization and PropertyGrid. More...
 
long Size [getset]
 The size of the file in bytes. The file must have the given size or it will be rejected.
 
virtual long DownloadSize [get]
 The effective size of the file on the server.
 
- Properties inherited from ZeroInstall.Model.FeedElement
VersionRangeIfZeroInstallVersion [getset]
 Only process this element if the current Zero Install version matches the range.
 
string??? IfZeroInstallVersionString [getset]
 Used for XML serialization. More...
 

Additional Inherited Members

- Public Attributes inherited from ZeroInstall.Model.XmlUnknown
XmlAttribute?[] UnknownAttributes
 Contains any unknown additional XML attributes.
 
XmlElement?[] UnknownElements
 Contains any unknown additional XML elements.
 
- Protected Member Functions inherited from ZeroInstall.Model.DownloadRetrievalMethod
bool Equals (DownloadRetrievalMethod? other)
 
- Protected Member Functions inherited from ZeroInstall.Model.FeedElement
bool Equals (FeedElement? other)
 
- Protected Member Functions inherited from ZeroInstall.Model.XmlUnknown
void EnsureAttribute (object? value, string attributeName)
 Ensures that a value deserialized from an XML attribute is set (not null). More...
 
void EnsureAttributeSafeID (string? value, string attributeName)
 Ensures that a value deserialized from an XML attribute is set (not null) and only contains alphanumeric characters, spaces ( ), dots (.), underscores (_), hyphens (-) and plus signs (+). More...
 
bool Equals (XmlUnknown? other)
 
- Static Protected Member Functions inherited from ZeroInstall.Model.FeedElement
static bool FilterMismatch (IRecipeStep step)
 Checks whether an element passes the specified IfZeroInstallVersion restriction, if any.
 
- Static Package Functions inherited from ZeroInstall.Model.FeedElement
static bool FilterMismatch< T > (T element)
 Checks whether an element passes the specified IfZeroInstallVersion restriction, if any. More...
 

Detailed Description

Retrieves an implementation by downloading and extracting an archive.

Member Function Documentation

◆ Clone()

override RetrievalMethod ZeroInstall.Model.Archive.Clone ( )
virtual

Creates a deep copy of this Archive instance.

Returns
The new copy of the Archive.

Implements ZeroInstall.Model.RetrievalMethod.

◆ GetFileExtension()

static string ZeroInstall.Model.Archive.GetFileExtension ( string  mimeType)
static

Gets the default file extension for a particular archive MIME type.

Parameters
mimeTypeThe MIME type to get the extension for.
Returns
The file extension including the leading dot, e.g. '.zip'. '.*' if unknown.

◆ GuessMimeType()

static string ZeroInstall.Model.Archive.GuessMimeType ( string  fileName)
inlinestatic

Tries to guess the MIME type of an archive file by looking at its file extension.

Parameters
fileNameThe file name to analyze.
Exceptions
NotSupportedExceptionThe file extension does not correspond to a known archive type.

◆ Normalize()

override void ZeroInstall.Model.Archive.Normalize ( FeedUri feedUri = null)
inline

Converts legacy elements, sets default values, etc..

Implements ZeroInstall.Model.IRecipeStep.

Property Documentation

◆ StartOffset

int ZeroInstall.Model.Archive.StartOffset
getset

The number of bytes at the beginning of the file which should be ignored. The value in DownloadRetrievalMethod.Size does not include the skipped bytes.

This is useful for some self-extracting archives which are made up of a shell script followed by a normal archive in a single file.


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