Example #1
0
 internal SessionConnected(Session h, ControlChannel ctrl, bool caseInsensitive)
 {
     m_host = h;
     m_ctrlChannel = ctrl;
     m_ctrlChannel.Session = this;
     m_caseInsensitive = caseInsensitive;
 }
Example #2
0
        public FileWatcher()
        {
            m_enabled = true;
            m_notifyOnComplete = true;
            m_currentFiles = new List<File>();
            m_newFiles = new List<File>();

            m_session = new Session(false);
            m_session.CommandSent += Session_CommandSent;
            m_session.ResponseReceived += Session_ResponseReceived;

            // Define a timer to watch for new files
            m_watchTimer = new System.Timers.Timer();
            m_watchTimer.Elapsed += WatchTimer_Elapsed;
            m_watchTimer.AutoReset = false;
            m_watchTimer.Interval = 5000;
            m_watchTimer.Enabled = false;

            // Define a timer for FTP connection in case of availability failures
            m_restartTimer = new System.Timers.Timer();
            m_restartTimer.Elapsed += RestartTimer_Elapsed;
            m_restartTimer.AutoReset = false;
            m_restartTimer.Interval = 10000;
            m_restartTimer.Enabled = false;
        }
Example #3
0
 internal ControlChannel(Session host)
 {
     m_connection = new TcpClient();
     m_server = "localhost";
     m_port = 21;
     m_sessionHost = host;
     m_currentTransferMode = TransferMode.Unknown;
 }
Example #4
0
 internal SessionDisconnected(Session h, bool caseInsensitive)
 {
     m_port = 21;
     m_host = h;
     m_caseInsensitive = caseInsensitive;
 }
Example #5
0
        public virtual Session NewDirectorySession()
        {
            // This method is just for convenience.  We can't allow the end user to use the
            // actual internal directory for sending files or other work because it is
            // constantly being refreshed/used etc., so we instead create a new FTP Session
            // based on the current internal session and watch directory information
            Session newSession = new Session(m_session.CaseInsensitive);

            newSession.Server = m_session.Server;
            newSession.Connect(m_username, m_password);
            newSession.SetCurrentDirectory(m_watchDirectory);

            return newSession;
        }
Example #6
0
        protected override void Dispose(bool disposing)
        {
            try
            {
                if (!m_disposed)
                {
                    if (disposing)
                    {
                        Close();

                        if (m_session != null)
                        {
                            m_session.CommandSent -= Session_CommandSent;
                            m_session.ResponseReceived -= Session_ResponseReceived;
                            m_session.Dispose();
                        }
                        m_session = null;

                        if (m_watchTimer != null)
                        {
                            m_watchTimer.Elapsed -= WatchTimer_Elapsed;
                            m_watchTimer.Dispose();
                        }
                        m_watchTimer = null;

                        if (m_restartTimer != null)
                        {
                            m_restartTimer.Elapsed -= RestartTimer_Elapsed;
                            m_restartTimer.Dispose();
                        }
                        m_restartTimer = null;
                    }
                }

                m_disposed = true;
            }
            finally
            {
                base.Dispose(disposing);
            }
        }