Fourth, statistical replication file Quantity function f_connect_copycount Requires Control: ListBox (3) Return Value: The number of files that need to download. Global Type F_Connect_copycount from function_Objectnd Type
Forward PrototypeSGLOBAL FUNCOTINT (String as_path, listbox lb_filecopy1, listbox lb_filecopy2, listbox lb_filecopy3) End Prototype
Global Function Integer f_connect_copycount (string as_path, listbox lb_filecopy1, listbox lb_filecopy2, listbox lb_filecopy3);
String ls_directorya1, ls_directorya2string ls_filename, LS_FILE
Ls_directorya1 = as_pathls_directorya2 = GS_Application_Path
String ls_directoryb1, ls_directoryb2string ls_directoryc1, ls_directoryc2
String ls_filename1, ls_filename2
Long ll_filecounta1, ll_filecounta2long ll_filecountb1, ll_filecountb2long ll_filecountc1, ll_filecountc2
Long LL_CNT1LONG LL_CNT2LONG LL_CNT3
s_filetime sf_createtime1, sf_createtime2s_filetime sf_accesstime1, sf_accesstime2s_filetime sf_writetime1, sf_writetime2
S_WIN32_FIND_DATA SS_FILE1, SS_FILE2LONG LL_FILEHANDLE1, LL_FILEHANDLE2
Long LL_K
Ls_file = ls_directorya1 '/*.*'if not lb_filecopy1.dirlist (ls_file, 0 1 2 16 32) THEN RETURN-Hevered IF
ll_filecounta1 = lb_filecopy1.TotalItems () ll_k = 0For ll_cnt1 = 1 To ll_filecounta1 ls_File = lb_filecopy1.Text (ll_cnt1) 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 ll_k 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) 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_directoryc1 = ls_directoryb1 '/' ls_filename Ls_directoryc2 = ls_directoryb2 '/' ls_filename if Directoryexists (ls_directoryc2) = f alse then ll_k 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) IF ls_file = '[..]' TEN Continue // Judging file, compare and download LS_FileName1 = LS_DirectoryC1 '/' LS_FILE LS_FILENAME2 = LS_DirectoryC2 '/'
ls_file if fileexists (ls_filename2) = false then ll_k 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 LL_K case -1 // If lpfiletime1 is less than lpfiletime2, return -1 End choose end if next else // judgment file, comparison Download ls_filename1 = ls_directoryb1 '/' ls_file ls_filename2 = ls_directoryb2 '/' ls_file if fileexists (ls_filename2) = false then ll_k 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.FTLASTWRITIME, SS_FILE2.FTLASTWRITETIME) CASE 0 // two times, return zero case 1 //, such as lpfiletime2 less than lpfiletime1, return 1 // Download LL_K case -1 //, such as lpfiletime1 less than lpfiletime2, return -1 End choose end if end if next else // judgment files, and downloading comparison ls_filename1 = ls_directorya1 '/' ls_file ls_filename2 = ls_directorya2 '/' ls_file if fileexists (ls_filename2) = false then ll_k 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 is equal to two time 0 //, // returns zero as Case 1 is less than lpFileTime2 lpFileTime1, downloaded choose case return 1 // lower (ls_file) case 'hbky_autodown.exe' // download case 'hbky_autodown.pbd' // case 'autodown.ini' case else ll_k end choose case -1 // lpFileTime1 as less than lpFileTime2, return -1 end choose end if End ifnextreturn LL_Kend Function