以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  手动升级  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=132010)

--  作者:刘林
--  发布时间:2019/3/11 19:42:00
--  手动升级
Dim ftp1 As New FtpClient
ftp1.Host="XXXX"
ftp1.Account = "XXX"
ftp1.Password = "XXX"
If ftp1.Upload("\\shengji\\update.txt",ProjectPath & "update.txt") = True Then
 If Vars("update") <> FileSys.ReadAllText(ProjectPath & "update.txt") Then
        MessageBox.Show("服务器上版本时间为" & FileSys.ReadAllText(ProjectPath & "update.txt"))
        If ftp1.Upload("\\shengji\\update2.zip",ProjectPath & "update2.zip") = True Then
            Dim zip As New ZipFile
            zip.Open( ProjectPath & "update2.zip")
            zip.Extractall(ProjectPath )
            zip.Close()
            MessageBox.Show("更新完成")
            Vars("update") = FileSys.ReadAllText(ProjectPath & "update.txt")
            Syscmd.Project.Open(ProjectFile)
        End If
    Else
        messagebox.show("当前版本为最新版本")
    End If
End If
\'If FileSys.FileExists(ProjectPath & "update2.zip") Then \'如果指定的文件存在
\'FileSys.DeleteFile(ProjectPath & "update2.zip",2,2) \'则彻底删除之
\'End If
\'If FileSys.FileExists(ProjectPath & "update.txt") Then \'如果指定的文件存在
    \'FileSys.DeleteFile(ProjectPath & "update.txt",2,2) \'则彻底删除之
\'End If



老师,你好,因自动升级有的电脑要出问题想做一个手动下载升级,现在这样子做没任何提示,也下载不起文件,哪里有错

--  作者:有点蓝
--  发布时间:2019/3/11 20:07:00
--  
帮助查查“Upload”是干嘛用的?http://www.foxtable.com/webhelp/scr/1410.htm

需要的是下载,而不是上传!

--  作者:刘林
--  发布时间:2019/3/11 21:48:00
--  
哦,不好意思没注意到

另外:我发现绑定的远程图片列,服务器上是更新了图片,但个另图片不能自动更新,是什么原因

并且刚开试了一下始终不能不自动更新的图片在服务器里打开查看了后就可以自动更新了,是什么原因,怎么避免这种情况
[此贴子已经被作者于2019/3/11 21:54:26编辑过]

--  作者:有点蓝
--  发布时间:2019/3/11 22:01:00
--  
服务器是如何更新图片的?在服务器里打开查看在 -- 在资源管理器打开?
--  作者:刘林
--  发布时间:2019/3/12 20:21:00
--  
Dim updatepath As String
updatepath ="http://...."
RemoteUpdate= True
Network.DownloadFile(updatepath & "/update.txt",ProjectPath &"update.txt")
Dim Values() As String = FileSys.ReadAllText(ProjectPath & "update.txt").split("|")
messagebox.show(format(cdate(values(0)),"d"))
If  PublishDate<format(cdate(values(0)),"d")
    MessageBox.Show("发现新版本:" & format(cdate(values(0)),"d"))
    Network .DownloadFile(updatepath & "/update2.zip",ProjectPath &"update2.zip" ,"","",True,60000,True)
    Dim zip As New ZipFile
    zip.Open( ProjectPath & "update2.zip")
    zip.Extractall(ProjectPath )
    zip.Close()
    MessageBox.Show("更新完成,重新运行")
    Syscmd.Project.Open(ProjectFile)
    If FileSys.FileExists(ProjectPath & "update2.zip") Then \'如果指定的文件存在
        FileSys.DeleteFile(ProjectPath & "update2.zip",2,2) \'则彻底删除之
    End If
    If FileSys.FileExists(ProjectPath & "update.txt") Then \'如果指定的文件存在
        FileSys.DeleteFile(ProjectPath & "update.txt",2,2) \'则彻底删除之
    End If
Else
    messagebox.show("当前版本已为最新版")
End If

老师,改成了上面样式,出现第一次可以升级,第二次把就点按钮没有任何反就,messagebox.show都没出来,请问是什么原因?还有update2.zip不删可不可以
[此贴子已经被作者于2019/3/12 20:28:19编辑过]

--  作者:有点蓝
--  发布时间:2019/3/12 20:33:00
--  
Dim updatepath As String
updatepath ="http://...."
RemoteUpdate= True
Network.DownloadFile(updatepath & "/update.txt",ProjectPath &"update.txt")
Dim Values() As String = FileSys.ReadAllText(ProjectPath & "update.txt").split("|")
messagebox.show(format(cdate(values(0)),"d"))
If  PublishDate<format(cdate(values(0)),"d")
    MessageBox.Show("发现新版本:" & format(cdate(values(0)),"d"))
    Network .DownloadFile(updatepath & "/update2.zip",ProjectPath &"update2.zip" ,"","",True,60000,True)
    Dim zip As New ZipFile
    zip.Open( ProjectPath & "update2.zip")
    zip.Extractall(ProjectPath )
    zip.Close()
    MessageBox.Show("更新完成,重新运行")
    Syscmd.Project.Open(ProjectFile)
Syscmd.Project.Exit()
Else
    messagebox.show("当前版本已为最新版")
End If

    If FileSys.FileExists(ProjectPath & "update2.zip") Then \'如果指定的文件存在
        FileSys.DeleteFile(ProjectPath & "update2.zip",2,2) \'则彻底删除之
    End If
    If FileSys.FileExists(ProjectPath & "update.txt") Then \'如果指定的文件存在
        FileSys.DeleteFile(ProjectPath & "update.txt",2,2) \'则彻底删除之
    End If

--  作者:刘林
--  发布时间:2019/3/12 20:52:00
--  
老师,试了还是不行,

messagebox.show(format(cdate(values(0)),"d"))
这句都没运行,现在重启项目也不提示是最新版,手动升级的按钮按了没有任何反应,另外

Syscmd.Project.Open(ProjectFile)(重启)
Syscmd.Project.Exit()(退出)
这是怎么理解

--  作者:有点蓝
--  发布时间:2019/3/12 21:23:00
--  
try
    
Dim updatepath As String
updatepath ="http://...."
RemoteUpdate= True
Network.DownloadFile(updatepath & "/update.txt",ProjectPath &"update.txt")
Dim Values() As String = FileSys.ReadAllText(ProjectPath & "update.txt").split("|")
messagebox.show(format(cdate(values(0)),"d"))
If  PublishDate<format(cdate(values(0)),"d")
    MessageBox.Show("发现新版本:" & format(cdate(values(0)),"d"))
    Network .DownloadFile(updatepath & "/update2.zip",ProjectPath &"update2.zip" ,"","",True,60000,True)
    Dim zip As New ZipFile
    zip.Open( ProjectPath & "update2.zip")
    zip.Extractall(ProjectPath )
    zip.Close()
    MessageBox.Show("更新完成,重新运行")
    Syscmd.Project.Open(ProjectFile) \'打开新项目
Syscmd.Project.Exit() \'退出当前项目
Else
    messagebox.show("当前版本已为最新版")
End If
catch ex As exception
    msgbox(ex.message)
    msgbox("下载失败")
End try

--  作者:刘林
--  发布时间:2019/3/12 22:33:00
--  
Dim updatepath As String
updatepath ="http://"
RemoteUpdate= True
Network.DownloadFile(updatepath & "/update.txt",ProjectPath &"update.txt")
Dim Values() As String = FileSys.ReadAllText(ProjectPath & "update.txt").split("|")
If  PublishDate<>format(cdate(values(0)),"d")
    MessageBox.Show("发现新版本:" & format(cdate(values(0)),"d"))
    Network .DownloadFile(updatepath & "/update2.zip",ProjectPath &"update2.zip" ,"","",True,60000,True)
    Dim zip As New ZipFile
    zip.Open( ProjectPath & "update2.zip")
    zip.Extractall(ProjectPath )
    zip.Close()
    MessageBox.Show("更新完成,重新运行")
    Syscmd.Project.Exit()
Else
    messagebox.show("当前版本已为最新版")
End If
If FileSys.FileExists(ProjectPath & "update2.zip") Then \'如果指定的文件存在
    FileSys.DeleteFile(ProjectPath & "update2.zip",2,2) \'则彻底删除之
End If
If FileSys.FileExists(ProjectPath & "update.txt") Then \'如果指定的文件存在
    FileSys.DeleteFile(ProjectPath & "update.txt",2,2) \'则彻底删除之
End If

上面是可以,发现解压到了D:\\安装的系统\\project\\project下去了,正确应该是解压到当前目录,目录该样改


--  作者:有点蓝
--  发布时间:2019/3/12 22:58:00
--  


zip.Extractall(ApplicationPath )