教学文库网 - 权威文档分享云平台
您的当前位置:首页 > 精品文档 > 综合文档 >

FTP客户端课程设计报告书(6)

来源:网络收集 时间:2026-08-29
导读: CurrentTime.GetMinute(), CurrentTime.GetSecond()); strTime += \上传出错,请重试\\r\\n\ nLength = pEdiMes->SendMessage(WM_GETTEXTLENGTH); pEdiMes->SetSel(nLength, nLength); pEdiMes->ReplaceSel(strTime

CurrentTime.GetMinute(),

CurrentTime.GetSecond());

strTime += \上传出错,请重试\\r\\n\

nLength = pEdiMes->SendMessage(WM_GETTEXTLENGTH); pEdiMes->SetSel(nLength, nLength); pEdiMes->ReplaceSel(strTime); return 0; } else {

CurrentTime=CTime::GetCurrentTime(); strTime.Format(\\

CurrentTime.GetDay(),CurrentTime.GetHour(), CurrentTime.GetMinute(),

CurrentTime.GetSecond());

strTime += \文件:\上传成功\

nLength = pEdiMes->SendMessage(WM_GETTEXTLENGTH); pEdiMes->SetSel(nLength, nLength); pEdiMes->ReplaceSel(strTime); }

return 1; }

int CFtpOperate::GetMultipleFileName(CStringArray *localNameArray) //localNameArray作为输出参数 {

if (flag != 2) {// 连接未成功 return 0; }

CWaitCursor cursor; BOOL goodfile; int x=0;

int nFileNumber=0;

pFtpConnection->SetCurrentDirectory(m_strFullPath); CFtpFileFind fFiles(pFtpConnection);

goodfile=fFiles.FindFile(m_strFullPath+\ if(goodfile==FALSE) {

fFiles.Close(); return 0; }

CString str; while(goodfile)

第25页

{

goodfile=fFiles.FindNextFile(); str=fFiles.GetFileName(); if(fFiles.IsDirectory()) {

str+=\ }

localNameArray->InsertAt(x,str); nFileNumber++; x++; }

fFiles.Close();

//return the number of missing file, if any. return nFileNumber; }

// 设置服务器下一层文件目录

bool CFtpOperate::setNextPath(CString strPath) {

CString temp = m_strFullPath;

int i = m_strFullPath.GetLength() - 1; if (m_strFullPath.GetAt(i)!='/') {

m_strFullPath +='/'; }

m_strFullPath += strPath + '/';

CurrentTime=CTime::GetCurrentTime(); strTime.Format(\\

CurrentTime.GetDay(),CurrentTime.GetHour(), CurrentTime.GetMinute(),

CurrentTime.GetSecond());

strTime += \当前目录为:\ nLength = pEdiMes->SendMessage(WM_GETTEXTLENGTH); pEdiMes->SetSel(nLength, nLength); pEdiMes->ReplaceSel(strTime); return 1; }

// 返回上一层目录

bool CFtpOperate::setBackPath() {

CString str;

pFtpConnection->GetCurrentDirectoryAsURL(str); int i = m_strFullURL.GetLength() - 1; int j = str.GetLength() - 1;

第26页

//AfxMessageBox(str); if (i < j) {

m_strFullPath = str.Right(j - i); }

if (m_strFullPath == '/') {

return 0; } else {

int i = m_strFullPath.GetLength() - 2; // 省略最后的一个‘/’ for (;i>=0;--i) {

if (m_strFullPath.GetAt(i) == '/') {

CString temp;

temp = m_strFullPath.Left(i); m_strFullPath = temp; m_strFullPath +='/';

CurrentTime=CTime::GetCurrentTime(); strTime.Format(\

\.GetHour(), CurrentTime.GetMinute(),CurrentTime.GetSecond()); strTime += \当前目录为:\ nLength = pEdiMes->SendMessage(WM_GETTEXTLENGTH); pEdiMes->SetSel(nLength, nLength); pEdiMes->ReplaceSel(strTime); return 1; } } }

return 1; }

// 用temp返回服务器的当前路径

void CFtpOperate::GetPath(CString &temp) {

temp = m_strFullPath; }

// 信息输出的控件句柄传入

void CFtpOperate::setEidt(CEdit *pEdiMessage) {

pEdiMes = pEdiMessage; }

第27页

// 移除,index为0表示移除文件夹,否则为移除文件

int CFtpOperate::DeleteFTPf(CString remote,int index) {

if (flag != 2) {

// 连接未成功 return 0; }

CWaitCursor cursor; // init some var BOOL goodfile; int x=0;

CurrentTime=CTime::GetCurrentTime(); strTime.Format(\\

CurrentTime.GetDay(),CurrentTime.GetHour(), CurrentTime.GetMinute(),

CurrentTime.GetSecond()); if (index == 0) {

strTime += \删除文件夹,请稍候: \ } else {

strTime += \删除文件,请稍候: \ }

nLength = pEdiMes->SendMessage(WM_GETTEXTLENGTH); pEdiMes->SetSel(nLength, nLength); pEdiMes->ReplaceSel(strTime);

pFtpConnection->SetCurrentDirectory(m_strFullPath); if (index == 0) {

// 删除文件夹

goodfile = pFtpConnection->RemoveDirectory(m_strFullPath+'/'+remote); } else {

// 删除文件

goodfile = pFtpConnection->Remove(m_strFullPath+'/'+remote); }

if(!goodfile) {

CurrentTime=CTime::GetCurrentTime(); strTime.Format(\

第28页

\

CurrentTime.GetDay(),CurrentTime.GetHour(), CurrentTime.GetMinute(),

CurrentTime.GetSecond());

strTime += \删除失败,请重试\\r\\n\

nLength = pEdiMes->SendMessage(WM_GETTEXTLENGTH); pEdiMes->SetSel(nLength, nLength); pEdiMes->ReplaceSel(strTime); return 0; } else {

CurrentTime=CTime::GetCurrentTime(); strTime.Format(\\

CurrentTime.GetDay(),CurrentTime.GetHour(), CurrentTime.GetMinute(),

CurrentTime.GetSecond());

strTime += \删除文件成功:\

nLength = pEdiMes->SendMessage(WM_GETTEXTLENGTH); pEdiMes->SetSel(nLength, nLength); pEdiMes->ReplaceSel(strTime); }

return 1; }

六、测试结果

(1)本地文件列表的显示、各控件不同的选择不会造成出现BUG的测试

(2)连接服务器测试,提示信息测试,不同传输方式测试,不同连接方式测试,是否匿

第29页

…… 此处隐藏:2098字,全部文档内容请下载后查看。喜欢就下载吧 ……
FTP客户端课程设计报告书(6).doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印
本文链接:https://www.jiaowen.net/wendang/404873.html(转载请注明文章来源)
Copyright © 2020-2025 教文网 版权所有
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ:78024566 邮箱:78024566@qq.com
苏ICP备19068818号-2
Top
× 游客快捷下载通道(下载后可以自由复制和排版)
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
注:下载文档有可能出现无法下载或内容有问题,请联系客服协助您处理。
× 常见问题(客服时间:周一到周五 9:30-18:00)