Class Requirements
- Namespace
- ZeroInstall.Model
- Assembly
- ZeroInstall.Model.dll
A set of requirements/restrictions imposed by the user on the Implementation selection process. Used as input for the solver.
[Serializable]
[Equatable]
public record Requirements : IEquatable<Requirements>
- Inheritance
-
Requirements
- Implements
- Inherited Members
Constructors
Requirements()
Creates an empty requirements object. Use this to fill in values incrementally, e.g. when parsing command-line arguments.
public Requirements()
Requirements(FeedUri, string?, Architecture)
Creates a new requirements object.
public Requirements(FeedUri interfaceUri, string? command = null, Architecture architecture = default)
Parameters
interfaceUri
FeedUriThe URI or local path (must be absolute) to the interface to solve the dependencies for.
command
stringThe name of the command in the implementation to execute. Will default to NameRun or NameCompile if
null
. Will not try to find any command if set to Empty.architecture
ArchitectureThe architecture to find executables for. Find for the current system if left at default value.
Properties
Architecture
The architecture to find executables for. Find for the current system if left at default value.
[JsonIgnore]
public Architecture Architecture { get; set; }
Property Value
Remarks
Will default to CurrentSystem if left at default value. Will not try to find any command if set to Empty.
Command
The name of the command in the implementation to execute. Will default to NameRun or NameCompile if null
. Will not try to find any command if set to Empty.
[TypeConverter(typeof(CommandNameConverter))]
[JsonProperty("command")]
public string? Command { get; set; }
Property Value
CpuString
Used for XML and JSON serialization.
[Browsable(false)]
[JsonProperty("cpu", DefaultValueHandling = DefaultValueHandling.Ignore)]
public string CpuString { get; set; }
Property Value
- See Also
Distributions
Specifies that the selected implementations must be from one of the given distributions (e.g. Debian, RPM). The special value DistributionZeroInstall may be used to require implementations provided by Zero Install (i.e. one not provided by a PackageImplementation).
[Browsable(false)]
[JsonIgnore]
[UnorderedEquality]
public List<string> Distributions { get; }
Property Value
Remarks
Used internally by solvers, copied from Distributions, not set directly by user, not serialized.
ExtraRestrictions
The ranges of versions of specific sub-implementations that can be chosen.
[JsonProperty("extra_restrictions")]
[UnorderedEquality]
public Dictionary<FeedUri, VersionRange> ExtraRestrictions { get; }
Property Value
InterfaceUri
The URI or local path (must be absolute) to the interface to solve the dependencies for.
[JsonProperty("interface")]
public required FeedUri InterfaceUri { get; set; }
Property Value
Languages
The preferred languages for the implementation.
[JsonIgnore]
[SetEquality]
public LanguageSet Languages { get; }
Property Value
Message
Message to display when interacting with user.
[JsonProperty("message", DefaultValueHandling = DefaultValueHandling.Ignore)]
public string? Message { get; set; }
Property Value
OSString
Used for XML and JSON serialization.
[Browsable(false)]
[JsonProperty("os", DefaultValueHandling = DefaultValueHandling.Ignore)]
public string OSString { get; set; }
Property Value
- See Also
Source
Used for XML and JSON serialization.
[Browsable(false)]
[JsonProperty("source")]
public bool Source { get; set; }
Property Value
- See Also
Versions
The ranges of versions that can be chosen.
[Browsable(false)]
[JsonIgnore]
public VersionRange? Versions { get; set; }
Property Value
Methods
AddRestriction(FeedUri, VersionRange)
Adds version restriction for a specific feeds. Merges with any existing restrictions for that feed.
public void AddRestriction(FeedUri feedUri, VersionRange versions)
Parameters
feedUri
FeedUriThe feed URI to apply the restriction for.
versions
VersionRangeThe version range set to restrict to.
Equals(Requirements?)
Indicates whether the current object is equal to another object of the same type.
public virtual bool Equals(Requirements? other)
Parameters
other
RequirementsAn object to compare with this object.
Returns
ForCurrentSystem()
Substitutes blank values with default values appropriate for the current system.
public Requirements ForCurrentSystem()
Returns
GetHashCode()
Serves as the default hash function.
public override int GetHashCode()
Returns
- int
A hash code for the current object.
ToCommandLineArgs()
Transforms the requirements into a command-line arguments.
public string[] ToCommandLineArgs()
Returns
- string[]
ToString()
Returns the requirements in the form "InterfaceUri (Command)". Not safe for parsing!
public override string ToString()
Returns
Operators
implicit operator Requirements(FeedUri)
Convenience cast for creating simple Requirements from a FeedUri.
public static implicit operator Requirements(FeedUri uri)
Parameters
uri
FeedUri