Using ASTA binary patch technology with TWebUpdate

The ASTA binary patch utility can be attached to the TWebUpdate.Utility property to be used automatically for applying the binary patch files to existing files. When an instance of the TAstaPatchUtility is assigned to the TWebUpdate.Utility property, files downloaded with the .PAT extension are automatically treated as binary patches and the ASTA patch utility is used to create the new version from the existing version and the patch file. When this TAstaPatchUtility is not used, it is required that the ASTA patcher.exe utility is in the current working directory of the application.

The ASTA binary patch software can be found
here
For a limited time, ASTA Technology provides a free registration for TWebUpdate v1.4 with the ASTA Binary Patcher software.


Using the ASTA patch utility with TWebUpdate

1) Using a binary patch file for updating the running application with an ASTA binary patch

Use the ASTA application AstaBinaryPatcher to create a patch file for the difference between the new version and the current version of the application. Choose a filename for the patch file with extension .PAT.

The following sample .INF file, instructs the application to download its update by a ASTA patch file, apply this patch file
and restart the application.

[update]
date=2/4/2001 ' it is a date based update

[files]
count=1 'one file to download, see under file1

[file1]
url=c:\newapp\patchsample.pat 'it is a file based patch update distribution, a full URL can be here as well

[application]
appupdate=1 'this is an application update
appname=patchsample.exe 'name of application to restart after update
appcomps=patchsample.pat 'patch file to apply to current running application


A sample application can be downloaded here that used a file based update (the update control file and binary patch file are in the directory
C:\NEWAPP and the application of 486kb updates itself to the new version with the ASTA binary patch file of 6kb.

 

2) Using a binary patch file for updating other files

Again, use the ASTA application AstaBinaryPatcher to create binary patch files for the difference between the new version of the files and the current version. Choose a filename for the patch file with extension .PAT. When the TWebUpdate.ApplyPatch property is true, the binary patches will be applied automatically by TWebUpdate during the update process. If ApplyPatch is false, the patch can be applied in a custom way. The .PAT file extension is used to detect if the downloaded file is an ASTA binary patch file. As this patch file can be applied to any type of file, the "localversion" entry in the .INF file indicates to which current version file this patch must be applied. Following sample .INF file, makes it clear how a patch file can be applied to upgrade an Access file.

[update]
date=2/4/2001 'it is a date based update

[files]
count=2

[file1]
url=c:\newapp\cars.pat ''it is a file based patch update distribution, a full URL can be here as well
localversion=cars.mdb 'apply the patch to this local file

[file2]
url=c:\newapp\customers.pat ''it is a file based patch update distribution, a full URL can be here as well
localversion=customers.mdb 'apply the patch to this local file

[application]
appupdate=0 'no application update

When TWebUpdate.ApplyPatch is true, the cars.pat binary patch file will be applied to the current cars.mdb file to create a new version of this file. Note that when ApplyPatch is true, the downloaded binary patches will be applied to the currently used files. In case these files are open, this might cause problems. When applying these to database files for example, make sure to close connections to these databases first before calling TWebUpdate.DoUpdate. The sample application also shows this technique.


A sample application can be downloaded here that used a file based update (the update control file and binary patch file are in the directory
C:\NEWAPP and the application updates its database 170Kb MDB file (with a new version that has 2 new records) with the 1.9kb ASTA binary patch file.