最近在项目中要用到FTP上传,用的是delphi的IdFTP控件,用IdFtp.List(list),发现List里面有内容,可 是到IdFtp.DirectoryListing.Items[iCount].ItemType=ditDirectory却出现越界的错误,而 DirectoryListing .ListResult中却有内容,取出IdFtp.DirectoryListing.count确为0,惊讶了。琢磨了很久 ,这是查的一个关于DirectoryListing 的资料。

最后发现由于D7以后的版本的intra控件升级,管理方式变了,需要在调用的单元是加一个文件IdAllFTPListParsers才搞定。现在贴出来,让大家少走点弯路。

看了一下网上的代码都是List完了就直接用,DirectoryListing会自动解析ListResult

放狗搜了半天,终于找到原因,原来是Indy10的一个设计上的变化,以下引用官网内容:

TIdFTP.DirectoryListing is returning nothing for my FTP server. Why?

We restructured the way FTP directory listing is done. The code is now a plug in system with various parsers in their own units which register themselves into a framework. To add support for a particular type of FTP server, you simply add the parser unit to one of your program unit’s uses clause.

To add the Unix directory list parser, add IdFTPListParseUnix to your unit’s clause. To add support for Microsoft Windows NT IIS FTP server, add IdFTPListParseWindowsNT to your uses clause. You can also add many other parsers we include in the Indy packages. By convention, they are named IdFTPListParser followed by the server type. You do not need to add IdFTPListParseBase to your uses clause because IdFTP uses that unit. If you wish to use all of Indy’s FTP List parser classes, just add the IdAllFTPListParsers unit to your uses clause.

We admit this new design is not as intuitive as the older one but this has many advantages for us such as:

• The FTP list parsing code is now much easier to maintain than the same code in a non-modular design in one unit which would be at least 150KB total.

• You now can add support for only the FTP servers you want your program support to support.

• You can now write your own custom parser classes and plug those into the standard FTP parsing list framework.

转自:http://hi.baidu.com/ningj123/item/1a1a1acfdb842063f6c95d2a

Idftp.DirectoryListing 里面的内容为什么会是空的呢?(转)的更多相关文章

  1. css 始终显示滚动条,内容超出显示有滑块的滚动条,内容没有超出显示空的滚动条

    1.内容没有超出显示空的滚动条 <div class="div1"> 前端开发者前端开发者前端开发者前端开发者前端开发者 </div> css代码: .di ...

  2. python 全栈开发,Day126(创业故事,软件部需求,内容采集,显示内容图文列表,MongoDB数据导入导出JSON)

    作业讲解 下载代码: HBuilder APP和flask后端登录 链接:https://pan.baidu.com/s/1eBwd1sVXTNLdHwKRM2-ytg 密码:4pcw 如何打开APP ...

  3. YUI前端优化之内容篇

    Excetional Performance团队总结出了一系列可以提高网站速度的方法.可以分为7大类34条.包括内容.服务器.cookie.CSS.JavaScript.图片.移动应用等七部分.一.内 ...

  4. 软件部需求,内容采集,显示内容图文列表,MongoDB数据导入导出JSON

    全局变量 由于多个html页面,需要引用同一个变量.这个时候,需要定义一个全局变量!如何定义呢? 默认包含了mui的html文件都导入mui.js文件.那么将变量写在mui.js中,就可以实现所有页面 ...

  5. django模型models.py文件内容理解

    首先,要理解这句话:模型是你的数据的唯一的.权威的信息源.它包含你所存储数据的必要字段和行为.通常,每个模型对应数据库中唯一的一张表 基础:每个模型都是django.db.models.Model的一 ...

  6. PHP正则匹配到2个字符串之间的内容,匹配HTML便签内容

    PHP正则匹配到2个字符串之间的内容 $preg= '/xue[\s\S]*?om/i'; preg_match_all($preg,"学并思网址xuebingsi.com",$r ...

  7. 解决UEditor编辑时,只添加视频内容,不添加文字,视频信息不能保存到数据库的问题

    造成这个问题的原因是富文本保存内容时会筛除空标签,然后统计是否有内容,通过字数统计也可以看到,上传完视频后字数还是零,因为视频上传后是<video></video>标签,这个标 ...

  8. JavaScript进阶内容——DOM详解

    JavaScript进阶内容--DOM详解 当我们已经熟练掌握JavaScript的语法之后,我们就该进入更深层次的学习了 首先我们思考一下:JavaScript是用来做什么的? JavaScript ...

  9. 5、利用控件TVCLZip和TIdFTP压缩文件并上传到FTP的线程单元pas 改进版

    用到临界区 保护写日志的函数: 递归函数 删除目录下的所有文件: 循环创建或判断FTP的目录: 可改进的地方:循环压缩深层次目录的所以文件: 实现断点续传,或断点下载: {************** ...

随机推荐

  1. js Regex match, exec, test & jquery plugin, visit the official website!

    http://plugins.jquery.com/?s=bootstrap 1. /reg/.test(strval) 2."strval".match(/reg/g), a r ...

  2. 【Linux】自主实现my_sleep【转】

    转自:http://blog.csdn.net/scenlyf/article/details/52068522 版权声明:本文为博主原创文章,未经博主允许不得转载. 首先说一下信号相关的内容. ** ...

  3. 《Linux命令行与shell脚本编程大全 第3版》Linux命令行---15

    以下为阅读<Linux命令行与shell脚本编程大全 第3版>的读书笔记,为了方便记录,特地与书的内容保持同步,特意做成一节一次随笔,特记录如下:

  4. MongoDB的使用[转]

    http://www.cnblogs.com/TankMa/archive/2011/06/08/2074947.html

  5. UVALive 3664:Guess(贪心 Grade E)

    vj题目链接 题意: 有n (n<16345)个人,每个人有三个数(小于1000且最多两位小数点),表示答对对应题的得分.规定总分越高的人rank越高.总分相同,id小的rank高.现在知道ra ...

  6. Python实现简单的Web服务器 解析

    代码来源https://www.shiyanlou.com/courses/552,对它进行理解,注释 #-*- coding:utf-8 -*- import BaseHTTPServer clas ...

  7. PHP中的stristr(),strstr(),strpos()速度比较

    测速代码: <?php function getmicrotime() { list($usec, $sec) = explode(" ",microtime()); ret ...

  8. SVG描边动画实现过程

    准备工具:Adobe AI+PS 1.确定SVG画布的大小,在PS中切出需要描边效果的区域,以此区域的大小做为SVG容器的大小.   2.将PS中切好的图片直接拖拽到AI中     3.使用AI中的钢 ...

  9. HDU 1027 Ignatius and the Princess II[DFS/全排列函数next_permutation]

    Ignatius and the Princess II Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K ( ...

  10. CodeForces - 361D Levko and Array

    Discription Levko has an array that consists of integers: a1, a2, ... , an. But he doesn’t like this ...