Inheritance: IFtpSessionState
コード例 #1
0
ファイル: FtpDirectory.cs プロジェクト: ellen50/gsf
        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;
        }
コード例 #2
0
ファイル: FtpFile.cs プロジェクト: qxp1011/gsf
        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);
        }
コード例 #3
0
ファイル: FtpDataStream.cs プロジェクト: ellen50/gsf
 internal FtpDataStream(FtpControlChannel ctrl, TcpClient client)
 {
     m_session   = ctrl.Session;
     m_ctrl      = ctrl;
     m_tcpClient = client;
     m_stream    = client.GetStream();
     m_session.BeginDataTransfer(this);
 }
コード例 #4
0
ファイル: FtpDataStream.cs プロジェクト: rmc00/gsf
 internal FtpDataStream(FtpControlChannel ctrl, TcpClient client)
 {
     m_session = ctrl.Session;
     m_ctrl = ctrl;
     m_tcpClient = client;
     m_stream = client.GetStream();
     m_session.BeginDataTransfer(this);
 }
コード例 #5
0
 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();
 }
コード例 #6
0
        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;
            }
        }
コード例 #7
0
        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;
        }
コード例 #8
0
ファイル: FtpDirectory.cs プロジェクト: ellen50/gsf
        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 + "/";
            }
        }
コード例 #9
0
ファイル: FtpFileTransferer.cs プロジェクト: rmc00/gsf
        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;
            }
        }