IsVersionGreaterOrEqual
public static bool IsVersionGreaterOrEqual(int[] version, int[] checkedVersion)
| Parameter | Type | Default | Description |
|---|---|---|---|
| version | int[] | The version to check if it is more recent or not, passed in as a table of up to 3 ints [major, minor, patch] | |
| checkedVersion | int[] | The reference version, passed in as a table of up to 3 ints [major, minor, patch] |
Returns: true if greater or equal, false if not
Convert a version (formatted as "1.2.3", or in other words "major.minor.patch") as string into a table of 3 ints [major, minor, patch].
public static bool IsVersionGreaterOrEqual(
int major,
int minor,
int patch,
int checkedMajor,
int checkedMinor,
int checkedPatch
)
| Parameter | Type | Default | Description |
|---|---|---|---|
| major | int | The reference Major # to check if greater | |
| minor | int | The reference Minor # to check if greater | |
| patch | int | The reference Patch # to check if greater | |
| checkedMajor | int | The reference Major # to check against | |
| checkedMinor | int | The reference Minor # to check against | |
| checkedPatch | int | The reference Patch # to check against |
Returns: true if greater or equal, false if not
Convert a version (formatted as "1.2.3", or in other words "major.minor.patch") as string into a table of 3 ints [major, minor, patch].
Example Usage
using UnityEngine;
using MikeDaBird.EZRecolor;
class ExampleVersionChecking : MonoBehavior{
string version1 = "1.0.5";
string version2 = "1.0.6";
string version3 = "1.1.6";
string version4 = "2.0.5";
void Start(){
Debug.Log(EZRecolor.IsVersionGreaterOrEqual(EZRecolor.ParseVersion(version2), EZRecolor.ParseVersion(version1)));
// 1.0.6 >= 1.0.5 = true
Debug.Log(EZRecolor.IsVersionGreaterOrEqual(EZRecolor.ParseVersion(version1), EZRecolor.ParseVersion(version2)));
// 1.0.5 >= 1.0.6 = false
Debug.Log(EZRecolor.IsVersionGreaterOrEqual(EZRecolor.ParseVersion(version1), EZRecolor.ParseVersion(version1)));
// 1.0.5 >= 1.0.5 = true
Debug.Log(EZRecolor.IsVersionGreaterOrEqual(EZRecolor.ParseVersion(version3), EZRecolor.ParseVersion(version2)));
// 1.1.6 >= 1.0.6 = true
Debug.Log(EZRecolor.IsVersionGreaterOrEqual(EZRecolor.ParseVersion(version4), EZRecolor.ParseVersion(version1)));
// 2.0.5 >= 1.0.5 = true
}
}