static void Main(string[] args) { var shell = new MySshStream("127.0.0.1", "Eugenio", "hoPaola5858"); shell.NewOutput += shell_NewOutput; shell.RunCommand("ls"); Console.ReadLine(); }
public async Task<bool> Connect(string host, string username, string password) { return await Task.Run<bool>(() => { try { sshStream = new MySshStream(host, username, password); sshStream.NewOutput += sshStream_NewOutput; return true; } catch (Exception ex) { MessageBox.Show("Error",ex.Message); return false; } }); }
static void shell_NewOutput(object sender, MySshStream.NewOutputEventArgs e) { Console.WriteLine(e.Line); }
void sshStream_NewOutput(object sender, MySshStream.NewOutputEventArgs e) { AddOutput(e.Line); }