设为首页
加入收藏
站内地图
旧版入口
当前位置:首页 > 站长学院 > 网络编程 > ASP

ASP在线升级类文件

作者:佚名 出处:网络转载 时间:11-12 点击:

内容载入中...
<%
 Rem #####################################################################################
 Rem ## 在线升级类声明
 Class Cls_oUpdate
  Rem #################################################################
  Rem ## 描述: ASP 在线升级类
  Rem ## 版本: 1.0.0
  Rem ## 作者: 萧月痕
  Rem ## MSN:  xiaoyuehen(at)msn.com
  Rem ## 请将(at)以 @ 替换
  Rem ## 版权: 既然共享, 就无所谓版权了. 但必须限于网络传播, 不得用于传统媒体!
  Rem ## 如果您能保留这些说明信息, 本人更加感谢!
  Rem ## 如果您有更好的代码优化, 相关改进, 请记得告诉我, 非常谢谢!
  Rem #################################################################
  Public LocalVersion, LastVersion, FileType
  Public UrlVersion, UrlUpdate, UpdateLocalPath, Info
  Public UrlHistory
  Private sstrVersionList, sarrVersionList, sintLocalVersion, sstrLocalVersion
  Private sstrLogContent, sstrHistoryContent, sstrUrlUpdate, sstrUrlLocal
  Rem #################################################################
  Private Sub Class_Initialize()
   Rem ## 版本信息完整URL, 以 http:// 起头
   Rem ## 例: http://localhost/software/Version.htm
   UrlVersion     = ""
  
   Rem ## 升级URL, 以 http:// 起头, /结尾
   Rem ## 例: http://localhost/software/
   UrlUpdate     = ""
  
   Rem ## 本地更新目录, 以 / 起头, /结尾. 以 / 起头是为当前站点更新.防止写到其他目录.
   Rem ## 程序将检测目录是否存在, 不存在则自动创建
   UpdateLocalPath  = "/"
  
   Rem ## 生成的软件历史文件
   UrlHistory     = "history.htm"
  
   Rem ## 最后的提示信息
   Info        = ""
  
   Rem ## 当前版本
   LocalVersion    = "1.0.0"
  
   Rem ## 最新版本
   LastVersion    = "1.0.0"
  
   Rem ## 各版本信息文件后缀名
   FileType      = ".asp"
  End Sub
  Rem #################################################################
 
  Rem #################################################################
  Private Sub Class_Terminate()
 
  End Sub
  Rem #################################################################
  Rem ## 执行升级动作
  Rem #################################################################
  Public function doUpdate()
   doUpdate = False
  
   UrlVersion    = Trim(UrlVersion)
   UrlUpdate    = Trim(UrlUpdate)
  
   Rem ## 升级网址检测
   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  
  
   Rem ## 当前版本信息(数字)
   sstrLocalVersion = LocalVersion
   sintLocalVersion = Replace(sstrLocalVersion, ".", "")
   sintLocalVersion = toNum(sintLocalVersion, 0)
  
   Rem ## 版本检测(初始化版本信息, 并进行比较)
   If IsLastVersion Then Exit function
  
   Rem ## 开始升级
   doUpdate = NowUpdate()
   LastVersion = sstrLocalVersion
  End function
  Rem #################################################################
 
  Rem ## 检测是否为最新版本
  Rem #################################################################
   Private function IsLastVersion()
    Rem ## 初始化版本信息(初始化 sarrVersionList 数组)
    If iniVersionList Then
     Rem ## 若成功, 则比较版本
     Dim i
     IsLastVersion = True
     For i = 0 to UBound(sarrVersionList)
      If sarrVersionList(i) > sintLocalVersion Then
       Rem ## 若有最新版本, 则退出循环
       IsLastVersion = False
       Info = "已经是最新版本!"
       Exit For
      End If
     Next
    Else
document.getElementById('loading').style.display="none";
收藏本文:
】【打印页面】【推荐给朋友】【关闭窗口

站长学院

推荐信息