public bool Excute(string name, string command) { string[] data = dbr.AccessNetworkElement(name); string IP = data[0]; string username = data[1]; string password = data[2]; try { using (var client = new SshClient(IP, username, password)) { client.Connect(); var cmd = client.RunCommand(command); if (FileParser.SetSavingPath()) { FileParser.CreateDirectory(); FileParser.SaveResult(name, IP, cmd.CommandText, cmd.Result); FileParser.CreateZip(); } client.Disconnect(); return(true); } } catch (Exception ex) { FileParser.LogException(ex); return(false); } }
public void ExcuteButtonPressed() { if (FileParser.SetSavingPath()) { FileParser.CreateDirectory(); workbookProcessor.ExcuteCommands(); FileParser.CreateZip(); } }