呵呵,前几天刚做了这个东西,我的工作是志:
本准备一个星期做完的在线升级系统,没想到出奇的顺利,一天就全部搞定它了。我有一个好习惯在做一个新东西时,会到网上查相关资料,到BBS里去搜帖子,查看别人的实现方式,不外两种基本方式:一、从FTP下载最新文件覆盖本地旧文件,二、从网站上直接下载文件更新系统。看到有几个人都提到一个叫 AutoUpgrader Pro的第三方控件,不管好不好使,先把装起来溜溜再说。AutoUpgrader ProAutoUpgrader Pro是乌克兰首都基辅一个公司的产品(http://www.appcontrols.com/about.html),该控件提供13种语言的支持,我想应该也是比较牛公司吧,安装时发该控件包里没有一个源代码,只有DCU文件,不提供源代码的东西我从来是不用的,看在别人建议的份上,试试再说吧。花了一些时间读了帮助系统后,开始使用,发现AutoUpgrader Pro确实使用非常方便正向他所的那样“The AutoUpgrader will check your website for the newer releases of your software and, if the newer version is available ?it will download and update all files of your application "on the fly". All this without a SINGLE LINE of code!” ,设置相关参数后,只要一句AutoUpgraderPro1.CheckUpdate ;就可以做到在线升级。方便是方便,但是作为AutoUpgrader Pro这么为人知晓的产品,却存在致命的缺陷,真是让人觉得可惜。
Declaration
type
TauMiscFilesUpgradeBehavior = (mfuDownloadAlways, mfuOnlyIfSizeDifferent)
property MiscFilesUpgrade: TauMiscFilesUpgradeBehavior;
MiscFilesUpgrade 是枚举类型的。其值只能选择mfuDownloadAlways, mfuOnlyIfSizeDifferent之一,再看他帮助文档:
Description
The MiscFilesUpgrade property determines how the component should behave when it about to download the updated files.
There are two possible values for MiscFilesUpgrade property:
Value Meaning
ubAlwaysDownload this is devault value for this property. If it is set, the AutoUpgrader will always download all files in queue, as described in the Info-file, disregarding of their sizes, even if the remote file has the same size as its local analog;
ubOnlyIfSizeDifferent specifies that the AutoUpgrader should automatically compare the size of file which about to be downloaded with the size of file which already exists in local hard disk. If the sizes are equal, the component will not download it and pass to next file in the download queue.
****!竟然只能要么全部文件统统下载,或仅仅根据文件大小来决定是否下载到本地。这也太弱智了吧,如果只需要更新一个大小不变文件,第二个方法就更新不了,使第一个方法就得全部下载进行更新,晕乎!使用后发现而且更新后文件只能放在本目录中,如果软件安装有子目录,或多个目录又不能更新,又要写代码去移动文件,太不人性化了。唉,就先凑合着用吧,有时间自己也写类似东西买 买 ,说不定还可以出名呢。