Use PB to call API automatic update (non-FTP mode) (5, copy function f)

xiaoxiao2021-03-06  118

V. Copy function f_connect_copyfile Requires Control: Listbox Requires INI File: Autodown.iniglobal Type F_Connect_copyFile From Function_Objectnd Type

forward prototypesglobal function integer f_connect_copyfile (string as_path, hprogressbar hpb_1, long al_copycount, listbox lb_filecopy1, listbox lb_filecopy2, listbox lb_filecopy3) end prototypes

global function integer f_connect_copyfile (string as_path, hprogressbar hpb_1, long al_copycount, listbox lb_filecopy1, listbox lb_filecopy2, listbox lb_filecopy3); string ls_userstring ls_passstring ls_directorya1, ls_directorya2string ls_directoryb1, ls_directoryb2string ls_directoryc1, ls_directoryc2

Ls_directorya1 = as_pathls_directorya2 = GS_Application_Path

String ls_filename, ls_filestring ls_filename1, ls_filename2

Long ll_filecounta1, ll_filecounta2long ll_filecountb1, ll_filecountb2long ll_filecountc1, ll_filecountc2

Long LL_CNT1LONG LL_CNT2LONG LL_CNT3LONG LL_MLONG LL_RET = 1

S_WIN32_FIND_DATA SS_FILE1, SS_FILE2LONG LL_FILEHANDLE1, LL_FILEHANDLE2

ls_file = ls_directorya1 '/*.*'If Not lb_filecopy1.DirList (ls_file, 0 1 2 16) Then Return 0End Ifhpb_1.position = 0ll_filecounta1 = lb_filecopy1.TotalItems () ll_m = 0if al_copycount = 0 then al_copycount = 1For ll_cnt1 = 1 To ll_filecounta1 ls_File = lb_filecopy1.Text (ll_cnt1) w_autodown_test.st_2.text = ls_file Yield () if left (ls_file, 1) = '[' then ls_filename = right (ls_file, len (ls_file) - 1) ls_filename = left (ls_filename, len (ls_filename) - 1) if ls_filename = '..' then continue ls_directoryb1 = ls_directorya1 '/' ls_filename ls_directoryb2 = ls_directorya2 '/' ls_filename if directoryexists (ls_directoryb2) = false then CreateDirectory (ls_directoryb2) ll_m hpb_1.position = ll_m / al_copycount * 100 end if ls_file = ls_directoryb1 '/*.*' lb_filecopy2.DirList (ls_file, 0 1 2 16) ll_filecountb1 = lb_filecopy2.TotalItems () for ll_cnt2 = 1 to ll_filecountb1 ls_File = lb_filecopy2.text (ll_cnt2) w_autodown_test.st_2.text = ls_file yield () if f l ( ls_file, 1) = '[' then ls_filename = right (ls_file, len (ls_file) - 1) ls_filename = left (ls_filename, len (ls_filename) - 1) if ls_filename = '..' then continue ls_directoryc1 = ls_directoryb1 '/ ' ls_filename ls_directoryc2 = ls_directoryb2 ' / ' ls_filename if directoryexists (ls_directoryc2) = false then CreateDirectory (ls_directoryc2) ll_m hpb_1.position = ll_m / al_copycount * 100 end if ls_file =

ls_directoryc1 '/*.*' lb_filecopy3.DirList (ls_file, 0 1 2 16) ll_filecountc1 = lb_filecopy3.TotalItems () for ll_cnt3 = 1 to ll_filecountc1 ls_File = lb_filecopy3.Text (ll_cnt3) w_autodown_test.st_2.text = ls_file if ls_file = '[..]' then continue // file determination, comparison and download ls_filename1 = ls_directoryc1 '/' ls_file ls_filename2 = ls_directoryc2 '/' ls_file Yield () if fileexists (ls_filename2) = false then CopyFileA ( ls_filename1, ls_filename2,0) ll_m hpb_1.position = ll_m / al_copycount * 100 else ll_filehandle1 = FindFirstFileA (ls_filename1, ss_file1) FindClose (ll_filehandle1) ll_filehandle2 = FindFirstFileA (ls_filename2, ss_file2) FindClose (ll_filehandle2) choose case CompareFileTime (ss_file1.ftlastwritetime, ss_file2 .ftlastwritetime) case 0 // Two times, return zero case 1 // If lpfiletime2 is less than lpfiletime1, return 1 // Download CopyFilea (LS_FileName1, LS_FileName2, 0) LL_M HPB_1.Positio n = ll_m / al_copycount * 100 case -1 // lpFileTime1 as less than lpFileTime2, return -1 end choose end if next else // file determination, comparison and download ls_filename1 = ls_directoryb1 '/' ls_file ls_filename2 = ls_directoryb2 '/' ls_file if fileexists (ls_filename2) = false then CopyFileA (ls_filename1, ls_filename2,0) ll_m hpb_1.position = ll_m / al_copycount * 100 else ll_filehandle1 = FindFirstFileA (ls_filename1, ss_file1) FindClose (ll_filehandle1) ll_filehandle2 =

转载请注明原文地址:https://www.9cbs.com/read-99207.html

New Post(0)