Skip to content

Commit

Permalink
Adjustment in CheckForUpdate
Browse files Browse the repository at this point in the history
  • Loading branch information
dpradov committed Mar 7, 2024
1 parent 7bb58e0 commit cc526f1
Showing 1 changed file with 17 additions and 14 deletions.
31 changes: 17 additions & 14 deletions general/kn_UpdateVersion.pas
Expand Up @@ -98,20 +98,23 @@ function IsLaterVersion(const CurrentVersion, NewVersion: string): Boolean;
StrsC, StrsL: TStrings;
begin
Result:= false;
if (CurrentVersion = NewVersion) or (NewVersion = '') then exit;
if (CurrentVersion = NewVersion) or (NewVersion = '') or (CurrentVersion = '') then exit;

StrsC:= TStringList.Create;
StrsL:= TStringList.Create;
try
SplitString(StrsC, CurrentVersion, '.', false);
SplitString(StrsL, NewVersion, '.', false);
for i := 0 to StrsC.Count - 1 do begin
if StrToInt(StrsC[i]) < StrToInt(StrsL[i]) then
Exit(true);
StrsC:= TStringList.Create;
StrsL:= TStringList.Create;
try
SplitString(StrsC, CurrentVersion, '.', false);
SplitString(StrsL, NewVersion, '.', false);
for i := 0 to StrsC.Count - 1 do begin
if StrToInt(StrsC[i]) < StrToInt(StrsL[i]) then
Exit(true);
end;
finally
StrsC.Free;
StrsL.Free;
end;
finally
StrsC.Free;
StrsL.Free;
except
end;
end;

Expand Down Expand Up @@ -241,11 +244,11 @@ function CheckForUpdate (ShowOnlyIfNewVersionToNotify: boolean): boolean;
LastInformedVersion:= KeyOptions.LastInformedVersion;

try
KeyOptions.VersionLastChecked := Today();
newVersionToNotify:= GetLatestVersionInfo (KeyOptions.LastInformedVersion, CurrentVersion, Changes, not ShowOnlyIfNewVersionToNotify, WithoutInternetAccess);
if ShowOnlyIfNewVersionToNotify and not newVersionToNotify then begin
KeyOptions.VersionLastChecked := Today();

if ShowOnlyIfNewVersionToNotify and not newVersionToNotify then
exit;
end;

UV := TUpdateVersion.Create( Application );
try
Expand Down

0 comments on commit cc526f1

Please sign in to comment.