TMS WebUpdate developers guide.pdf

(200 KB) Pobierz
Microsoft Word - TWUPDATE.doc
TMS SOFTWARE
TWEBUPDATE
DEVELOPERS GUIDE
TWEBUPDATE
DEVELOPERS GUIDE
March 2005
Copyright © 1998 – 2005 by tmssoftware.com bvba
Web: http://www.tmssoftware.com
Email : info@tmssoftware.com
1
712012053.005.png
TMS SOFTWARE
TWEBUPDATE
DEVELOPERS GUIDE
Table of contents
TWebUpdate availability .....................................................................................3
TWebUpdate use ...............................................................................................3
TWebUpdate organisation ....................................................................................3
TWebUpdate setup and methods............................................................................3
TWebUpdate control file .....................................................................................8
TWebUpdate control file examples ....................................................................... 13
Using UpdateBuilder ......................................................................................... 15
Using TWebUpdateWizard .................................................................................. 17
Writing custom TWebUpdateWizard translation components ........................................ 18
2
712012053.006.png
TMS SOFTWARE
TWEBUPDATE
DEVELOPERS GUIDE
TWebUpdate availability
WebUpdate is available as VCL component for Win32 application development.
VCL versions:
TWebUpdate is available for Borland  Delphi 5, 6, 7, 2005 and Borland  C++Builder 5, 6
TWebUpdate use
The TMS TWebUpdate component is designed to make distribution of application updates easier.
TWebUpdate can handle network file transfer, FTP or HTTP based distribution methods. Formats for
distributing updates can be LZ compressed files, CAB files, patch difference files and normal files.
The application updates can consist of one or multiple executable files as well as other application
related data files. A high degree of customization is possible in the setup of the update process. For
easy of use, a WebUpdate Wizard is included as well as an UpdateBuilder that creates update
process control files.
TWebUpdate organisation
The application update process happens in several steps. Step 1 is obtaining the control file (.INF
file) from a network, FTP or HTTP based location. The next step is the processing of the .INF file by
verifying new files, new actions, new versions and if necessary downloading the files. Update files
that are not part of the executable running process (.EXE, .DLL’s) can be immediately extracted to
the proper location. If necessary, in the last step, the application is closed, the new EXE and/or DLL
files are extracted and the application new version is automatically restarted.
This update process can run automatically or steered programmatically through the TWebUpdate
component. As an alternative, the TWebUpdateWizard can be used that is a user-friendly front-end
for guiding the user through the update process.
For internet based updates, TWebUpdate is based on the Microsoft WinInet API, available in Win 95
OSRB, Win 98, Win 98SE, Win ME, Windows 2000, Windows XP and Windows 2003.
TWebUpdate setup and methods
Setting the update distribution type
The main selection for TWebUpdate is the distribution method: network, FTP or HTTP based. This is
set with the property TWebUpdate.UpdateType : httpUpdate, ftpUpdate, fileUpdate.
In case of FTP and HTTP update distributions, an Internet connection is required. For machines
connecting through dial-up, TWebUpdate can automatically try to establish an internet connection.
This is controlled by TWebUpdate.UpdateConnect. Various scenarios are possible: not trying to
connect, try to connect with prompt, try to silently connect and try to establish a connection with
and without automatic hangup.
3
712012053.007.png 712012053.008.png
TMS SOFTWARE
TWEBUPDATE
DEVELOPERS GUIDE
TWebUpdate can prompt for each file to download, prompt once for first file or download all files
silently. The TWebUpdate.UpdateUpdate property controls this.
Setting the update distribution location for network file based updates
For network file based updates, this is set with the URL property, ie:
\\networkserver\sharename\controlfile.inf
Setting the update distribution location for HTTP based updates
For HTTP based updates, this is also set with the URL property, ie:
http://www.myserver.com/myupdatefolder/controlfile.inf
Note that no proxy information should be set by default. TWebUpdate uses by default the proxy
information as setup in Internet Explorer. If the update is located on a password protected website,
the username and password must be set with:
UserID: website login username
Password: website login password
If username & password cannot be set to a fixed value, TWebUpdate can prompt for this.
Setting TWebUpdate.Authentication to waAlways will cause the TWebUpdate to prompt for
username and password. If TWebUpdate.Authentication is set to waAuto, TWebUpdate will only
prompt if it finds a password protected website.
Two additional options HTTPKeepAliveAuthentication and ProxyUserID, ProxyUserPassword can be
set when required.
Setting the update distribution location for FTP based updates
For FTP based updates, the update control file name is set with the URL property but in addition,
the FTP server specifications and login details must be set with:
Host: sets the FTP server name
Port: sets the FTP server port
UserID: FTP login username
Password: FTP login password
FTPDirectory: folder on FTP server where update is located
FTPPassive: true when PASV FTP mode needs to be used
4
712012053.001.png 712012053.002.png
TMS SOFTWARE
TWEBUPDATE
DEVELOPERS GUIDE
Controlling the update process
Once TWebUpdate is setup for the correct update distribution type, several methods and events are
available for starting and controlling the update process.
The full update process is started by
TWebUpdate.DoUpdate; (this performs the update in the main application thread)
or
TWebUpdate.DoThreadUpdate; (this performs the update in a separate thread)
If only a check is required if a new version is available, this can be done with the function:
TWebUpdate.NewVersionAvailable: Boolean;
Using the TWebUpdateWizard
The TWebUpdateWizard provides a user-friendly front-end to guide the user through the update
process. To use the TWebUpdateWizard, drop the component on the form, connect the TWebUpdate
component to its WebUpdate property and if required, connect a TWebUpdateWizardLanguage
component to its language property. Start the wizard by calling TWebUpdateWizard.Execute;
Events during the update process
During the update process, various events are triggered that can be used to steer and monitor the
update.
OnBeforeFileDownload (Sender: TObject; FileIdx: Integer; FileDescription: String; var URL: String);
Event triggered before a file is downloaded. The event returns the URL of the file and allows that
the URL is dynamically changed through this event. FileIdx is the index of the file to be
downloaded, FileDescription is the description found in the update control file. URL is the location
found in the control file and can be dynamically changed.
OnFileNameFromURL (Sender: TObject; URL: String; var FName: String);
Event triggered to allow dynamically changing a download filename to another filename. If the URL
would be http://www.myserver.com/myfile.cab , the download will automatically be named
myfile.cab. My using the OnFileNameFromURL event, this can be dynamically renamed to another
filename.
5
712012053.003.png 712012053.004.png
Zgłoś jeśli naruszono regulamin