Implement reversible Sentinel beta foundation
All checks were successful
OfficeCom Sentinel Client / validate-client (push) Successful in 23s
OfficeCom Sentinel Client / build-client-windows (push) Successful in 51s

This commit is contained in:
OfficeCom Codex
2026-07-30 01:05:30 +02:00
parent 58ad77242f
commit c3ca95dfa5
21 changed files with 464 additions and 18 deletions

View File

@@ -96,14 +96,23 @@ function Compare-Version {
[Parameter(Mandatory)][string]$Right
)
try {
$leftVersion = [System.Version]$Left
$rightVersion = [System.Version]$Right
return $leftVersion.CompareTo($rightVersion)
}
catch {
return [string]::Compare($Left, $Right, $true)
$pattern = '^(?<version>\d+(?:\.\d+){0,3})(?:-(?<prerelease>.+))?$'
$leftMatch = [regex]::Match($Left, $pattern)
$rightMatch = [regex]::Match($Right, $pattern)
if ($leftMatch.Success -and $rightMatch.Success) {
$numericComparison = ([System.Version]$leftMatch.Groups['version'].Value).CompareTo([System.Version]$rightMatch.Groups['version'].Value)
if ($numericComparison -ne 0) {
return $numericComparison
}
$leftPrerelease = $leftMatch.Groups['prerelease'].Value
$rightPrerelease = $rightMatch.Groups['prerelease'].Value
if ([string]::IsNullOrWhiteSpace($leftPrerelease) -and -not [string]::IsNullOrWhiteSpace($rightPrerelease)) { return 1 }
if (-not [string]::IsNullOrWhiteSpace($leftPrerelease) -and [string]::IsNullOrWhiteSpace($rightPrerelease)) { return -1 }
return [string]::Compare($leftPrerelease, $rightPrerelease, $true)
}
return [string]::Compare($Left, $Right, $true)
}
function Get-Sha256Hex {