Class TAutoUpdater

Unit

Declaration

type TAutoUpdater = class(TObject)

Description

auto update class

How to use it:

Version format:

#
    <?xml version="1.0" encoding="iso-8859-1"?>
    <versions>
      <stable value="an integer like describe above"/>
    </versions>
    #

Changelog format:

#
  <?xml version="1.0" encoding="UTF-8"?>
  <?xml-stylesheet type="text/xsl" href="changelog.xsl"?>
  <changelog program="*Your program name here*">
  <build version="*version number*" date="e.g. 2008-11-07">
    <download url="*url to installer*" platform="..." execute="..." restart=".."/>
    <download url="*url to installer*" platform="..." execute="..." restart=".."/>
    ...
    <fix level="minor">minor fix</fix>
    <fix level="major">major fix</fix>
    <fix level="critical" xml:lang="...only in one language.."">critical fix</fix>
    ..
    <add level="minor">minor fix</add>
    ..
    <change level="minor">minor fix</change>
    ..

    <trans xml:lang="..">
      ... <add/fix/change/.../>
    </trans>
  </build>
   ...
  </changelog>
  #

The file need a <build> with the same version as the version given in the version file and this build need at least one <download> with a given url and the same platform this unit was compiled one.

platform can be LINUX, WINDOWS, LINUX32, LINUX64, WIN32, WIN64, BSD, BSD32 or BSD6 4 (if there are several downloads with a matching platform it is undefined which on will be downloaded)

execute is the command line which should be executed after downloading the update (default '"$DOWNLOAD"'). $INSTALLPATH and $OLDVERSION will be replaced by the values passed to the constructor, $OLDPATH and $OLDFILE will be replaced by the value of paramstr(0), $DOWNLOAD will be replaced by the file just downloaded
Set execute to '' if the downloaded file is not executable
restart determines if the application should restart after executing the installer (default true)

You can have multiple build, download, fix, add, change tags in a file fix/add/change and the level-properties are only used to show details, but the xsl will highlight it correspondly

Notice that these files will not be parsed with an xml parser, but with an html parser. (=>no validation and cdata tags are unknown)

You have to set internetaccess.defaultInternetAccessClass to either TW32InternetAccess or TSynapseInternetAccess

Hierarchy

Overview

Fields

Public language: string;

Methods

Public constructor create(currentVersion:TVersionNumber;installDir,versionsURL,changelogURL: string);
Public function hasDirectoryWriteAccess:boolean;
Public function canRunInstaller: boolean;
Public function existsUpdate:boolean;
Public function listChanges:string;
Public procedure downloadUpdate(tempDir:string='');
Public procedure installUpdate;
Public procedure openFileBrowser;
Public destructor destroy; override;

Properties

Public property newestVersion: TVersionNumber read fnewversion;
Public property needRestart: boolean read _needRestart;
Public property installerCmd: string read getInstallerCommand;
Public property downloadedFileName: string read GetInstallerDownloadedFileName;

Description

Fields

Public language: string;
 

Methods

Public constructor create(currentVersion:TVersionNumber;installDir,versionsURL,changelogURL: string);
 
Public function hasDirectoryWriteAccess:boolean;

check if the user can write in the application directory and is therefore able to install the update.

Public function canRunInstaller: boolean;

check if the installer can be run (on linux it depends on write access, on windows it can always run)

Public function existsUpdate:boolean;

checks if an update exists

Public function listChanges:string;

returns a list of the performed changes

Public procedure downloadUpdate(tempDir:string='');

download update to tempDir

Public procedure installUpdate;

call installer

Public procedure openFileBrowser;

opens the file browser for the directory the update was saved (in case it cannot be run as installer)

Public destructor destroy; override;
 

Properties

Public property newestVersion: TVersionNumber read fnewversion;
 
Public property needRestart: boolean read _needRestart;
 
Public property installerCmd: string read getInstallerCommand;
 
Public property downloadedFileName: string read GetInstallerDownloadedFileName;
 

Generated by PasDoc 0.16.0.