public ReturnBox RunRemote(SshClient ssh, string cmd, int timeout_secs = 3600) { ReturnBox r = new ReturnBox(); if (ssh.IsConnected) { try { SshCommand command = ssh.CreateCommand(cmd); command.CommandTimeout = TimeSpan.FromSeconds(timeout_secs); r.Output = command.Execute(); r.Error = command.Error; r.ExitCode = command.ExitStatus; } catch (Exception ex) { r.Error = ex.Message; } } r.Success = r.ExitCode == 0 && String.IsNullOrEmpty(r.Error); return(r); }
public MainWindow(ReturnBox rb) { InitializeComponent(); DataContext = new MainWindowViewModel(rb); }