Class Element
Abstract base class for ImplementationBase and Group. Contains those parameters that can be transferred from a Group to an Implementation.
Inheritance
Implements
Inherited Members
Namespace: ZeroInstall.Model
Assembly: ZeroInstall.Model.dll
Syntax
public abstract class Element : TargetBase, IBindingContainer, IDependencyContainer
Constructors
Element()
Declaration
protected Element()
Fields
ReleaseDateFormat
The Format(String, Object[]) format used by ReleasedString
Declaration
public const string ReleaseDateFormat = "yyyy-MM-dd"
Field Value
Type | Description |
---|---|
String |
ReleasedVerbatim
Used to store the unparsed release date string (instead of Released) if it ContainsTemplateVariables(String).
Declaration
protected string ReleasedVerbatim
Field Value
Type | Description |
---|---|
String |
Properties
Bindings
A list of Bindings for Implementations to locate Dependencys.
Declaration
public List<Binding> Bindings { get; }
Property Value
Type | Description |
---|---|
List<Binding> |
Commands
A list of commands that can be used to launch this implementation.
Declaration
public List<Command> Commands { get; }
Property Value
Type | Description |
---|---|
List<Command> |
Remarks
Dependencies
A list of interfaces this implementation depends upon.
Declaration
public List<Dependency> Dependencies { get; }
Property Value
Type | Description |
---|---|
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.
Declaration
public string DocDir { get; set; }
Property Value
Type | Description |
---|---|
String |
Item[String]
Returns the Command with a specific name.
Declaration
public Command this[string name] { get; }
Parameters
Type | Name | Description |
---|---|---|
String | name |
Property Value
Type | Description |
---|---|
Command | The first matching command; |
Remarks
Should only be called after Normalize(FeedUri) has been called, otherwise nested Implementations will not be considered.
Exceptions
Type | Condition |
---|---|
KeyNotFoundException | No matching Command was found. |
License
License terms (typically a Trove category, as used on freshmeat.net).
Declaration
public string License { get; set; }
Property Value
Type | Description |
---|---|
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.
Declaration
public string Main { get; set; }
Property Value
Type | Description |
---|---|
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.
Declaration
public virtual DateTime Released { get; set; }
Property Value
Type | Description |
---|---|
DateTime |
ReleasedString
The string form of Released. Only use this if the string ContainsTemplateVariables(String).
Declaration
public virtual string ReleasedString { get; set; }
Property Value
Type | Description |
---|---|
String |
See Also
Restrictions
A list of interfaces that are restricted to specific versions when used.
Declaration
public List<Restriction> Restrictions { get; }
Property Value
Type | Description |
---|---|
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.
Declaration
public virtual int RolloutPercentage { get; set; }
Property Value
Type | Description |
---|---|
Int32 |
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.
Declaration
public string SelfTest { get; set; }
Property Value
Type | Description |
---|---|
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.
Declaration
public virtual Stability Stability { get; set; }
Property Value
Type | Description |
---|---|
Stability |
Version
The version number of the implementation.
Declaration
public virtual ImplementationVersion Version { get; set; }
Property Value
Type | Description |
---|---|
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.
Declaration
public virtual string VersionModifier { get; set; }
Property Value
Type | Description |
---|---|
String |
VersionString
Used for XML serialization.
Declaration
public virtual string VersionString { get; set; }
Property Value
Type | Description |
---|---|
String |
See Also
Methods
Clone()
Creates a deep copy of this Element instance.
Declaration
public abstract Element Clone()
Returns
Type | Description |
---|---|
Element | The new copy of the Element. |
CloneFromTo(Element, Element)
Copies all known values from one instance to another. Helper method for instance cloning.
Declaration
protected static void CloneFromTo(Element from, Element to)
Parameters
Type | Name | Description |
---|---|---|
Element | from | |
Element | to |
ContainsCommand(String)
Declaration
public bool ContainsCommand(string name)
Parameters
Type | Name | Description |
---|---|---|
String | name |
Returns
Type | Description |
---|---|
Boolean |
|
EnsureAttributes()
Ensures that required values deserialized from XML attributes are set (not null
).
Declaration
protected virtual void EnsureAttributes()
Exceptions
Type | Condition |
---|---|
InvalidDataException | A required property is not set or invalid. |
Equals(Object)
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
Object | obj |
Returns
Type | Description |
---|---|
Boolean |
Overrides
Equals(Element)
Declaration
public bool Equals(Element other)
Parameters
Type | Name | Description |
---|---|---|
Element | other |
Returns
Type | Description |
---|---|
Boolean |
GetCommand(String)
Returns the Command with a specific name. Safe for missing elements.
Declaration
public Command GetCommand(string name)
Parameters
Type | Name | Description |
---|---|---|
String | name | The Name to look for. |
Returns
Type | Description |
---|---|
Command | The first matching command; |
Remarks
Should only be called after Normalize(FeedUri) has been called, otherwise nested Implementations will not be considered.
GetHashCode()
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
Int32 |
Overrides
Normalize(FeedUri)
Flattens inheritance structures, Converts legacy elements, sets default values, etc..
Declaration
public virtual void Normalize(FeedUri feedUri = null)
Parameters
Type | Name | Description |
---|---|---|
FeedUri | feedUri | The feed the data was originally loaded from. |
Exceptions
Type | Condition |
---|---|
InvalidDataException | A required property is not set or invalid. |
Operators
Equality(Element, Element)
Indicates whether the object on the left is equal to the object on the right.
Declaration
public static bool operator ==(Element left, Element right)
Parameters
Type | Name | Description |
---|---|---|
Element | left | The left object |
Element | right | The right object |
Returns
Type | Description |
---|---|
Boolean | true if the objects are equal; otherwise, false. |
Inequality(Element, Element)
Indicates whether the object on the left is not equal to the object on the right.
Declaration
public static bool operator !=(Element left, Element right)
Parameters
Type | Name | Description |
---|---|---|
Element | left | The left object |
Element | right | The right object |
Returns
Type | Description |
---|---|
Boolean | true if the objects are not equal; otherwise, false. |