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
versionReadOnlySpan<char>
GameVersion(params ReadOnlySpan<int>)
public GameVersion(params ReadOnlySpan<int> ver)
Parameters
verReadOnlySpan<int>
GameVersion(string?)
public GameVersion(string? version)
Parameters
versionstring
GameVersion(Version)
public GameVersion(Version version)
Parameters
versionVersion
Fields
Build
public readonly int Build
Field Value
Empty
public static readonly GameVersion Empty
Field Value
Major
public readonly int Major
Field Value
Minor
public readonly int Minor
Field Value
Revision
public readonly int Revision
Field Value
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
Methods
AsSpan()
public ReadOnlySpan<int> AsSpan()
Returns
Equals(GameVersion)
Indicates whether the current object is equal to another object of the same type.
public readonly bool Equals(GameVersion other)
Parameters
otherGameVersionAn object to compare with this object.
Returns
Equals(IVersion?)
Indicates whether the current object is equal to another object of the same type.
public readonly bool Equals(IVersion? other)
Parameters
otherIVersionAn object to compare with this object.
Returns
Equals(object?)
Indicates whether this instance and a specified object are equal.
public override readonly bool Equals(object? obj)
Parameters
objobjectThe object to compare with the current instance.
Returns
- bool
true if
objand 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
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
utf8TextReadOnlySpan<byte>The UTF-8 encoded byte span representing the version string.
providerIFormatProviderAn 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
sReadOnlySpan<char>The character span representing the version.
providerIFormatProviderAn 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
sstringThe string representing the version.
providerIFormatProviderAn 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
ToString(string?, IFormatProvider?)
Create a string representation of GameVersion.
public readonly string ToString(string? format, IFormatProvider? formatProvider = null)
Parameters
formatstringAn 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.
formatProviderIFormatProviderA 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
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
utf8DestinationSpan<byte>The span of UTF-8 characters to which the formatted version string will be written.
bytesWrittenintWhen this method returns, contains the number of characters that were written to
utf8Destination.formatReadOnlySpan<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.
providerIFormatProviderAn optional format provider. This parameter is ignored in this implementation.
Returns
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
destinationSpan<char>The span of characters to which the formatted version string will be written.
charsWrittenintWhen this method returns, contains the number of characters that were written to
destination.formatReadOnlySpan<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.
providerIFormatProviderAn optional format provider. This parameter is ignored in this implementation.
Returns
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
utf8TextReadOnlySpan<byte>The UTF-8 encoded byte span representing the version string.
resultGameVersionWhen this method returns, contains the parsed GameVersion if successful; otherwise, the default value.
Returns
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
utf8TextReadOnlySpan<byte>The UTF-8 encoded byte span representing the version string.
providerIFormatProviderAn optional format provider. This parameter is ignored in this implementation.
resultGameVersionWhen this method returns, contains the parsed GameVersion if successful; otherwise, the default value.
Returns
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
versionSpanReadOnlySpan<char>The character span representing the version.
resultGameVersionWhen this method returns, contains the parsed GameVersion if successful; otherwise, the default value.
Returns
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
versionSpanReadOnlySpan<char>The character span representing the version.
providerIFormatProviderAn optional format provider. This parameter is ignored in this implementation.
resultGameVersionWhen this method returns, contains the parsed GameVersion if successful; otherwise, the default value.
Returns
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
sstringThe string representing the version.
providerIFormatProviderAn optional format provider. This parameter is ignored in this implementation.
resultGameVersionWhen this method returns, contains the parsed GameVersion if successful; otherwise, the default value.
Returns
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
leftGameVersion?rightGameVersion?
Returns
operator ==(GameVersion?, string?)
public static bool operator ==(GameVersion? left, string? right)
Parameters
leftGameVersion?rightstring
Returns
operator ==(string?, GameVersion?)
public static bool operator ==(string? left, GameVersion? right)
Parameters
leftstringrightGameVersion?
Returns
operator >(GameVersion?, GameVersion?)
public static bool operator >(GameVersion? left, GameVersion? right)
Parameters
leftGameVersion?rightGameVersion?
Returns
operator >=(GameVersion?, GameVersion?)
public static bool operator >=(GameVersion? left, GameVersion? right)
Parameters
leftGameVersion?rightGameVersion?
Returns
implicit operator GameVersion(ReadOnlySpan<char>)
public static implicit operator GameVersion(ReadOnlySpan<char> versionCharSpan)
Parameters
versionCharSpanReadOnlySpan<char>
Returns
implicit operator GameVersion(ReadOnlySpan<int>)
public static implicit operator GameVersion(ReadOnlySpan<int> versionSpan)
Parameters
versionSpanReadOnlySpan<int>
Returns
implicit operator GameVersion?(string?)
public static implicit operator GameVersion?(string? versionString)
Parameters
versionStringstring
Returns
implicit operator GameVersion?(Version?)
public static implicit operator GameVersion?(Version? version)
Parameters
versionVersion
Returns
operator !=(GameVersion?, GameVersion?)
public static bool operator !=(GameVersion? left, GameVersion? right)
Parameters
leftGameVersion?rightGameVersion?
Returns
operator !=(GameVersion?, string?)
public static bool operator !=(GameVersion? left, string? right)
Parameters
leftGameVersion?rightstring
Returns
operator !=(string?, GameVersion?)
public static bool operator !=(string? left, GameVersion? right)
Parameters
leftstringrightGameVersion?
Returns
operator <(GameVersion?, GameVersion?)
public static bool operator <(GameVersion? left, GameVersion? right)
Parameters
leftGameVersion?rightGameVersion?
Returns
operator <=(GameVersion?, GameVersion?)
public static bool operator <=(GameVersion? left, GameVersion? right)
Parameters
leftGameVersion?rightGameVersion?