Table of Contents

Struct GameVersion

Namespace
Hi3Helper.Plugin.Core.Management
Assembly
Hi3Helper.Plugin.Core.dll

Represents a version of API, Game Installation or Assets.

public struct GameVersion : IVersion, IEquatable<IVersion>, IEquatable<GameVersion>, IUtf8SpanFormattable, IUtf8SpanParsable<GameVersion>, ISpanFormattable, IFormattable, ISpanParsable<GameVersion>, IParsable<GameVersion>
Implements
Inherited Members
Extension Methods

Constructors

GameVersion(ReadOnlySpan<char>)

public GameVersion(ReadOnlySpan<char> version)

Parameters

version ReadOnlySpan<char>

GameVersion(params ReadOnlySpan<int>)

public GameVersion(params ReadOnlySpan<int> ver)

Parameters

ver ReadOnlySpan<int>

GameVersion(string?)

public GameVersion(string? version)

Parameters

version string

GameVersion(Version)

public GameVersion(Version version)

Parameters

version Version

Fields

Build

public readonly int Build

Field Value

int

Empty

public static readonly GameVersion Empty

Field Value

GameVersion

Major

public readonly int Major

Field Value

int

Minor

public readonly int Minor

Field Value

int

Revision

public readonly int Revision

Field Value

int

Properties

VersionArray

public readonly int[] VersionArray { get; }

Property Value

int[]

VersionArrayManifest

public readonly int[] VersionArrayManifest { get; }

Property Value

int[]

VersionString

public readonly string VersionString { get; }

Property Value

string

Methods

AsSpan()

Create a Span<T> of int representation of this struct.

public ReadOnlySpan<int> AsSpan()

Returns

ReadOnlySpan<int>

A Span<T> of int with 4-int by length.

Equals(GameVersion)

Indicates whether the current object is equal to another object of the same type.

public readonly bool Equals(GameVersion other)

Parameters

other GameVersion

An object to compare with this object.

Returns

bool

true if the current object is equal to the other parameter; otherwise, false.

Equals(IVersion?)

Indicates whether the current object is equal to another object of the same type.

public readonly bool Equals(IVersion? other)

Parameters

other IVersion

An object to compare with this object.

Returns

bool

true if the current object is equal to the other parameter; otherwise, false.

Equals(object?)

Indicates whether this instance and a specified object are equal.

public override readonly bool Equals(object? obj)

Parameters

obj object

The object to compare with the current instance.

Returns

bool

true if obj and this instance are the same type and represent the same value; otherwise, false.

GetHashCode()

Returns the hash code for this instance.

public override readonly int GetHashCode()

Returns

int

A 32-bit signed integer that is the hash code for this instance.

GetIncrementedVersion()

public readonly GameVersion GetIncrementedVersion()

Returns

GameVersion

Parse(ReadOnlySpan<byte>, IFormatProvider?)

Parses a UTF-8 encoded byte span into a GameVersion instance.

public static GameVersion Parse(ReadOnlySpan<byte> utf8Text, IFormatProvider? provider)

Parameters

utf8Text ReadOnlySpan<byte>

The UTF-8 encoded byte span representing the version string.

provider IFormatProvider

An optional format provider. This parameter is ignored in this implementation.

Returns

GameVersion

A GameVersion instance parsed from the input.

Exceptions

ArgumentException

Thrown if the input is not a valid GameVersion string.

Parse(ReadOnlySpan<char>, IFormatProvider?)

Parses a character span into a GameVersion instance.

public static GameVersion Parse(ReadOnlySpan<char> s, IFormatProvider? provider)

Parameters

s ReadOnlySpan<char>

The character span representing the version.

provider IFormatProvider

An optional format provider. This parameter is ignored in this implementation.

Returns

GameVersion

A GameVersion instance parsed from the input span.

Exceptions

ArgumentException

Thrown if the input is not a valid GameVersion string.

Parse(string, IFormatProvider?)

Parses a string into a GameVersion instance.

public static GameVersion Parse(string s, IFormatProvider? provider)

Parameters

s string

The string representing the version.

provider IFormatProvider

An optional format provider. This parameter is ignored in this implementation.

Returns

GameVersion

A GameVersion instance parsed from the input string.

Exceptions

ArgumentException

Thrown if the input is not a valid GameVersion string.

ToString()

Create a string representation of GameVersion into "Major.Minor.Build.Revision" format if Revision number is defined or "Major.Minor.Build" if not.

public override readonly string ToString()

Returns

string

ToString(string?, IFormatProvider?)

Create a string representation of GameVersion.

public readonly string ToString(string? format, IFormatProvider? formatProvider = null)

Parameters

format string

An optional format specifier.

If it's 'S' or 's', depending on each Major, Minor, Build or Revision field whether it's non-0, then write shorter version as possible.
For Example:
If 3.0.0.0, then write as "3"
If 3.2.0.0, then write as "3.2"
and so on.

If it's 'N' or 'n', the "Major.Minor.Build" format is written.
If it's 'F' or 'f', the "Major.Minor.Build.Revision" format is written.

Otherwise or by default, it will automatically write to "Major.Minor.Build.Revision" format if Revision number is defined or "Major.Minor.Build" if not.

formatProvider IFormatProvider

A format provider instance to write the result.

Returns

string

A string representation of GameVersion.

ToVersion()

Convert this instance into Version.

public readonly Version ToVersion()

Returns

Version

A Version instance.

TryFormat(Span<byte>, out int, ReadOnlySpan<char>, IFormatProvider?)

Formats the current GameVersion instance into a character span.

public readonly bool TryFormat(Span<byte> utf8Destination, out int bytesWritten, ReadOnlySpan<char> format, IFormatProvider? provider)

Parameters

utf8Destination Span<byte>

The span of UTF-8 characters to which the formatted version string will be written.

bytesWritten int

When this method returns, contains the number of characters that were written to utf8Destination.

format ReadOnlySpan<char>

An optional format specifier.

If it's 'S' or 's', depending on each Major, Minor, Build or Revision field whether it's non-0, then write shorter version as possible.
For Example:
If 3.0.0.0, then write as "3"
If 3.2.0.0, then write as "3.2" and so on.

If it's 'N' or 'n', the "Major.Minor.Build" format is written.
If it's 'F' or 'f', the "Major.Minor.Build.Revision" format is written.

Otherwise or by default, it will automatically write to "Major.Minor.Build.Revision" format if Revision number is defined or "Major.Minor.Build" if not.

provider IFormatProvider

An optional format provider. This parameter is ignored in this implementation.

Returns

bool

true if formatting was successful and the destination span was large enough. Otherwise, false.

Remarks

The formatted version string will be in the form "Major.Minor.Build" or "Major.Minor.Build.Revision" depending on the format specifier.

TryFormat(Span<char>, out int, ReadOnlySpan<char>, IFormatProvider?)

Formats the current GameVersion instance into a character span.

public readonly bool TryFormat(Span<char> destination, out int charsWritten, ReadOnlySpan<char> format, IFormatProvider? provider)

Parameters

destination Span<char>

The span of characters to which the formatted version string will be written.

charsWritten int

When this method returns, contains the number of characters that were written to destination.

format ReadOnlySpan<char>

An optional format specifier.

If it's 'S' or 's', depending on each Major, Minor, Build or Revision field whether it's non-0, then write shorter version as possible.
For Example:
If 3.0.0.0, then write as "3"
If 3.2.0.0, then write as "3.2"
and so on.

If it's 'N' or 'n', the "Major.Minor.Build" format is written.
If it's 'F' or 'f', the "Major.Minor.Build.Revision" format is written.

Otherwise or by default, it will automatically write to "Major.Minor.Build.Revision" format if Revision number is defined or "Major.Minor.Build" if not.

provider IFormatProvider

An optional format provider. This parameter is ignored in this implementation.

Returns

bool

true if formatting was successful and the destination span was large enough. Otherwise, false.

Remarks

The formatted version string will be in the form "Major.Minor.Build" or "Major.Minor.Build.Revision" depending on the format specifier.

TryParse(ReadOnlySpan<byte>, out GameVersion)

Attempts to parse a UTF-8 encoded byte span into a GameVersion instance.

public static bool TryParse(ReadOnlySpan<byte> utf8Text, out GameVersion result)

Parameters

utf8Text ReadOnlySpan<byte>

The UTF-8 encoded byte span representing the version string.

result GameVersion

When this method returns, contains the parsed GameVersion if successful; otherwise, the default value.

Returns

bool

true if parsing was successful; otherwise, false.

TryParse(ReadOnlySpan<byte>, IFormatProvider?, out GameVersion)

Attempts to parse a UTF-8 encoded byte span into a GameVersion instance.

public static bool TryParse(ReadOnlySpan<byte> utf8Text, IFormatProvider? provider, out GameVersion result)

Parameters

utf8Text ReadOnlySpan<byte>

The UTF-8 encoded byte span representing the version string.

provider IFormatProvider

An optional format provider. This parameter is ignored in this implementation.

result GameVersion

When this method returns, contains the parsed GameVersion if successful; otherwise, the default value.

Returns

bool

true if parsing was successful; otherwise, false.

TryParse(ReadOnlySpan<char>, out GameVersion)

Attempts to parse a character span into a GameVersion instance.

public static bool TryParse(ReadOnlySpan<char> versionSpan, out GameVersion result)

Parameters

versionSpan ReadOnlySpan<char>

The character span representing the version.

result GameVersion

When this method returns, contains the parsed GameVersion if successful; otherwise, the default value.

Returns

bool

true if parsing was successful; otherwise, false.

TryParse(ReadOnlySpan<char>, IFormatProvider?, out GameVersion)

Attempts to parse a character span into a GameVersion instance.

public static bool TryParse(ReadOnlySpan<char> versionSpan, IFormatProvider? provider, out GameVersion result)

Parameters

versionSpan ReadOnlySpan<char>

The character span representing the version.

provider IFormatProvider

An optional format provider. This parameter is ignored in this implementation.

result GameVersion

When this method returns, contains the parsed GameVersion if successful; otherwise, the default value.

Returns

bool

true if parsing was successful; otherwise, false.

TryParse(string?, IFormatProvider?, out GameVersion)

Attempts to parse a string into a GameVersion instance.

public static bool TryParse(string? s, IFormatProvider? provider, out GameVersion result)

Parameters

s string

The string representing the version.

provider IFormatProvider

An optional format provider. This parameter is ignored in this implementation.

result GameVersion

When this method returns, contains the parsed GameVersion if successful; otherwise, the default value.

Returns

bool

true if parsing was successful; otherwise, false.

get_Build()

Gets the build component of the version.

public readonly int get_Build()

Returns

int

The build version number.

get_Major()

Gets the major component of the version.

public readonly int get_Major()

Returns

int

The major version number.

get_Minor()

Gets the minor component of the version.

public readonly int get_Minor()

Returns

int

The minor version number.

get_Revision()

Gets the revision component of the version.

public readonly int get_Revision()

Returns

int

The revision version number.

Operators

operator ==(GameVersion?, GameVersion?)

public static bool operator ==(GameVersion? left, GameVersion? right)

Parameters

left GameVersion?
right GameVersion?

Returns

bool

operator ==(GameVersion?, string?)

public static bool operator ==(GameVersion? left, string? right)

Parameters

left GameVersion?
right string

Returns

bool

operator ==(string?, GameVersion?)

public static bool operator ==(string? left, GameVersion? right)

Parameters

left string
right GameVersion?

Returns

bool

operator >(GameVersion?, GameVersion?)

public static bool operator >(GameVersion? left, GameVersion? right)

Parameters

left GameVersion?
right GameVersion?

Returns

bool

operator >=(GameVersion?, GameVersion?)

public static bool operator >=(GameVersion? left, GameVersion? right)

Parameters

left GameVersion?
right GameVersion?

Returns

bool

implicit operator GameVersion(ReadOnlySpan<char>)

public static implicit operator GameVersion(ReadOnlySpan<char> versionCharSpan)

Parameters

versionCharSpan ReadOnlySpan<char>

Returns

GameVersion

implicit operator GameVersion(ReadOnlySpan<int>)

public static implicit operator GameVersion(ReadOnlySpan<int> versionSpan)

Parameters

versionSpan ReadOnlySpan<int>

Returns

GameVersion

implicit operator GameVersion?(string?)

public static implicit operator GameVersion?(string? versionString)

Parameters

versionString string

Returns

GameVersion?

implicit operator GameVersion?(Version?)

public static implicit operator GameVersion?(Version? version)

Parameters

version Version

Returns

GameVersion?

operator !=(GameVersion?, GameVersion?)

public static bool operator !=(GameVersion? left, GameVersion? right)

Parameters

left GameVersion?
right GameVersion?

Returns

bool

operator !=(GameVersion?, string?)

public static bool operator !=(GameVersion? left, string? right)

Parameters

left GameVersion?
right string

Returns

bool

operator !=(string?, GameVersion?)

public static bool operator !=(string? left, GameVersion? right)

Parameters

left string
right GameVersion?

Returns

bool

operator <(GameVersion?, GameVersion?)

public static bool operator <(GameVersion? left, GameVersion? right)

Parameters

left GameVersion?
right GameVersion?

Returns

bool

operator <=(GameVersion?, GameVersion?)

public static bool operator <=(GameVersion? left, GameVersion? right)

Parameters

left GameVersion?
right GameVersion?

Returns

bool