private void SSHInfoDelete(SSHInfo info) { SSHInfoHashSet.Remove(info); SshClient ssh = new SshClient(info.IP, int.Parse(info.Port), info.UserName, info.Password); if (info.Type == "NAS") { foreach (var sshClient in SSHNASClientList) { if (sshClient.ToString() == ssh.ToString()) { SSHNASClientList.Remove(sshClient); break; } } } else { foreach (var sshClient in SSHWSLClientList) { if (sshClient.ToString() == ssh.ToString()) { SSHWSLClientList.Remove(sshClient); break; } } } ConfigFileSave(); }
private void SSHSave() { if (SSHUserName != null && SSHIP != null && SSHPort != null && SSHSystem != null && SSHType != null && SSHPassword != null) { var newSSHInfo = new SSHInfo(SSHUserName, SSHIP, SSHPort, SSHSystem, SSHType, SSHPassword); SSHInfoHashSet.Add(newSSHInfo); SshClient ssh = new SshClient(newSSHInfo.IP, int.Parse(newSSHInfo.Port), newSSHInfo.UserName, newSSHInfo.Password); if (newSSHInfo.Type == "NAS") { SSHNASClientList.Add(ssh); } else { SSHWSLClientList.Add(ssh); } ssh.Connect(); ResetSSHVars(); } ConfigFileSave(); }