/// <summary> /// Split a multi-line file list text response and add the parsed items to the collection. /// </summary> /// <param name="ftpCmdInstance"></param> /// <param name="path">Path to the item on the FTP server.</param> /// <param name="dirResults">The multi-line file list text from the FTP server.</param> public MlstCollection(FtpClientExt ftpCmdInstance, string path, FtpResponseCollection dirResults) { if (ftpCmdInstance == null) { throw new ArgumentNullException("ftpCmdInstance"); } this.ftpCmdInstance = ftpCmdInstance; this.path = path; Parse(dirResults); }
private void ConnectFTP() { try { ftpFileClient = new FtpClientExt(new FtpClient(csd.TargetMachineName, csd.Port, csd.SecurityProtocol), csd.BufferWireTransferSize); ftpFileClient.Open(csd.UserName, csd.Password); fsi.Open((FileMode)rawCreationDisposition); completedOpen = true; } catch (Exception ex) { throw; } }
public DirectoryFTPInfo(FtpClientExt ftpCmdInstance, string path) : base(ftpCmdInstance, path) { }
protected FileSystemFTPInfo(FtpClientExt ftpCmdInstance, string path) { this.path = path; FtpCmdInstance = ftpCmdInstance; }
public static List <FileSystemFTPInfo> ConvertFrom(FtpItemCollection results, FtpClientExt ftpCmdInstance) { List <FileSystemFTPInfo> _list = new List <FileSystemFTPInfo>(results.Count); foreach (FtpItem item in results) { FileSystemFTPInfo info = (item.ItemType == FtpItemType.Directory) ? (FileSystemFTPInfo) new DirectoryFTPInfo(ftpCmdInstance, item.FullPath) : new FileFTPInfo(ftpCmdInstance, item.FullPath); // Set it to be offline to allow explorer some extra time to find details before timg out. info.attributes = (item.ItemType == FtpItemType.Directory) ? FileAttributes.Directory : FileAttributes.Offline; if (item.Attributes[0] == 'l') { info.attributes |= FileAttributes.ReparsePoint; } // drwx- if ((item.Attributes[1] == 'r') && (item.Attributes[2] != 'w') ) { info.attributes |= FileAttributes.ReadOnly; } info.length = item.Size; info.creationTimeUtc = item.Modified; info.lastWriteTimeUtc = item.Modified; _list.Add(info); } return(_list); }
public FileFTPInfo(FtpClientExt ftpCmdInstance, string path) : base(ftpCmdInstance, path) { }