140 class MDWC_COMPLILE CFileTransferHelper
146 bool m_bAutoFreeMidComm;
148 unsigned char m_uRouteNode;
150 int m_iLassErrorCode;
152 std::string m_sLastErrorMsg;
154 int m_iProgressPercent;
156 int64_t m_i64LastFileID;
160 std::string m_sProgressFileName;
162 std::string m_sCurrentLocalFile;
164 int64_t m_i8StartTick;
166 int64_t m_i8FileStartTick;
168 std::function<PPROGRESSCALLBACK> m_pProgressCallback;
171 CFileTransferHelper(
const CFileTransferHelper&) =
delete;
173 CFileTransferHelper& operator=(
const CFileTransferHelper&) =
delete;
183 bool ProcessProgress(
const int64_t i8ProcessData,
const int64_t i8AllData,
const int64_t i64FileID = 0);
194 void ReleaseMidLinkComm();
201 bool CheckMidLinkComm();
209 std::string ReadMTPFileLine(std::fstream& fs);
216 CFileTransferHelper(
unsigned char uRouteNode = 0);
228 ~CFileTransferHelper();
238 std::string GetLastErrorMessage();
245 int GetLastErrorCode();
258 int64_t DownLoadFile(
const std::string& sLocalFileName,
const std::string& sRemoteFileName,
bool ResumeBreak,
259 int64_t iFileSize = 0,
const std::string& sVerifyMD5 =
"",
int iDownReqNo = RDMS_DOWNLOADFILE);
270 int64_t DownLoadFile(
const std::string& sRemoteFileName, std::streambuf& sRcvStream, int64_t iFileSize = 0,
int iDownReqNo = RDMS_DOWNLOADFILE);
281 std::vector<REMOTE_FILE_INFO> GetServerDirectoryFileInfo(
const std::string& sPathName,
282 bool bSearchSubDir =
true,
bool bCalculateMD5 =
false,
int iDownReqNo = RDMS_GETDIR_FILEINFO);
293 bool DownloadDirectoryFiles(
const std::string& sPathName,
const std::string& sSavePathTo,
294 bool bIncludeSubDir =
true,
int iDownReqNo = RDMS_DOWNLOAD_FLODER);
307 bool BatchDownLoadFiles(
const std::vector<REMOTE_FILE_INFO>& lstFiles,
309 bool ResumeBreak =
true,
const std::string& sSotrePara =
"",
int iDownReqNo = RDMS_BATCHGET_FILES);
320 int UpLoadFile(
const std::string& sLocalFileName,
const std::string& sServerSaveFileName,
bool ResumeBreak =
true,
int iUploadReqNo = RDMS_UPLOAD_FILE);
330 bool UpLoadFileToMidCache(
const std::string& sLocalFileName, std::string& sFileMD5,
int iUploadReqNo = RDMS_SAVEFILE_CACHE);
340 int BatchUpLoadFiles(
const std::vector<SEND_FILE_INFO>& lstFiles,
int iUploadReqNo = RDMS_UPLOAD_FILE,
const std::string& sAddToMidFileCache =
"Auto");
352 int UpLoadDirectoryFile(
const std::string& sLocalPathName,
const std::string& sSavePathTo,
353 bool bIncludeSubDir =
true,
bool ResumeBreak =
true,
int iUploadReqNo = RDMS_UPLOAD_FILE);
366 int UpLoadFrontServerFileToRemote(
unsigned char uRemoteNode,
const std::string& sFSPathName,
const std::string& sRSPathName,
367 bool bIncludeSubDir =
true,
const std::string& sAddToCache =
"AUTO",
int iUploadReqNo = RDMS_UPLOAD_FSFILE);
377 bool DeleteServerFile(
const std::string& sServerFileName,
const std::string& sFloderDelteMode =
"",
int iReqNo = RDMS_DELET_FILE);
385 std::vector<std::string> ReadMTPFile(
const std::string& sFileName);
394 static int64_t GetFileMD5(
const std::string& sFileName, std::string& sMD5Value);
404 static bool GetFileMD5(
const std::string& sFileName, int64_t& iFileSize, std::string& sMD5Value);
410 static std::string SpeedFormat(
int speed);
417 static std::string TimeFormat(int64_t time,
bool bIsMicrosecond =
false);