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
The Format(string, params object[]) format used by ReleasedString
public const string ReleaseDateFormat = "yyyy-MM-dd"
Field Value
ReleasedVerbatim
Used to store the unparsed release date string (instead of Released) if it ContainsTemplateVariables(string).
protected string? ReleasedVerbatim
Field Value
Properties
Bindings
A list of Bindings for Implementations to locate Dependencys.
[Browsable(false)]
[OrderedEquality]
public List<Binding> Bindings { get; }
Property Value
Commands
A list of commands that can be used to launch this implementation.
[Browsable(false)]
[OrderedEquality]
public List<Command> Commands { get; }
Property Value
Remarks
Dependencies
A list of interfaces this implementation depends upon.
[Browsable(false)]
[OrderedEquality]
public List<Dependency> Dependencies { get; }
Property Value
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
this[string]
Returns the Command with a specific name.
public Command? this[string name] { get; }
Parameters
Property Value
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
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
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
ReleasedString
The string form of Released. Only use this if the string ContainsTemplateVariables(string).
public virtual string? ReleasedString { get; set; }
Property Value
- 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
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
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
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
Version
The version number of the implementation.
public virtual ImplementationVersion? Version { get; set; }
Property Value
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
Methods
Clone()
Creates a deep copy of this Element instance.
public abstract Element Clone()
Returns
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
ContainsCommand(string)
public bool ContainsCommand(string name)
Parameters
Returns
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
objectThe object to compare with the current object.
Returns
Equals(Element?)
protected bool Equals(Element? other)
Parameters
other
Element
Returns
GetCommand(string)
Returns the Command with a specific name. Safe for missing elements.
public Command? GetCommand(string name)
Parameters
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
FeedUriThe 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
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
Returns
- bool
true if the objects are not equal; otherwise, false.