public void initData() { String curPath = Application.ExecutablePath; int len = curPath.LastIndexOf(@"\"); String strExcute = curPath.Substring(0, len + 1); strExcute = strExcute + savePathFileName; iniManager = new IniManager(strExcute, localSetupPath); localSetupPath = iniManager.LastDownLoadPath; local7zFileName = localSetupPath + load7zResourceName; localSetupExeName = localSetupPath + @"\" + loadSetupExeName; currentLoadFileName = Ftp7ZTargetPath; currentLocalFileName = local7zFileName; m_ftpFileDownload = new FileUpDownload(FtpSeverIP, FtpSeverID, FtpSeverPassword, Ftp7ZTargetPath, local7zFileName, this); m_ftpEXEDownload = new FileUpDownload(FtpSeverIP, FtpSeverID, FtpSeverPassword, FtpExeTargetPath, localSetupExeName, this); resource7zFileSize = m_ftpFileDownload.GetFileSize(); //7z文件的大小 if (resource7zFileSize == 0) { return; } exeFileSize = m_ftpEXEDownload.GetFileSize(); //exe文件的大小 totalSize = resource7zFileSize + exeFileSize; }
/// <summary> /// 下载文件,判断是资源文件还是exe文件。 /// </summary> private void DownloadingFile() { if (currentLoadFileName == Ftp7ZTargetPath) { m_ftpFileDownload.updateProgress = Update7ZProgressBar; m_ftpFileDownload.StartSingleDownload(); } else { if (m_ftpEXEDownload == null) { m_ftpEXEDownload = new FileUpDownload(FtpSeverIP, FtpSeverID, FtpSeverPassword, FtpExeTargetPath, localSetupExeName, this); } m_ftpEXEDownload.updateProgress = UpdateEXEProgressBar; m_ftpEXEDownload.StartSingleDownload(); } }