YOUSEFUL / DELPHI / COMPONENTS

TAtlasUpdateInfo

The fields of an update manifest: version, download URL, SHA-256 digest and size.

Record Unit Atlas.Updater · Product Atlas UI

Description

Returned by TAtlasWebUpdater.ParseManifest and FetchManifest, already validated, and passed to StageUpdate, which validates it again, so a record filled in code must follow the same rules: a three- or four-part numeric version, an HTTPS URL, a size between 1 and MaximumBytes and a 64-digit hexadecimal digest.

Members

MemberKindWhat it does
VersionfieldThe offered version, for example 1.4.0.
URLfieldWhere StageUpdate downloads the file from.
SHA256fieldThe SHA-256 digest of the file as 64 hexadecimal digits.
SizefieldThe exact length of the file in bytes.

Fields

Version field

Version, URL, SHA256: string;

The offered version, for example 1.4.0. Compare it with TAtlasWebUpdater.CompareVersions.

URL field

Version, URL, SHA256: string;

Where StageUpdate downloads the file from.

SHA256 field

Version, URL, SHA256: string;

The SHA-256 digest of the file as 64 hexadecimal digits. ParseManifest converts it to lower case; StageUpdate compares it ignoring case.

Size field

Size: Int64;

The exact length of the file in bytes.

Examples

Describe an offered update

For a manifest offering version 1.4.0 of 2048 bytes and a current version of 1.3.9, returns Version 1.4.0 is available: 2048 bytes from https://... followed by the start of the digest; for 1.4.0 or later it returns Up to date.

pascal
uses System.SysUtils, Atlas.Updater;

function DescribeUpdate(const ManifestJSON, CurrentVersion: string): string;
var
  Updater: TAtlasWebUpdater;
  Info: TAtlasUpdateInfo;
begin
  Updater := TAtlasWebUpdater.Create(nil);
  try
    Info := Updater.ParseManifest(ManifestJSON);
    if TAtlasWebUpdater.CompareVersions(Info.Version, CurrentVersion) <= 0 then
      Result := 'Up to date'
    else
      Result := Format('Version %s is available: %d bytes from %s, SHA-256 %s...',
        [Info.Version, Info.Size, Info.URL, Copy(Info.SHA256, 1, 12)]);
  finally
    Updater.Free;
  end;
end;

TAtlasWebUpdater

Also in Atlas UI

TAtlasKanbanModel · TAtlasKanban · TAtlasSyntaxMemo · TAtlasWebUpdater