Jump to content
Sign in to follow this  
andyswarbs

Version dependency calculator

Recommended Posts

andyswarbs

; _IsVer1GEVer2                         Returns true if $ver1 is greater than or equal to $ver2.  Both versions are of the form a.b.c.d, where a,b,c&d are integers.
; @error =1 if $ver1 is not stuctured properly
; @error =2 if $ver2 is not stuctured properly
; @error =3 if the abcd components are not proper integers.
Func _IsVer1GEVer2($ver1,$ver2)
    Local $arr1[5],$arr2[5]
    Local $n11,$n12,$n13,$n14
    Local $n21,$n22,$n23,$n24
    Local $ntot
;
    $arr1=StringSplit($ver1,'.')
    If $arr1[0] <> 5 Then
        SetError(1)
        Return False
    EndIf
    $arr2=StringSplit($ver2,'.')
    If $arr2[0] <> 5 Then
        SetError(2)
        Return False
    EndIf
;
    $ntot=IsInt($n11)+IsInt($n12)+IsInt($n13)+IsInt($n14)+IsInt($n21)+IsInt($n22)+IsInt($n23)+IsInt($n24)
    If $ntot<>8 Then
        SetError(3)
        Return False
    EndIf
;
    $n11=$arr1[1]
    $n12=$arr1[2]
    $n13=$arr1[3]
    $n14=$arr1[4]
;
    $n21=$arr2[1]
    $n22=$arr2[2]
    $n23=$arr2[3]
    $n24=$arr2[4]
;
    If $n11>=$n21 And $n12>=$n22 And $n13>=$n23 And $n14>=$n24 Then Return True
    Return False
EndFunc; _IsVer1GEVer2

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.