mirror of
https://github.com/gwdevhub/Daybreak.git
synced 2026-07-21 01:59:49 +00:00
159928f24b
* Integrate builds with Focus view Detect when GameData is invalid Detect when reading memory is faulty Show current character data in Focus View Closes #161 Closes #162 Closes #163 * Increment version * Bugfix version comparison script
48 lines
1.7 KiB
PowerShell
48 lines
1.7 KiB
PowerShell
Param(
|
|
[Parameter(Mandatory=$true)]
|
|
[string]$currentVersion,
|
|
[Parameter(Mandatory=$true)]
|
|
[string]$lastVersion
|
|
)
|
|
|
|
if ($currentVersion.StartsWith("v")){
|
|
$currentVersion = $currentVersion.Substring(1)
|
|
}
|
|
|
|
if ($lastVersion.StartsWith("v")){
|
|
$lastVersion = $lastVersion.Substring(1)
|
|
}
|
|
|
|
$currentVersionTokens = $currentVersion.Split('.')
|
|
$lastVersionTokens = $lastVersion.Split('.')
|
|
if ($currentVersionTokens.Length -eq $lastVersionTokens.Length)
|
|
{
|
|
for($i = 0 ; $i -lt $currentVersionTokens.Length; $i++)
|
|
{
|
|
$currentVersionToken = [int]$currentVersionTokens[$i]
|
|
$lastVersionToken = [int]$lastVersionTokens[$i]
|
|
if ($currentVersionToken -lt $lastVersionToken){
|
|
throw "Version is not incremented. Current version " + $currentVersion + ". Last version " + $lastVersion
|
|
}
|
|
}
|
|
|
|
if ($currentVersionToken -le $lastVersionToken){
|
|
throw "Version is not incremented. Current version " + $currentVersion + ". Last version " + $lastVersion
|
|
}
|
|
|
|
Write-Host "Version has been incremented"
|
|
}
|
|
elseif ($currentVersionTokens.Length -gt $lastVersionTokens.Length){
|
|
if ($currentVersionTokens[$lastVersionTokens.Length - 1] -lt $lastVersionTokens[$lastVersionTokens.Length - 1]){
|
|
throw "Version is not incremented. Current version " + $currentVersion + ". Last version " + $lastVersion
|
|
}
|
|
|
|
Write-Host "Version has been incremented"
|
|
}
|
|
elseif ($currentVersionTokens.Length -lt $lastVersionTokens.Length){
|
|
if ($currentVersionTokens[$currentVersionTokens.Length - 1] -le $lastVersionTokens[$currentVersionTokens.Length - 1]){
|
|
throw "Version is not incremented. Current version " + $currentVersion + ". Last version " + $lastVersion
|
|
}
|
|
|
|
Write-Host "Version has been incremented"
|
|
} |