/// <summary> /// Öffnet die Verriegelung der Wohnungstür /// </summary> public void Unlock(ConnectInfo remoteConfig) { try { Logger.LogDebug(AppResources.Log_Sphinx_StartDoorUnlock); Shell.RemoteConfig = remoteConfig; Shell.ExecuteCommand(UnlockCommand); Logger.LogDebug(AppResources.Log_Sphinx_EndDoorUnlock); } catch (Exception ex) { Logger.LogError(ex); } }
public TyShell(ConnectInfo remoteConfig, SpaceControlLogger logger) { Logger = logger; RemoteConfig = remoteConfig; }
private SshClient GetOrCreateSshClient(ConnectInfo remote) { if (remote.PrivateKeyFile == null || remote.PrivateKeyFile.Count() <= 0) return new SshClient(remote.Hostname, remote.Port, remote.Username, remote.Password); using (var stream = new MemoryStream(remote.PrivateKeyFile)) { var privateKeyFile = string.IsNullOrEmpty(remote.PrivateKeyFilePassPhrase) ? new PrivateKeyFile(stream) : new PrivateKeyFile(stream, remote.PrivateKeyFilePassPhrase); return new SshClient(remote.Hostname, remote.Port, remote.Username, new[] { privateKeyFile }); } }
protected bool Equals(ConnectInfo other) { return string.Equals(Hostname, other.Hostname) && Port == other.Port && TimeoutInSeconds == other.TimeoutInSeconds && string.Equals(Username, other.Username) && string.Equals(Password, other.Password) && Equals(PrivateKeyFile, other.PrivateKeyFile) && string.Equals(PrivateKeyFilePassPhrase, other.PrivateKeyFilePassPhrase); }
protected const string UnlockCommand = "unlock"; // Kommando auf der TyShell zum Entriegeln der Wohnungstür #endregion Fields #region Constructors public Sphinx(ConnectInfo remoteShellConnectionInfo, SpaceControlLogger logger) { Logger = logger; Shell = new TyShell(remoteShellConnectionInfo, Logger); }