PB FTP TOOLS

时间:2018-05-31 09:17:46
【文件属性】:

文件名称:PB FTP TOOLS

文件大小:1.09MB

文件格式:PBL

更新时间:2018-05-31 09:17:46

PB FTP TOOLS

PB调用API的FTP自动更新程序。 Integer li_days Long ll_Times Long ll_row,ll_insert,ll_count,ll_select,ll_Found Boolean lb_DownLoad String ls_filename,ls_dir,ls_localdir,ls_temp Datetime ldt_LocalDateTime ,ldt_RemoteDateTime uo_process.Visible = True ll_count = dw_remote.RowCount() If ll_count <= 0 Then GoTo Process_End wf_MsgInfo("正在检索需下载的文件,请稍候...",0) ll_select = 0 For ll_row = 1 To ll_count uo_process.Setprogress( ll_row / ll_count * 100) dw_remote.ScrollToRow(ll_Row) lb_DownLoad = False ls_filename = dw_remote.Object.filename[ll_row] If ls_filename = '.' or ls_filename = '..' Then Continue If left(ls_filename,2) ="ba" Then debugbreak () ll_Found = dw_local.Find("filename = '"+ls_filename+"'",1,dw_local.RowCount()) If ll_Found > 0 Then ldt_LocalDateTime = dw_local.Object.filetime[ll_Found] ldt_RemoteDateTime= dw_remote.Object.filetime[ll_Row] If ldt_LocalDateTime < ldt_RemoteDateTime Then li_days = DaysAfter(Date(ldt_LocalDateTime),Date(ldt_RemoteDateTime)) ll_Times = SecondsAfter(Time(ldt_LocalDateTime),Time( ldt_RemoteDateTime)) ll_Times = li_Days * 86399 + ll_Times End If If ((dw_local.Object.filesize[ll_Found] <> dw_remote.Object.filesize[ll_Row]) OR & (ll_Times > 360 )) Then // 时间误差4分钟 lb_DownLoad = True Else Continue // 比较文件大小、修改时间,两者相同则无需 End If Else lb_DownLoad = True End If If Len(ls_dir) = 1 Then ls_temp = ls_dir + ls_filename Else ls_temp = ls_dir + '/' + ls_filename End If If NOT n_ftp.uf_ftpgetfile(ls_temp,ls_filename) Then wf_MsgInfo("下载"+ls_filename+"文件失败!",1) GOTO Process_End Else String ls_MsgValue ls_MsgValue = "正在下载"+ls_filename+"文件,文件大小为"+String( dw_remote.Object.filesize[ll_row])+",版本时间为"+String(dw_remote.Object.filetime[ll_row],"yyyy-mm-dd hh:mm:ss" ) wf_MsgInfo(ls_MsgValue,0) End If If lb_DownLoad and ll_Found <= 0 Then ll_insert = dw_local.InsertRow(0) ElseIf lb_DownLoad and ll_Found > 0 Then ll_Insert = ll_Found Else Continue End If ll_select ++ dw_local.Object.filename[ll_insert] = dw_remote.Object.filename[ll_row] dw_local.Object.filesize[ll_insert] = dw_remote.Object.filesize[ll_row] dw_local.Object.filetime[ll_insert] = dw_remote.Object.filetime[ll_row] Next ls_temp = "共"+String(ll_select)+"个文件被下载。" wf_MsgInfo(ls_temp,0) uo_process.Visible = False Return True Process_End: uo_process.Visible = False wf_MsgInfo("失败",0) Return False


网友评论