Table of Contents

Class Element

Namespace
ZeroInstall.Model
Assembly
ZeroInstall.Model.dll

Abstract base class for ImplementationBase and Group. Contains those parameters that can be transferred from a Group to an Implementation.

[Equatable]
public abstract class Element : TargetBase, IEquatable<XmlUnknown>, IEquatable<FeedElement>, IEquatable<TargetBase>, IBindingContainer, IDependencyContainer, ICloneable<Element>, IEquatable<Element>
Inheritance
Element
Implements
Derived
Inherited Members
Extension Methods

Fields

ReleaseDateFormat

public const string ReleaseDateFormat = "yyyy-MM-dd"

Field Value

string

ReleasedVerbatim

Used to store the unparsed release date string (instead of Released) if it ContainsTemplateVariables(string).

protected string? ReleasedVerbatim

Field Value

string

Properties

Bindings

A list of Bindings for Implementations to locate Dependencys.

[Browsable(false)]
[OrderedEquality]
public List<Binding> Bindings { get; }

Property Value

List<Binding>

Commands

A list of commands that can be used to launch this implementation.

[Browsable(false)]
[OrderedEquality]
public List<Command> Commands { get; }

Property Value

List<Command>

Remarks

This will eventually replace Main and SelfTest.

Dependencies

A list of interfaces this implementation depends upon.

[Browsable(false)]
[OrderedEquality]
public List<Dependency> Dependencies { get; }

Property Value

List<Dependency>

DocDir

The relative path of a directory inside the implementation that contains the package's documentation. This is the directory that would end up inside /usr/share/doc on a traditional Linux system.

public string? DocDir { get; set; }

Property Value

string

this[string]

Returns the Command with a specific name.

public Command? this[string name] { get; }

Parameters

name string

The Name to look for; Empty for none.

Property Value

Command

The first matching command; null if name is Empty.

Remarks

Should only be called after Normalize(FeedUri?) has been called, otherwise nested Implementations will not be considered.

Exceptions

KeyNotFoundException

No matching Command was found.

License

License terms (typically a Trove category, as used on freshmeat.net).

[TypeConverter(typeof(LicenseNameConverter))]
public string? License { get; set; }

Property Value

string

Main

The relative path of an executable inside the implementation that should be executed by default when the interface is run. If an implementation has no main setting, then it cannot be executed without specifying one manually. This typically means that the interface is for a library.

public string? Main { get; set; }

Property Value

string

Remarks

This is deprecated in favor of Commands. null corresponds to no Commands. An empty string corresponds to a Command with no Path.

Released

The date this implementation was made available. For development versions checked out from version control this attribute should not be present.

public virtual DateTime Released { get; set; }

Property Value

DateTime

ReleasedString

The string form of Released. Only use this if the string ContainsTemplateVariables(string).

public virtual string? ReleasedString { get; set; }

Property Value

string
See Also

Restrictions

A list of interfaces that are restricted to specific versions when used.

[Browsable(false)]
[OrderedEquality]
public List<Restriction> Restrictions { get; }

Property Value

List<Restriction>

RolloutPercentage

The percentage (0-100) of users that should treat this as Stable. May only be set if Stability is Unset or Testing. This can be used to perform staged rollouts.

public virtual int RolloutPercentage { get; set; }

Property Value

int

SelfTest

The relative path of an executable inside the implementation that can be executed to test the program. The program must be non-interactive (e.g. it can't open any windows or prompt for input). It should return with an exit status of 0 if the tests pass. Any other status indicates failure.

public string? SelfTest { get; set; }

Property Value

string

Remarks

This is deprecated in favor of Commands. null corresponds to no Commands. An empty string corresponds to a Command with no Path.

Stability

The default stability rating for this implementation.

public virtual Stability Stability { get; set; }

Property Value

Stability

Version

The version number of the implementation.

public virtual ImplementationVersion? Version { get; set; }

Property Value

ImplementationVersion

VersionModifier

A string to be appended to the version. The purpose of this is to allow complex version numbers (such as "1.0-rc2") in older versions of the injector.

public virtual string? VersionModifier { get; set; }

Property Value

string

Methods

Clone()

Creates a deep copy of this Element instance.

public abstract Element Clone()

Returns

Element

The new copy of the Element.

CloneFromTo(Element, Element)

Copies all known values from one instance to another. Helper method for instance cloning.

protected static void CloneFromTo(Element from, Element to)

Parameters

from Element
to Element

ContainsCommand(string)

Determines whether Commands contains a Command with a specific name.

public bool ContainsCommand(string name)

Parameters

name string

The Name to look for; Empty for none.

Returns

bool

true if a matching command was found or if name is Empty; false otherwise.

EnsureAttributes()

Ensures that required values deserialized from XML attributes are set (not null).

protected virtual void EnsureAttributes()

Exceptions

InvalidDataException

A required property is not set or invalid.

Equals(object?)

Determines whether the specified object is equal to the current object.

public override bool Equals(object? obj)

Parameters

obj object

The object to compare with the current object.

Returns

bool

true if the specified object is equal to the current object; otherwise, false.

Equals(Element?)

protected bool Equals(Element? other)

Parameters

other Element

Returns

bool

GetCommand(string)

Returns the Command with a specific name. Safe for missing elements.

public Command? GetCommand(string name)

Parameters

name string

The Name to look for.

Returns

Command

The first matching command; null if no matching one was found.

Remarks

Should only be called after Normalize(FeedUri?) has been called, otherwise nested Implementations will not be considered.

GetHashCode()

Serves as the default hash function.

public override int GetHashCode()

Returns

int

A hash code for the current object.

Normalize(FeedUri?)

Flattens inheritance structures, Converts legacy elements, sets default values, etc..

public virtual void Normalize(FeedUri? feedUri = null)

Parameters

feedUri FeedUri

The feed the data was originally loaded from.

Exceptions

InvalidDataException

A required property is not set or invalid.

Operators

operator ==(Element?, Element?)

Indicates whether the object on the left is equal to the object on the right.

public static bool operator ==(Element? left, Element? right)

Parameters

left Element

The left object

right Element

The right object

Returns

bool

true if the objects are equal; otherwise, false.

operator !=(Element?, Element?)

Indicates whether the object on the left is not equal to the object on the right.

public static bool operator !=(Element? left, Element? right)

Parameters

left Element

The left object

right Element

The right object

Returns

bool

true if the objects are not equal; otherwise, false.