Class AlmostVersion
A type that wraps Hive.Versioning.Version so that the string of the version is stored when the string is not a valid Hive.Versioning.Version.
Inherited Members
Namespace: IPA.Utilities
Assembly: IPA.Loader.dll
Syntax
public class AlmostVersion : IComparable<AlmostVersion>, IComparable<Version>, IComparable<Version>
Constructors
| Improve this Doc View SourceAlmostVersion(Version)
Creates an AlmostVersion from the Hive.Versioning.Version provided in ver
.
Declaration
public AlmostVersion(Version ver)
Parameters
Type | Name | Description |
---|---|---|
Hive.Versioning.Version | ver | the Hive.Versioning.Version to store |
AlmostVersion(Version)
Creates an AlmostVersion from the Version provided in ver
.
Declaration
[Obsolete("Use Hive.Versioning.Version constructor instead.")]
public AlmostVersion(Version ver)
Parameters
Type | Name | Description |
---|---|---|
Version | ver | the 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 Hive.Versioning.Version.
Declaration
public Version SemverValue { get; }
Property Value
Type | Description |
---|---|
Hive.Versioning.Version | the stored value as a Hive.Versioning.Version, or null if not stored as a version. |
StorageMode
The way the value is stored, whether it be as a Hive.Versioning.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(Version)
Compares langword_csharp_this to the Hive.Versioning.Version in other
using Hive.Versioning.Version.CompareTo(Hive.Versioning.Version).
Declaration
public int CompareTo(Version other)
Parameters
Type | Name | Description |
---|---|---|
Hive.Versioning.Version | other | the Hive.Versioning.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 SourceCompareTo(AlmostVersion)
Compares langword_csharp_this to the AlmostVersion in other
using Hive.Versioning.Version.CompareTo(Hive.Versioning.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 Version in other
using Hive.Versioning.Version.CompareTo(Hive.Versioning.Version).
Declaration
[Obsolete("Use the Hive.Versioning.Version overload instead.")]
public int CompareTo(Version other)
Parameters
Type | Name | Description |
---|---|---|
Version | other | the 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 Hive.Versioning.Version, it is equivalent to calling Hive.Versioning.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 Hive.Versioning.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 SourceGreaterThan(AlmostVersion, AlmostVersion)
Declaration
public static bool operator>(AlmostVersion left, AlmostVersion right)
Parameters
Type | Name | Description |
---|---|---|
AlmostVersion | left | |
AlmostVersion | right |
Returns
Type | Description |
---|---|
Boolean |
GreaterThanOrEqual(AlmostVersion, AlmostVersion)
Declaration
public static bool operator >=(AlmostVersion left, AlmostVersion right)
Parameters
Type | Name | Description |
---|---|---|
AlmostVersion | left | |
AlmostVersion | right |
Returns
Type | Description |
---|---|
Boolean |
Implicit(Version to AlmostVersion)
Implicitly converts a Version to AlmostVersion using AlmostVersion(Version).
Declaration
public static implicit operator AlmostVersion(Version ver)
Parameters
Type | Name | Description |
---|---|---|
Hive.Versioning.Version | ver | the Version to convert |
Returns
Type | Description |
---|---|
AlmostVersion |
See Also
| Improve this Doc View SourceImplicit(AlmostVersion to Version)
Implicitly converts an AlmostVersion to 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 Version |
Returns
Type | Description |
---|---|
Hive.Versioning.Version |
See Also
| Improve this Doc View SourceImplicit(AlmostVersion to Version)
Implicitly converts an AlmostVersion to Version, if applicable, using SemverValue. If not applicable, returns null
Declaration
[Obsolete("Use Hive.Versioning.Version instead of SemVer.Version")]
public static implicit operator Version(AlmostVersion av)
Parameters
Type | Name | Description |
---|---|---|
AlmostVersion | av | the AlmostVersion to convert to a Version |
Returns
Type | Description |
---|---|
Version |
See Also
| Improve this Doc View SourceImplicit(Version to AlmostVersion)
Implicitly converts a Version to AlmostVersion using AlmostVersion(Version).
Declaration
[Obsolete("Use Hive.Versioning.Version instead of SemVer.Version")]
public static implicit operator AlmostVersion(Version ver)
Parameters
Type | Name | Description |
---|---|---|
Version | ver | the 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 |
See Also
| Improve this Doc View SourceLessThan(AlmostVersion, AlmostVersion)
Declaration
public static bool operator <(AlmostVersion left, AlmostVersion right)
Parameters
Type | Name | Description |
---|---|---|
AlmostVersion | left | |
AlmostVersion | right |
Returns
Type | Description |
---|---|
Boolean |
LessThanOrEqual(AlmostVersion, AlmostVersion)
Declaration
public static bool operator <=(AlmostVersion left, AlmostVersion right)
Parameters
Type | Name | Description |
---|---|---|
AlmostVersion | left | |
AlmostVersion | right |
Returns
Type | Description |
---|---|
Boolean |