Table of Contents

Struct FileVersionQuad

Namespace
Ubiquity.NET.Versioning
Assembly
Ubiquity.NET.Versioning.dll

Represents a traditional "File" version QUAD of 16bit values

public readonly record struct FileVersionQuad : IComparable<FileVersionQuad>, IComparisonOperators<FileVersionQuad, FileVersionQuad, bool>, IEqualityOperators<FileVersionQuad, FileVersionQuad, bool>, IEquatable<FileVersionQuad>
Implements
Inherited Members

Remarks

The "FILEVERSION" structure was first used in Windows as part of the Resource compiler's "VERSION" information (Still used to this day). However, it's use in other places exists and has grown as it is simple, and naturally fits (maps to) an unsigned 64bit value. Thus, CSemVer defines a specific mapping of values to this common format.

A standard .NET Version is very similar except that the bit width of each field is larger AND they are signed values. That is, every FileVersionQuad can produce a valid .NET Version. However, not every Version can result in a valid FileVersionQuad.

A file version is a quad of 4 ushort values. This is convertible to a ulong in the following pattern: (bits are numbered with MSB as the highest numeric value [Actual byte ordering depends on platform endianess])

FieldDescription
bits 48-63 Major part of Build number
bits 32-47 Minor part of Build number
bits 16-31 Build part of Build number
bits 0-15 Revision part of Build number (LSB indicates a release/CI build see remarks section for details)
important

The role of the LSB for the Revision field is confusing as it indicates a CI build or not which itself is confusing. A CI build occurs AFTER a release! CI builds are ordered AFTER a release (or for a pre-release based on time only [0.0.0]). That is, a CI build ***always*** has a Patch+1 of a released build or [Major.Minor.Patch] == [0.0.0].

A file version cast as a ulong is NOT the same as an Ordered version number. The file version includes a "bit" for the status as a CI Build. Thus, a "file version" as a ulong is the ordered version shifted left by one bit and the LSB indicates if it is a Release/CI build

Constructors

FileVersionQuad(ushort, ushort, ushort, ushort)

Represents a traditional "File" version QUAD of 16bit values

Properties

Build

Build version number

IsCiBuild

Gets a value indicating whether this version is a CI build

Major

Major version number

Minor

Minor version number

Revision

Revision number

Methods

CompareTo(FileVersionQuad)

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.

From(ulong)

Converts a version integral value into a FileVersionQuad

From(Version)

Converts a Version value to a FileVersionQuad if possible

ToOrderedVersion()

Gets the CSemVer defined ordered version number for this FileVersion quad

ToOrderedVersion(out bool)

Gets the CSemVer defined ordered version number for this FileVersion quad

ToString()

Converts this instance to a dotted string form

ToUInt64()

Gets the UInt64 representation of the version

ToVersion()

Converts this instance to a Version

Operators

operator >(FileVersionQuad, FileVersionQuad)

Compares two values to determine which is greater.

operator >=(FileVersionQuad, FileVersionQuad)

Compares two values to determine which is greater or equal.

operator <(FileVersionQuad, FileVersionQuad)

Compares two values to determine which is less.

operator <=(FileVersionQuad, FileVersionQuad)

Compares two values to determine which is less or equal.

See Also