Ejemplo n.º 1
0
        /// <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);
            }
        }
Ejemplo n.º 2
0
 public TyShell(ConnectInfo remoteConfig, SpaceControlLogger logger)
 {
     Logger = logger;
     RemoteConfig = remoteConfig;
 }
Ejemplo n.º 3
0
        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 });
            }
        }
Ejemplo n.º 4
0
 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);
 }
Ejemplo n.º 5
0
        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);
        }