Class VersionHelper
- Namespace
- OpenSettings.Helpers
- Assembly
- OpenSettings.dll
Provides helper methods for parsing version strings and calculating version scores. Supports both stable versions and preview versions, and helps to compare versions.
public static class VersionHelper
- Inheritance
-
VersionHelper
- Inherited Members
Methods
GetPackInfo(Assembly)
Retrieves version information from an assembly, including its version score and whether it's a preview version. Extracts the version from the assembly's informational version attribute.
public static (string PackVersion, long Score, bool IsPreview) GetPackInfo(this Assembly assembly)
Parameters
assembly
AssemblyThe assembly from which to retrieve the version information.
Returns
- (string PackVersion, long Score, bool IsPreview)
A tuple containing the pack version string, the pack version's score (long), and a boolean indicating if it's a preview version.
Exceptions
- ArgumentException
Thrown if the version format is invalid or no version is found.
GetPackInfo(string)
Parses a version string and calculates its corresponding score. Determines whether the version is a preview version or a stable version.
public static (long Score, bool IsPreview) GetPackInfo(string packVersion)
Parameters
packVersion
stringThe version string to parse. Can be in the format 'major.minor.patch' for stable versions or 'major.minor.patch-preview.previewNo.runNo.runAttempt' for preview versions.
Returns
- (long Score, bool IsPreview)
A tuple with the pack version score (long) and a boolean indicating if it's a preview version.
Exceptions
- ArgumentException
Thrown if the version format is invalid.