If zdgx = True then
Dim s2 As String = rpath & "\update.txt" '准备保存在客户端的升级文件日期和版本信息
ftp1.download(upath & "update.txt",s2,False) '静默下载并另存
Dim s3 As String = filesys.ReadAllText(s2,Encoding.Default)
Dim s4() As String = s3.Split("|")
Dim newdate As Date = s4(1)
Dim oldDate As Date = filesys.ReadAllText(apath & "\bin\version.txt",Encoding.Default) '在用的版本日期
Dim zip As New zipFile
Dim s As String
If olddate = newdate Then '属于小版本升级
s2 = rpath & "\update1.zip" '升级文件
ftp1.download(upath & "update1.zip",s2,False)
zip.Open(s2) '打开升级文件
zip.Extractall(rpath) '全部解压到客户端运行文件夹
zip.Close() '关闭升级文件
FileSys.deleteFile(s2,2,2) '删除升级文件
s = rpath & "\update.bat" ’建立升级批命令文件
If filesys.FileExists(s) Then
filesys.DeleteFile(s)
End If
filesys.WriteAllText(s,"@echo off" & vbcrlf,True,Encoding.Default)
filesys.WriteAllText(s,"taskkill /f /im 即时通讯系统.exe" & vbcrlf,True,Encoding.Default)
filesys.WriteAllText(s,"echo Wscript.Sleep Wscript.Arguments(0) * 1000>Delay.vbs" & vbcrlf,True,Encoding.Default)
filesys.WriteAllText(s,"Delay.vbs 3" & vbcrlf,True,Encoding.Default)
filesys.WriteAllText(s,"del Delay.vbs" & vbcrlf,True,Encoding.Default)
filesys.WriteAllText(s,"start /d " & path0 & pname & "\程序文件 /max " & ename & vbcrlf,True,Encoding.Default) 'path0为盘符根目录,pname为项目名称,ename为项目可执行文件
filesys.WriteAllText(s,"del " & s & vbcrlf,True,Encoding.Default)
Dim Proc As New Process '定义一个新的Process
Proc.File = s '指定要打开的文件
Proc.Verb = "Open" '指定动作
Proc.Start()
proc.WaitForExit
Else
If filesys.DirectoryExists(npath) = False Then ’npath为解压时用到的临时存放升级文件的文件夹
filesys.CreateDirectory(npath)
End If
s2 = npath & "\update2.zip" '重大版本升级文件
ftp1.download(upath & "update2.zip",s2,False) '静默下载并另存
zip.Open(s2)
zip.ExtractAll(npath)
zip.Close()
FileSys.deleteFile(s2,2,2)
s = rpath & "\update.bat" ’建立升级批命令文件
If filesys.FileExists(s) Then
filesys.DeleteFile(s)
End If
filesys.WriteAllText(s,"@echo off" & vbcrlf,True,Encoding.Default)
filesys.WriteAllText(s,"taskkill /f /im 即时通讯系统.exe" & vbcrlf,True,Encoding.Default)
filesys.WriteAllText(s,"echo Wscript.Sleep Wscript.Arguments(0) * 1000>Delay.vbs" & vbcrlf,True,Encoding.Default)
filesys.WriteAllText(s,"Delay.vbs 3" & vbcrlf,True,Encoding.Default)
filesys.WriteAllText(s,"xcopy " & npath & "*.* " & path0 & pname & "\程序文件\ /y /q /s" & vbcrlf,True,Encoding.Default)
filesys.WriteAllText(s,"Delay.vbs 3" & vbcrlf,True,Encoding.Default)
filesys.WriteAllText(s,"rd /q /s " & npath & vbcrlf,True,Encoding.Default)
filesys.WriteAllText(s,"del Delay.vbs" & vbcrlf,True,Encoding.Default)
filesys.WriteAllText(s,"start /d " & path0 & pname & "\程序文件 /max " & ename & vbcrlf,True,Encoding.Default)
filesys.WriteAllText(s,"del " & s & vbcrlf,True,Encoding.Default)
Dim Proc As New Process '定义一个新的Process
Proc.File = s '指定要打开的文件
Proc.Verb = "Open" '指定动作
Proc.Start()
proc.WaitForExit
End If
Else
Forms("用户登录").Open()
End If