UpdateVer,LoaclVer分别为二个IP
function CompareIP(UpdateVer: string; LocalVer: string): Boolean;
var
uver, lver: Integer;
begin
if Pos('.', UpdateVer) > 0 then
uver := StrToInt(Copy(UpdateVer, 1, Pos('.', UpdateVer) - 1))
else
uver := StrToInt(UpdateVer);
if Pos('.', LocalVer) > 0 then
lver := StrToInt(Copy(LocalVer, 1, Pos('.', LocalVer) - 1))
else
lver := StrToInt(LocalVer);
if uver > lver then
begin
Result := True;
Exit;
end
else
if uver < lver then
begin
Result := False;
Exit;
end;
if Pos('.', UpdateVer) = 0 then
begin
Result := False;
Exit;
end;
Delete(UpdateVer, 1, Pos('.', UpdateVer));
Delete(LocalVer, 1, Pos('.', LocalVer));
Result := CompareIP(UpdateVer, LocalVer);
end;