private static void StopMonitorMode(SftpClient sftpClient, SshClient sshClient, FileSystemMonitor fsmonitor)
        {
            Terminal.WriteLine();

            fsmonitor.Stop();
            Terminal.WriteLine("File System monitor was stopped.");

            if (sftpClient.IsConnected)
            {
                sftpClient.Disconnect();
            }

            Terminal.WriteLine("SFTP client disconnected.");

            if (sshClient.IsConnected)
            {
                sshClient.Disconnect();
            }

            Terminal.WriteLine("SSH client disconnected.");
            Terminal.WriteLine("Application will exit now.");
        }
示例#2
0
        /// <summary>
        /// Stops the monitor mode by closing SFTP and SSH connections, and stopping the File System Monitor.
        /// </summary>
        /// <param name="sftpClient">The SFTP client.</param>
        /// <param name="sshClient">The SSH client.</param>
        /// <param name="fsMonitor">The fs monitor.</param>
        private static void StopMonitorMode(SftpClient sftpClient, SshClient sshClient, FileSystemMonitor fsMonitor)
        {
            ConsoleManager.WriteLine(string.Empty);

            fsMonitor.Stop();
            ConsoleManager.WriteLine("File System monitor was stopped.");

            if (sftpClient.IsConnected == true)
            {
                sftpClient.Disconnect();
            }

            ConsoleManager.WriteLine("SFTP client disconnected.");

            if (sshClient.IsConnected == true)
            {
                sshClient.Disconnect();
            }

            ConsoleManager.WriteLine("SSH client disconnected.");
            ConsoleManager.WriteLine("Application will exit now.");
        }