Show / Hide Table of Contents

# Class AlmostVersion

A type that wraps so that the string of the version is stored when the string is not a valid .

##### Inheritance

Object
AlmostVersion

##### Implements

IComparable<AlmostVersion>
IComparable<SemVer.Version>

##### Inherited Members

Object.Equals(Object, Object)
Object.ReferenceEquals(Object, Object)
Object.GetType()
Object.MemberwiseClone()

###### Namespace: IPA.Utilities

###### Assembly: IPA.Loader.dll

##### Syntax

    public class AlmostVersion : IComparable<AlmostVersion>, IComparable<SemVer.Version>

### Constructors

| Improve this Doc View Source

#### AlmostVersion(SemVer.Version)

Creates an AlmostVersion from the provided in `ver`.

##### Declaration

    public AlmostVersion(SemVer.Version ver)

##### Parameters

Type | Name | Description
--- | --- | ---
SemVer.Version | ver | the to store

| Improve this Doc View Source

#### 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

| Improve this Doc View Source

#### 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

| Improve this Doc View Source

#### 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 Source

#### SemverValue

The value of the AlmostVersion if it was stored as a .

##### Declaration

    public SemVer.Version SemverValue { get; }

##### Property Value

Type | Description
--- | ---
SemVer.Version | the stored value as a , or null if not stored as a version.

| Improve this Doc View Source

#### StorageMode

The way the value is stored, whether it be as a or a String.

##### Declaration

    public AlmostVersion.StoredAs StorageMode { get; }

##### Property Value

Type | Description
--- | ---
AlmostVersion.StoredAs | the storage mode used to store this value

| Improve this Doc View Source

#### 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 Source

#### CompareTo(AlmostVersion)

Compares langword_csharp_this to the AlmostVersion in `other` using 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 `other` is considered bigger than langword_csharp_this, 0 if equal, and greater than zero if smaller

##### Remarks

The storage methods of the two objects must be the same, or this will throw an InvalidOperationException.

##### See Also

CompareTo(SemVer.Version)
| Improve this Doc View Source

#### CompareTo(SemVer.Version)

Compares langword_csharp_this to the in `other` using .

##### Declaration

    public int CompareTo(SemVer.Version other)

##### Parameters

Type | Name | Description
--- | --- | ---
SemVer.Version | other | the to compare to

##### Returns

Type | Description
--- | ---
Int32 | less than 0 if `other` is considered bigger than langword_csharp_this, 0 if equal, and greater than zero if smaller

##### Remarks

The storage method of langword_csharp_this must be SemVer, else an InvalidOperationException will be thrown.

##### See Also

CompareTo(AlmostVersion)
| Improve this Doc View Source

#### Equals(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

Object.Equals(Object)

##### Remarks

This may return false where Equality(AlmostVersion, AlmostVersion) returns true

##### See Also

Equals(Object)
| Improve this Doc View Source

#### GetHashCode()

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

Object.GetHashCode()

##### See Also

GetHashCode()
| Improve this Doc View Source

#### ToString()

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 , it is equivalent to calling .

##### Declaration

    public override string ToString()

##### Returns

Type | Description
--- | ---
String | a string representation of the current version

##### Overrides

Object.ToString()

##### See Also

ToString()

### Operators

| Improve this Doc View Source

#### Equality(AlmostVersion, AlmostVersion)

Compares two versions, only taking into account the numeric part of the version if they are stored as sealed, 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

Equals(Object)
| Improve this Doc View Source

#### Implicit(AlmostVersion to SemVer.Version)

Implicitly converts an AlmostVersion to , if applicable, using SemverValue. If not applicable, returns null

##### Declaration

    public static implicit operator SemVer.Version(AlmostVersion av)

##### Parameters

Type | Name | Description
--- | --- | ---
AlmostVersion | av | the AlmostVersion to convert to a

##### Returns

Type | Description
--- | ---
SemVer.Version |

##### See Also

SemverValue
| Improve this Doc View Source

#### Implicit(SemVer.Version to AlmostVersion)

Implicitly converts a to AlmostVersion using AlmostVersion(SemVer.Version).

##### Declaration

    public static implicit operator AlmostVersion(SemVer.Version ver)

##### Parameters

Type | Name | Description
--- | --- | ---
SemVer.Version | ver | the to convert

##### Returns

Type | Description
--- | ---
AlmostVersion |

##### See Also

AlmostVersion(SemVer.Version)
| Improve this Doc View Source

#### Inequality(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

Equality(AlmostVersion, AlmostVersion)

### Implements

System.IComparable<T>
System.IComparable<T>

### Extension Methods

ReflectionUtil.SetPrivateField(Object, String, Object)
ReflectionUtil.GetPrivateField<T>(Object, String)
ReflectionUtil.SetPrivateProperty(Object, String, Object)
ReflectionUtil.InvokePrivateMethod(Object, String, Object[])
ReflectionUtil.InvokePrivateMethod<T>(Object, String, Object[])