以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  读取Text文本进行项目升级,提示不支持给定路劲的格式 怎么解决  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=174718)

--  作者:cnsjroom
--  发布时间:2022/1/27 19:56:00
--  读取Text文本进行项目升级,提示不支持给定路劲的格式 怎么解决

读取Text文本进行项目升级,提示不支持给定路劲的格式  怎么解决

当前代码如下:

 

try
   
    Dim str2 As String = FileSys.ReadAllText("ftp://lixich:LXClxc@47.11.24.9/zonghexinxi/update.txt")
    Dim ud() As String = str2.Split("|") \'获取文件内容
   
    Dim Sdate1 As Date = Cdate(ud(0)) \'服务器update.txt发布日期
    Dim Sdate2 As Date = Cdate(ud(1)) \'服务器Version.txt发布日期
    Dim Cdate1 As Date = PublishDate \'客户端发布日期
    Dim Cdate2 As Date = FileSys.ReadAllText(ProjectPath & "\\Bin\\Version.txt") \'客户端Version.txt发布日期
   
    If Sdate2 > Cdate2 OrElse Sdate1 > Cdate1 Then
        msgbox("有新版本")
        \'静默升级代码 Syscmd.Project.Update(False,False)
    End If
catch ex As exception
    msgbox(ex.message)
    msgbox("下载失败")
End try


--  作者:有点蓝
--  发布时间:2022/1/27 20:26:00
--  
FileSys.ReadAllText仅支持本地文件,ftp的文件先下载:http://www.foxtable.com/webhelp/topics/1410.htm
--  作者:cnsjroom
--  发布时间:2022/1/27 21:15:00
--  回复:(有点蓝)FileSys.ReadAllText仅支持本地文件,...

老师  是不是要将所有的升级相关文件都下载下来呢?还是如下代码只需要下载update.txt文件即可?

 

try

Dim ftp1 As new ftpclient
ftp1.host=
"196.128.143.28"
ftp1.Account =
"foxuser"
ftp1.password =
"138238110"
If
ftp1.Download("\\zonghexinxi\\update.txt","c:\\data\\update.txt") = True Then
   
Messagebox.show("下载完成!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
Else
   
Messagebox.show("下载失败!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
End If

    Dim str2 As String = FileSys.ReadAllText("c:\\data\\update.txt")
    Dim ud() As String = str2.Split("|") \'获取文件内容    
    Dim Sdate1 As Date = Cdate(ud(0)) \'服务器update.txt发布日期
    Dim Sdate2 As Date = Cdate(ud(1)) \'服务器Version.txt发布日期
    Dim Cdate1 As Date = PublishDate \'客户端发布日期
    Dim Cdate2 As Date = FileSys.ReadAllText(ProjectPath & "\\Bin\\Version.txt") \'客户端Version.txt发布日期    
    If Sdate2 > Cdate2 OrElse Sdate1 > Cdate1 Then
        msgbox("有新版本")
        \'静默升级代码 Syscmd.Project.Update(False,False)
    End If
catch ex As exception
    msgbox(ex.message)
    msgbox("下载失败")
End try


--  作者:有点蓝
--  发布时间:2022/1/27 21:28:00
--  
下载update.txt文件即可
--  作者:cnsjroom
--  发布时间:2022/1/27 22:55:00
--  回复:(有点蓝)下载update.txt文件即可

那我要在项目属性中的在线升级那里设定升级地址不呢?

或者是项目属性中的在线升级地址有变更  我直接在代码中红色代码部分定义升级目录  是否一样可以实现升级效果呢?

 

 

try

Dim ftp1 As new ftpclient
ftp1.host=
"196.128.143.28"
ftp1.Account =
"foxuser"
ftp1.password =
"138238110"
If
ftp1.Download("\\zonghexinxi\\update.txt","c:\\data\\update.txt") = True Then
   
Messagebox.show("下载完成!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information
)
Else
   
Messagebox.show("下载失败!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information
)
End If

    Dim str2 As String = FileSys.ReadAllText("c:\\data\\update.txt")
    Dim ud() As String = str2.Split("|") \'获取文件内容    
    Dim Sdate1 As Date = Cdate(ud(0)) \'服务器update.txt发布日期
    Dim Sdate2 As Date = Cdate(ud(1)) \'服务器Version.txt发布日期
    Dim Cdate1 As Date = PublishDate \'客户端发布日期
    Dim Cdate2 As Date = FileSys.ReadAllText(ProjectPath & "\\Bin\\Version.txt") \'客户端Version.txt发布日期    
    If Sdate2 > Cdate2 OrElse Sdate1 > Cdate1 Then
        msgbox("有新版本")
        \'静默升级代码

       RemoteUpdate=True
      UpdatePath = ”ftp://lixichu:LXClxc@4.1.24.5/zonghexinxi/“

      Syscmd.Project.Update(False,False)

    End If
catch ex As exception
    msgbox(ex.message)
    msgbox("下载失败")
End try


--  作者:有点蓝
--  发布时间:2022/1/27 23:07:00
--  
测试一下不就知道了