| // Compare two version info Function TMFileVersion.Compare( aVer : TMFileVersion ) : Integer; Var n1, n2 : Cardinal; Begin n1 := ( FMajor SHL 16 ) OR FMinor; With aVer Do n2 := ( FMajor SHL 16 ) OR FMinor; If ( n1 > n2 ) Then Result := 1 Else If ( n1 < n2 ) Then Result := -1 Else Begin n1 := ( FRelease SHL 16 ) OR FBuild; With aVer Do n2 := ( FRelease SHL 16 ) OR FBuild; If ( n1 > n2 ) Then Result := 1 Else IF ( n1 < n2 ) Then Result := -1 Else Result := 0; End; End; // Get/Set property - VerStr Function TMFileVersion.GetVerStr : String; Begin Result := Format( '%d,%.02d,%d,%.02d', [FMajor, FMinor, FRelease, FBuild] ); End; Procedure TMFileVersion.SetVerStr( aVerStr : String ); Var sTemp : TStrings; Begin FMajor := 0; FMinor := 0; FRelease := 0; FBuild := 0; sTemp := TStringList.Create; Try sTemp.CommaText := aVerStr; Try FMajor := StrToInt( sTemp.Strings[0] ); FMinor := StrToInt( sTemp.Strings[1] ); FRelease := StrToInt( sTemp.Strings[2] ); FBuild := StrToInt( sTemp.Strings[3] ); Except // Do nothing End; Finally sTemp.Free; End; End; |