internal FtpDirectory(FtpSessionConnected s, FtpDirectory parent, bool caseInsensitive, ItemInfo info) { m_session = s; m_parent = parent; m_caseInsensitive = caseInsensitive; if (info.Name.Length > 0) { m_name = info.Name; if ((object)parent == null) { m_fullPath = m_name + "/"; } else { m_fullPath = parent.FullPath + m_name + "/"; } } else { m_name = ""; m_fullPath = "/"; } m_size = info.Size; m_permission = info.Permission; m_timestamp = info.TimeStamp.Value; }
private FtpDataStream GetStream(long offset, TransferDirection dir) { m_parent.CheckSessionCurrentDirectory(); FtpSessionConnected Session = m_parent.Session; if (offset != 0) { Session.ControlChannel.REST(offset); } FtpDataStream stream = Session.ControlChannel.GetDataStream(dir); try { if (dir == TransferDirection.Download) { Session.ControlChannel.RETR(m_name); } else { Session.ControlChannel.STOR(m_name); } } catch { stream.Close(); throw; } return(stream); }
internal FtpDataStream(FtpControlChannel ctrl, TcpClient client) { m_session = ctrl.Session; m_ctrl = ctrl; m_tcpClient = client; m_stream = client.GetStream(); m_session.BeginDataTransfer(this); }
internal FtpDataStream(FtpControlChannel ctrl, TcpClient client) { m_session = ctrl.Session; m_ctrl = ctrl; m_tcpClient = client; m_stream = client.GetStream(); m_stream.ReadTimeout = ctrl.Timeout; m_stream.WriteTimeout = ctrl.Timeout; TryBeginDataTransfer(); }
internal FtpFileTransferer(FtpDirectory transferStarter, string localFile, string remoteFile, long totalBytes, TransferDirection dir) { TransferDirection = dir; m_session = transferStarter.Session; LocalFileName = localFile; RemoteFileName = remoteFile; TotalBytes = totalBytes; if (dir == TransferDirection.Upload) { m_streamCopyRoutine = LocalToRemote; m_ftpFileCommandRoutine = m_session.ControlChannel.STOR; } else { m_streamCopyRoutine = RemoteToLocal; m_ftpFileCommandRoutine = m_session.ControlChannel.RETR; } }
internal FtpDirectory(FtpSessionConnected s, FtpDirectory parent, bool caseInsensitive, ItemInfo info) { Session = s; m_parent = parent; m_caseInsensitive = caseInsensitive; if (info.Name.Length > 0) { Name = info.Name; FullPath = parent == null ? $"{Name}/" : $"{parent.FullPath}{Name}/"; } else { Name = ""; FullPath = "/"; } Size = info.Size; Permission = info.Permission; Timestamp = info.TimeStamp.Value; }
internal FtpDirectory(FtpSessionConnected s, bool caseInsensitive, string fullPath) { m_session = s; m_parent = null; m_caseInsensitive = caseInsensitive; if (fullPath.Substring(fullPath.Length - 1, 1) == "/") { fullPath = fullPath.Substring(0, fullPath.Length - 1); } if (fullPath.Length == 0) { m_name = ""; m_fullPath = "/"; } else { string[] directories = fullPath.Split('/'); m_name = directories[directories.Length - 1]; m_fullPath = fullPath + "/"; } }
internal FtpFileTransferer(FtpDirectory transferStarter, string localFile, string remoteFile, long totalBytes, TransferDirection dir) { m_transferStarter = transferStarter; m_transferDirection = dir; m_session = transferStarter.Session; m_localFile = localFile; m_remoteFile = remoteFile; m_totalBytes = totalBytes; if (dir == TransferDirection.Upload) { m_streamCopyRoutine = LocalToRemote; m_ftpFileCommandRoutine = m_session.ControlChannel.STOR; } else { m_streamCopyRoutine = RemoteToLocal; m_ftpFileCommandRoutine = m_session.ControlChannel.RETR; } }