private void Parse(string path, string fileList, IFtpsItemParser itemParser) { string[] lines = SplitFileList(fileList); int length = lines.Length - 1; for (int i = 0; i <= length; i++) { FtpsItem item = itemParser.ParseLine(lines[i]); if (item != null) { // set the parent path to the value passed in item.SetParentPath(path); _list.Add(item); _totalSize += item.Size; } } }
/// <summary> /// Split a multi-line file list text response and add the parsed items to the collection. /// </summary> /// <param name="path">Path to the item on the FTP server.</param> /// <param name="fileList">The multi-line file list text from the FTP server.</param> /// <param name="itemParser">Line item parser object used to parse each line of fileList data.</param> public FtpsItemCollection(string path, string fileList, IFtpsItemParser itemParser) { Parse(path, fileList, itemParser); }
private void CreateItemParsers() { // if the custom item parser is not set then set to use the built-in generic parser if (_listItemParser == null) _listItemParser = new FtpsListItemParser(); // create the MLSx item parser _mlsxItemParser = new FtpsMlsxItemParser(); }