Delphi XE10 IdFtp 错误:No FTP list parsers have been registered

Delphi XE10 IdFtp 错误:No FTP list parsers have been registered

错误来源:idftp.DirectoryListing 属性

解决方式: 

uses IdAllFTPListParsers  //FTP列表解析器

单元内容:

uses
  IdFTPListParseAS400,
  IdFTPListParseBullGCOS7,
  IdFTPListParseBullGCOS8,
  IdFTPListParseChameleonNewt,
  IdFTPListParseCiscoIOS,
  IdFTPListParseDistinctTCPIP,
  IdFTPListParseEPLF,
  IdFTPListParseHellSoft,
  IdFTPListParseIEFTPGateway,
  IdFTPListParseKA9Q,
  IdFTPListParseMicrowareOS9,
  IdFTPListParseMPEiX,
  IdFTPListParseMusic,
  IdFTPListParseMVS,
  IdFTPListParseNCSAForDOS,
  IdFTPListParseNCSAForMACOS,
  IdFTPListParseNovellNetware,
  IdFTPListParseNovellNetwarePSU,
  IdFTPListParseOS2,
  IdFTPListParsePCNFSD,
  IdFTPListParsePCTCP,
  IdFTPListParseStercomOS390Exp,
  IdFTPListParseStercomUnixEnt,
  IdFTPListParseStratusVOS,
  IdFTPListParseSuperTCP,
  IdFTPListParseTandemGuardian,
  IdFTPListParseTOPS20,
  IdFTPListParseTSXPlus,
  IdFTPListParseUnisysClearPath,
  IdFTPListParseUnix,
  IdFTPListParseVM,
  IdFTPListParseVMS,
  IdFTPListParseVSE,
  IdFTPListParseVxWorks,
  IdFTPListParseWfFTP,
  IdFTPListParseWindowsNT,
  IdFTPListParseWinQVTNET,
  IdFTPListParseXecomMicroRTOS;  

注意: 

Note that is unit is simply for listing ALL FTP List parsers in Indy. //此单元 只用于列出Indy中的所有FTP列表解析器。
The user could then add this unit to a uses clause in their program and // 用户可以将这个单元添加到程序中的uses子句中,然后
have all FTP list parsers linked into their program.  //将所有FTP列表分析器链接到它们的程序中。

  

如果不uses 会发现 属性带出的 ItemType 属性都不准确,都会显示 ditFile,以下亲测代码,供参考:

var
  t:TIdFTPListItem;
begin
    t:=IdFTP1.DirectoryListing.Items[ListBox1.ItemIndex];
    ShowMessage(t.FileName);
    case t.ItemType of
      ditDirectory:  ShowMessage('ditDirectory');
      ditFile:  ShowMessage('ditFile');
      ditSymbolicLink:  ShowMessage('ditSymbolicLink');
      ditSymbolicLinkDir:  ShowMessage('ditSymbolicLinkDir');
      ditBlockDev:  ShowMessage('ditBlockDev');
      ditCharDev:  ShowMessage('ditCharDev');
      ditFIFO:  ShowMessage('ditFIFO');
      ditSocket:  ShowMessage('ditSocket');
    end;
end;

  

创建时间:2020.06.16  更新时间:

原文地址:https://www.cnblogs.com/guorongtao/p/13140211.html