C# Class Octopus.Client.Model.Versioning.StrictSemanticVersion

Show file Open project: OctopusDeploy/Octo.exe Class Usage Examples

Public Methods

Method Description
Parse ( string value ) : StrictSemanticVersion

Parses a SemVer string using strict SemVer rules.

StrictSemanticVersion ( StrictSemanticVersion version ) : System

Creates a SemanticVersion from an existing SemanticVersion

StrictSemanticVersion ( int major, int minor, int patch ) : System

Creates a SemanticVersion X.Y.Z

StrictSemanticVersion ( int major, int minor, int patch, IEnumerable releaseLabels, string metadata ) : System

Creates a NuGetVersion X.Y.Z-alpha.1.2#build01

StrictSemanticVersion ( int major, int minor, int patch, string releaseLabel ) : System

Creates a NuGetVersion X.Y.Z-alpha

StrictSemanticVersion ( int major, int minor, int patch, string releaseLabel, string metadata ) : System

Creates a NuGetVersion X.Y.Z-alpha#build01

TryParse ( string value, StrictSemanticVersion &version ) : bool

Parse a version string

Protected Methods

Method Description
StrictSemanticVersion ( System.Version version, IEnumerable releaseLabels, string metadata, bool preserveMissingComponents = false ) : System
StrictSemanticVersion ( System.Version version, string releaseLabel = null, string metadata = null ) : System
StrictSemanticVersion ( int major, int minor, int patch, int revision, IEnumerable releaseLabels, string metadata ) : System
StrictSemanticVersion ( int major, int minor, int patch, int revision, string releaseLabel, string metadata ) : System

Private Methods

Method Description
IsLetterOrDigitOrDash ( char c ) : bool
IsValid ( string s, bool allowLeadingZeros ) : bool
IsValidPart ( char chars, bool allowLeadingZeros ) : bool
IsValidPart ( string s, bool allowLeadingZeros ) : bool
NormalizeVersionValue ( System.Version version ) : System.Version
ParseReleaseLabels ( string releaseLabels ) : IEnumerable
ParseSections ( string value ) : Tuple

Parse the version string into version/release/build The goal of this code is to take the most direct and optimized path to parsing and validating a semver. Regex would be much cleaner, but due to the number of versions created in NuGet Regex is too slow.

Method Details

Parse() public static method

Parses a SemVer string using strict SemVer rules.
public static Parse ( string value ) : StrictSemanticVersion
value string
return StrictSemanticVersion

StrictSemanticVersion() public method

Creates a SemanticVersion from an existing SemanticVersion
public StrictSemanticVersion ( StrictSemanticVersion version ) : System
version StrictSemanticVersion
return System

StrictSemanticVersion() protected method

protected StrictSemanticVersion ( System.Version version, IEnumerable releaseLabels, string metadata, bool preserveMissingComponents = false ) : System
version System.Version
releaseLabels IEnumerable
metadata string
preserveMissingComponents bool
return System

StrictSemanticVersion() protected method

protected StrictSemanticVersion ( System.Version version, string releaseLabel = null, string metadata = null ) : System
version System.Version
releaseLabel string
metadata string
return System

StrictSemanticVersion() public method

Creates a SemanticVersion X.Y.Z
public StrictSemanticVersion ( int major, int minor, int patch ) : System
major int X.y.z
minor int x.Y.z
patch int x.y.Z
return System

StrictSemanticVersion() public method

Creates a NuGetVersion X.Y.Z-alpha.1.2#build01
public StrictSemanticVersion ( int major, int minor, int patch, IEnumerable releaseLabels, string metadata ) : System
major int X.y.z
minor int x.Y.z
patch int x.y.Z
releaseLabels IEnumerable Release labels that have been split by the dot separator
metadata string Build metadata
return System

StrictSemanticVersion() protected method

protected StrictSemanticVersion ( int major, int minor, int patch, int revision, IEnumerable releaseLabels, string metadata ) : System
major int
minor int
patch int
revision int
releaseLabels IEnumerable
metadata string
return System

StrictSemanticVersion() protected method

protected StrictSemanticVersion ( int major, int minor, int patch, int revision, string releaseLabel, string metadata ) : System
major int
minor int
patch int
revision int
releaseLabel string
metadata string
return System

StrictSemanticVersion() public method

Creates a NuGetVersion X.Y.Z-alpha
public StrictSemanticVersion ( int major, int minor, int patch, string releaseLabel ) : System
major int X.y.z
minor int x.Y.z
patch int x.y.Z
releaseLabel string Prerelease label
return System

StrictSemanticVersion() public method

Creates a NuGetVersion X.Y.Z-alpha#build01
public StrictSemanticVersion ( int major, int minor, int patch, string releaseLabel, string metadata ) : System
major int X.y.z
minor int x.Y.z
patch int x.y.Z
releaseLabel string Prerelease label
metadata string Build metadata
return System

TryParse() public static method

Parse a version string
public static TryParse ( string value, StrictSemanticVersion &version ) : bool
value string
version StrictSemanticVersion
return bool