Class AlmostVersion
A type that wraps SemVer.Version so that the string of the version is stored when the string is not a valid SemVer.Version.
Inherited Members
Namespace: IPA.Utilities
Assembly: IPA.Loader.dll
Syntax
public class AlmostVersion : IComparable<AlmostVersion>, IComparable<Version>
Constructors
| Improve this Doc View SourceAlmostVersion(Version)
Creates an AlmostVersion from the SemVer.Version provided in ver
.
Declaration
public AlmostVersion(Version ver)
Parameters
Type | Name | Description |
---|---|---|
SemVer.Version | ver | the SemVer.Version to store |
AlmostVersion(String)
Creates a new AlmostVersion with the version string provided in vertext
.
Declaration
public AlmostVersion(string vertext)
Parameters
Type | Name | Description |
---|---|---|
String | vertext | the version string to store |
AlmostVersion(String, AlmostVersion)
Creates a new AlmostVersion from the version string in vertext
stored the
same way as the AlmostVersion passed in copyMode
.
Declaration
public AlmostVersion(string vertext, AlmostVersion copyMode)
Parameters
Type | Name | Description |
---|---|---|
String | vertext | the text to parse as an AlmostVersion |
AlmostVersion | copyMode | an AlmostVersion to copy the storage mode of |
AlmostVersion(String, AlmostVersion.StoredAs)
Creates an AlmostVersion from the version string in vertext
stored using
the storage mode specified in mode
.
Declaration
public AlmostVersion(string vertext, AlmostVersion.StoredAs mode)
Parameters
Type | Name | Description |
---|---|---|
String | vertext | the text to parse as an AlmostVersion |
AlmostVersion.StoredAs | mode | the storage mode to store the version in |
Properties
| Improve this Doc View SourceSemverValue
The value of the AlmostVersion if it was stored as a SemVer.Version.
Declaration
public Version SemverValue { get; }
Property Value
Type | Description |
---|---|
SemVer.Version | the stored value as a SemVer.Version, or null if not stored as a version. |
StorageMode
The way the value is stored, whether it be as a SemVer.Version or a String.
Declaration
public AlmostVersion.StoredAs StorageMode { get; }
Property Value
Type | Description |
---|---|
AlmostVersion.StoredAs | the storage mode used to store this value |
StringValue
The value of the AlmostVersion if it was stored as a String.
Declaration
public string StringValue { get; }
Property Value
Type | Description |
---|---|
String | the stored value as a String, or null if not stored as a string. |
Methods
| Improve this Doc View SourceCompareTo(AlmostVersion)
Compares langword_csharp_this to the AlmostVersion in other
using SemVer.Version.CompareTo(SemVer.Version)
or CompareTo(String), depending on the current store.
Declaration
public int CompareTo(AlmostVersion other)
Parameters
Type | Name | Description |
---|---|---|
AlmostVersion | other | the AlmostVersion to compare to |
Returns
Type | Description |
---|---|
Int32 | less than 0 if |
Remarks
The storage methods of the two objects must be the same, or this will throw an InvalidOperationException.
See Also
| Improve this Doc View SourceCompareTo(Version)
Compares langword_csharp_this to the SemVer.Version in other
using SemVer.Version.CompareTo(SemVer.Version).
Declaration
public int CompareTo(Version other)
Parameters
Type | Name | Description |
---|---|---|
SemVer.Version | other | the SemVer.Version to compare to |
Returns
Type | Description |
---|---|
Int32 | less than 0 if |
Remarks
The storage method of langword_csharp_this must be SemVer, else an InvalidOperationException will be thrown.
See Also
| Improve this Doc View SourceEquals(Object)
Performs a strict equality check between langword_csharp_this and obj
.
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
Object | obj | the object to compare to |
Returns
Type | Description |
---|---|
Boolean | true if they are equal, false otherwise |
Overrides
Remarks
This may return false where Equality(AlmostVersion, AlmostVersion) returns true
See Also
| Improve this Doc View SourceGetHashCode()
Default generated hash code function generated by VS.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
Int32 | a value unique to each object, except those that are considered equal by Equals(Object) |
Overrides
See Also
| Improve this Doc View SourceToString()
Gets a string representation of the current version. If the value is stored as a string, this returns it. If it is stored as a SemVer.Version, it is equivalent to calling SemVer.Version.ToString.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
String | a string representation of the current version |
Overrides
See Also
Operators
| Improve this Doc View SourceEquality(AlmostVersion, AlmostVersion)
Compares two versions, only taking into account the numeric part of the version if they are stored as SemVer.Versions, or strict equality if they are stored as Strings.
Declaration
public static bool operator ==(AlmostVersion l, AlmostVersion r)
Parameters
Type | Name | Description |
---|---|---|
AlmostVersion | l | the first value to compare |
AlmostVersion | r | the second value to compare |
Returns
Type | Description |
---|---|
Boolean | true if they are mostly equal, false otherwise |
Remarks
This is a looser equality than Equals(Object), meaning that this may return true where Equals(Object) does not.
See Also
| Improve this Doc View SourceImplicit(AlmostVersion to Version)
Implicitly converts an AlmostVersion to SemVer.Version, if applicable, using SemverValue. If not applicable, returns null
Declaration
public static implicit operator Version(AlmostVersion av)
Parameters
Type | Name | Description |
---|---|---|
AlmostVersion | av | the AlmostVersion to convert to a SemVer.Version |
Returns
Type | Description |
---|---|
SemVer.Version |
See Also
| Improve this Doc View SourceImplicit(Version to AlmostVersion)
Implicitly converts a SemVer.Version to AlmostVersion using AlmostVersion(Version).
Declaration
public static implicit operator AlmostVersion(Version ver)
Parameters
Type | Name | Description |
---|---|---|
SemVer.Version | ver | the SemVer.Version to convert |
Returns
Type | Description |
---|---|
AlmostVersion |
See Also
| Improve this Doc View SourceInequality(AlmostVersion, AlmostVersion)
The opposite of Equality(AlmostVersion, AlmostVersion). Equivalent to !(l == r)
.
Declaration
public static bool operator !=(AlmostVersion l, AlmostVersion r)
Parameters
Type | Name | Description |
---|---|---|
AlmostVersion | l | the first value to compare |
AlmostVersion | r | the second value to compare |
Returns
Type | Description |
---|---|
Boolean | true if they are not mostly equal, false otherwise |