public int DownloadFileThroughNewFtp(string puid, string szTargetId, string remotePath, float fTotalSize, bool bIsShowResult, DeleTickTransProgress OnProgress) { this.OnProgress = OnProgress; string localPath = getLocalRemoteStoragePath(puid, szTargetId, remotePath); string path = localPath; if (path == null || path.Length == 0) { return(-1); } path = path.Substring(0, path.LastIndexOf("\\")); if (!createDirectory(path)) { return(-1); } BVCU_File_TransferParam TransferParam = new BVCU_File_TransferParam(); TransferParam.hSession = m_sdkOperator.Session.sessionHandle; TransferParam.szRemoteFilePathName = remotePath; TransferParam.szLocalFilePathName = localPath; TransferParam.szTargetID = szTargetId; TransferParam.reTransferType = ReTransferType.RESUME; int rc = FileTransferOpen(ref hTransfer, TransferParam, null); return(rc); }
public int FileTransferOpen(ref IntPtr phTransfer, BVCU_File_TransferParam transferParam, object userData) { IntPtr pParam = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(BVCU_File_TransferParam))); Marshal.StructureToPtr(transferParam, pParam, false); int rc = BVCU.ManagedLayer_BVFileTransferOpen(m_sdkOperator.m_bvcuSdkHandle, ref phTransfer, pParam); timerGetTransInfo.Start(); Marshal.FreeHGlobal(pParam); return(rc); }