A semantic version implementation. Conforms to v2.0.0 of http://semver.org/ Original source by Max Hauser: https://github.com/maxhauser/semver
More...
|
| SemVersion (int major, int minor=0, int patch=0, string prerelease="", string build="") |
| Initializes a new instance of the SemVersion class. More...
|
|
| SemVersion (Version version) |
| Initializes a new instance of the SemVersion class. More...
|
|
SemVersion | Change (int? major=null, int? minor=null, int? patch=null, string prerelease=null, string build=null) |
| Make a copy of the current instance with optional altered fields. More...
|
|
override string | ToString () |
| Returns a System.String that represents this instance. More...
|
|
int | CompareTo (object obj) |
| Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object. More...
|
|
int | CompareTo (SemVersion other) |
| Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object. More...
|
|
bool | PrecedenceMatches (SemVersion other) |
| Compares to semantic versions by precedence. This does the same as a Equals, but ignores the build information. More...
|
|
int | CompareByPrecedence (SemVersion other) |
| Compares to semantic versions by precedence. This does the same as a Equals, but ignores the build information. More...
|
|
override bool | Equals (object obj) |
| Determines whether the specified System.Object is equal to this instance. More...
|
|
override int | GetHashCode () |
| Returns a hash code for this instance. More...
|
|
void | GetObjectData (SerializationInfo info, StreamingContext context) |
| Get the object data. More...
|
|
|
static SemVersion | Parse (string version, bool strict=false) |
| Parses the specified string to a semantic version. More...
|
|
static bool | TryParse (string version, out SemVersion semver, bool strict=false) |
| Parses the specified string to a semantic version. More...
|
|
static bool | Equals (SemVersion versionA, SemVersion versionB) |
| Tests the specified versions for equality. More...
|
|
static int | Compare (SemVersion versionA, SemVersion versionB) |
| Compares the specified versions. More...
|
|
static implicit | operator SemVersion (string version) |
| Implicit conversion from string to SemVersion. More...
|
|
static bool | operator== (SemVersion left, SemVersion right) |
| The override of the equals operator. More...
|
|
static bool | operator!= (SemVersion left, SemVersion right) |
| The override of the un-equal operator. More...
|
|
static bool | operator> (SemVersion left, SemVersion right) |
| The override of the greater operator. More...
|
|
static bool | operator>= (SemVersion left, SemVersion right) |
| The override of the greater than or equal operator. More...
|
|
static bool | operator< (SemVersion left, SemVersion right) |
| The override of the less operator. More...
|
|
static bool | operator<= (SemVersion left, SemVersion right) |
| The override of the less than or equal operator. More...
|
|
A semantic version implementation. Conforms to v2.0.0 of http://semver.org/ Original source by Max Hauser: https://github.com/maxhauser/semver
◆ SemVersion() [1/2]
Turbanov.Toolworks.Definitto.SemVersion.SemVersion |
( |
int |
major, |
|
|
int |
minor = 0 , |
|
|
int |
patch = 0 , |
|
|
string |
prerelease = "" , |
|
|
string |
build = "" |
|
) |
| |
Initializes a new instance of the SemVersion class.
- Parameters
-
major | The major version. |
minor | The minor version. |
patch | The patch version. |
prerelease | The prerelease version (eg. "alpha"). |
build | The build eg ("nightly.232"). |
◆ SemVersion() [2/2]
Turbanov.Toolworks.Definitto.SemVersion.SemVersion |
( |
Version |
version | ) |
|
Initializes a new instance of the SemVersion class.
- Parameters
-
version | The System.Version that is used to initialize the Major, Minor, Patch and Build properties. |
◆ Change()
SemVersion Turbanov.Toolworks.Definitto.SemVersion.Change |
( |
int? |
major = null , |
|
|
int? |
minor = null , |
|
|
int? |
patch = null , |
|
|
string |
prerelease = null , |
|
|
string |
build = null |
|
) |
| |
Make a copy of the current instance with optional altered fields.
- Parameters
-
major | The major version. |
minor | The minor version. |
patch | The patch version. |
prerelease | The prerelease text. |
build | The build text. |
- Returns
- The new version object.
◆ Compare()
static int Turbanov.Toolworks.Definitto.SemVersion.Compare |
( |
SemVersion |
versionA, |
|
|
SemVersion |
versionB |
|
) |
| |
|
static |
Compares the specified versions.
- Parameters
-
versionA | The version to compare to. |
versionB | The version to compare against. |
- Returns
- If versionA < versionB
< 0
, if versionA > versionB > 0
, if versionA is equal to versionB 0
.
◆ CompareByPrecedence()
int Turbanov.Toolworks.Definitto.SemVersion.CompareByPrecedence |
( |
SemVersion |
other | ) |
|
Compares to semantic versions by precedence. This does the same as a Equals, but ignores the build information.
- Parameters
-
other | The semantic version. |
- Returns
- A value that indicates the relative order of the objects being compared. The return value has these meanings: Value Meaning Less than zero This instance precedes other in the version precedence. Zero This instance has the same precedence as other . i Greater than zero This instance has creater precedence as other .
◆ CompareTo() [1/2]
int Turbanov.Toolworks.Definitto.SemVersion.CompareTo |
( |
object |
obj | ) |
|
Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.
- Parameters
-
obj | An object to compare with this instance. |
- Returns
- A value that indicates the relative order of the objects being compared. The return value has these meanings: Value Meaning Less than zero This instance precedes obj in the sort order. Zero This instance occurs in the same position in the sort order as obj . i Greater than zero This instance follows obj in the sort order.
◆ CompareTo() [2/2]
int Turbanov.Toolworks.Definitto.SemVersion.CompareTo |
( |
SemVersion |
other | ) |
|
Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.
- Parameters
-
other | An object to compare with this instance. |
- Returns
- A value that indicates the relative order of the objects being compared. The return value has these meanings: Value Meaning Less than zero This instance precedes other in the sort order. Zero This instance occurs in the same position in the sort order as other . i Greater than zero This instance follows other in the sort order.
◆ Equals() [1/2]
static bool Turbanov.Toolworks.Definitto.SemVersion.Equals |
( |
SemVersion |
versionA, |
|
|
SemVersion |
versionB |
|
) |
| |
|
static |
Tests the specified versions for equality.
- Parameters
-
versionA | The first version. |
versionB | The second version. |
- Returns
- If versionA is equal to versionB
true
, else false
.
◆ Equals() [2/2]
override bool Turbanov.Toolworks.Definitto.SemVersion.Equals |
( |
object |
obj | ) |
|
Determines whether the specified System.Object is equal to this instance.
- Parameters
-
obj | The System.Object to compare with this instance. |
- Returns
true
if the specified System.Object is equal to this instance; otherwise, false
.
◆ GetHashCode()
override int Turbanov.Toolworks.Definitto.SemVersion.GetHashCode |
( |
| ) |
|
Returns a hash code for this instance.
- Returns
- A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.
◆ GetObjectData()
void Turbanov.Toolworks.Definitto.SemVersion.GetObjectData |
( |
SerializationInfo |
info, |
|
|
StreamingContext |
context |
|
) |
| |
Get the object data.
- Parameters
-
info | Serialization info. |
context | Streaming context. |
◆ operator SemVersion()
static implicit Turbanov.Toolworks.Definitto.SemVersion.operator SemVersion |
( |
string |
version | ) |
|
|
static |
Implicit conversion from string to SemVersion.
- Parameters
-
version | The semantic version. |
- Returns
- The SemVersion object.
◆ operator!=()
static bool Turbanov.Toolworks.Definitto.SemVersion.operator!= |
( |
SemVersion |
left, |
|
|
SemVersion |
right |
|
) |
| |
|
static |
The override of the un-equal operator.
- Parameters
-
left | The left value. |
right | The right value. |
- Returns
- If left is not equal to right
true
, else false
.
◆ operator<()
The override of the less operator.
- Parameters
-
left | The left value. |
right | The right value. |
- Returns
- If left is less than right
true
, else false
.
◆ operator<=()
static bool Turbanov.Toolworks.Definitto.SemVersion.operator<= |
( |
SemVersion |
left, |
|
|
SemVersion |
right |
|
) |
| |
|
static |
The override of the less than or equal operator.
- Parameters
-
left | The left value. |
right | The right value. |
- Returns
- If left is less than or equal to right
true
, else false
.
◆ operator==()
static bool Turbanov.Toolworks.Definitto.SemVersion.operator== |
( |
SemVersion |
left, |
|
|
SemVersion |
right |
|
) |
| |
|
static |
The override of the equals operator.
- Parameters
-
left | The left value. |
right | The right value. |
- Returns
- If left is equal to right
true
, else false
.
◆ operator>()
The override of the greater operator.
- Parameters
-
left | The left value. |
right | The right value. |
- Returns
- If left is greater than right
true
, else false
.
◆ operator>=()
static bool Turbanov.Toolworks.Definitto.SemVersion.operator>= |
( |
SemVersion |
left, |
|
|
SemVersion |
right |
|
) |
| |
|
static |
The override of the greater than or equal operator.
- Parameters
-
left | The left value. |
right | The right value. |
- Returns
- If left is greater than or equal to right
true
, else false
.
◆ Parse()
static SemVersion Turbanov.Toolworks.Definitto.SemVersion.Parse |
( |
string |
version, |
|
|
bool |
strict = false |
|
) |
| |
|
static |
Parses the specified string to a semantic version.
- Parameters
-
version | The version string. |
strict | If set to true minor and patch version are required, else they default to 0. |
- Returns
- The SemVersion object.
- Exceptions
-
System.InvalidOperationException | When a invalid version string is passed. |
◆ PrecedenceMatches()
bool Turbanov.Toolworks.Definitto.SemVersion.PrecedenceMatches |
( |
SemVersion |
other | ) |
|
Compares to semantic versions by precedence. This does the same as a Equals, but ignores the build information.
- Parameters
-
other | The semantic version. |
- Returns
true
if the version precedence matches.
◆ ToString()
override string Turbanov.Toolworks.Definitto.SemVersion.ToString |
( |
| ) |
|
Returns a System.String that represents this instance.
- Returns
- A System.String that represents this instance.
◆ TryParse()
static bool Turbanov.Toolworks.Definitto.SemVersion.TryParse |
( |
string |
version, |
|
|
out SemVersion |
semver, |
|
|
bool |
strict = false |
|
) |
| |
|
static |
Parses the specified string to a semantic version.
- Parameters
-
version | The version string. |
semver | When the method returns, contains a SemVersion instance equivalent to the version string passed in, if the version string was valid, or null if the version string was not valid. |
strict | If set to true minor and patch version are required, else they default to 0. |
- Returns
False
when a invalid version string is passed, otherwise true
.
◆ Build
string Turbanov.Toolworks.Definitto.SemVersion.Build |
|
get |
Gets the build version.
The build version.
◆ Major
int Turbanov.Toolworks.Definitto.SemVersion.Major |
|
get |
Gets the major version.
The major version.
◆ Minor
int Turbanov.Toolworks.Definitto.SemVersion.Minor |
|
get |
Gets the minor version.
The minor version.
◆ Patch
int Turbanov.Toolworks.Definitto.SemVersion.Patch |
|
get |
Gets the patch version.
The patch version.
◆ Prerelease
string Turbanov.Toolworks.Definitto.SemVersion.Prerelease |
|
get |
Gets the pre-release version.
The pre-release version.
The documentation for this class was generated from the following file:
- P:/projects.local/iptvd/toolworks/definitto/definitto/Definitto.Unity/Assets/Definitto/Scripts/Max Hauser/Semver/SemVersion.cs