| ASP在线升级类文件 |
| 作者:中客资源 来源:中客资源 发布时间:2007-2-7 2:24:14 |
减小字体
增大字体
|
<% Class Cls_oUpdate Public LocalVersion , LastVersion , FileType Public UrlVersion , UrlUpdate , UpdateLocalPath , Info Public UrlHistory Private sstrVersionList , sarrVersionList , sintLocalVersion , sstrLocalVersion Private sstrLogContent , sstrHistoryContent , sstrUrlUpdate , sstrUrlLocal Private Sub Class_Initialize () UrlVersion = "" UrlUpdate = "" UpdateLocalPath = "/" UrlHistory = "history.htm" Info = "" LocalVersion = "1.0.0" LastVersion = "1.0.0" FileType = ".asp" End Sub Private Sub Class_Terminate () End Sub Public function doUpdate () doUpdate = False UrlVersion = Trim(UrlVersion ) UrlUpdate = Trim(UrlUpdate ) If (Left(UrlVersion , 7) <> "http://") Or (Left(UrlUpdate , 7) <> "http://") Then Info = "版本检测网址为空, 升级网址为空或格式错误(#1)" Exit function End If If Right(UrlUpdate , 1) <> "/" Then sstrUrlUpdate = UrlUpdate & "/" Else sstrUrlUpdate = UrlUpdate End If If Right(UpdateLocalPath , 1) <> "/" Then sstrUrlLocal = UpdateLocalPath & "/" Else sstrUrlLocal = UpdateLocalPath End If sstrLocalVersion = LocalVersion sintLocalVersion = Replace(sstrLocalVersion , ".", "") sintLocalVersion = toNum (sintLocalVersion , 0) If IsLastVersion Then Exit function doUpdate = NowUpdate () LastVersion = sstrLocalVersion End function Private function IsLastVersion () If iniVersionList Then Dim i IsLastVersion = True For i = 0 to UBound(sarrVersionList ) If sarrVersionList (i ) > sintLocalVersion Then IsLastVersion = False Info = "已经是最新版本!" Exit For End If Next Else IsLastVersion = True Info = "获取版本信息时出错!(#2)" End If End function Private function iniVersionList () iniVersionList = False Dim strVersion strVersion = getVersionList () If strVersion = "" Then Info = "出错......." Exit function End If sstrVersionList = Replace(strVersion , " ", "") sarrVersionList = Split(sstrVersionList , vbCrLf) iniVersionList = True End function Private function getVersionList () getVersionList = GetContent (UrlVersion ) End function Private function NowUpdate () Dim i For i = UBound(sarrVersionList ) to 0 step -1 Call doUpdateVersion (sarrVersionList (i )) Next Info = "升级完成! <a href=""" & sstrUrlLocal & UrlHistory & """>查看</a>" End function Private function doUpdateVersion (strVer ) doUpdateVersion = False Dim intVer intVer = toNum (Replace(strVer , ".", ""), 0) If intVer <= sintLocalVersion Then Exit function End If Dim strFileListContent , arrFileList , strUrlUpdate strUrlUpdate = sstrUrlUpdate & intVer & FileType strFileListContent = GetContent (strUrlUpdate ) If strFileListContent = "" Then Exit function [1] [2] [3] 下一页 |
|
[]
[返回上一页]
[打 印]
|
|
|