diff --git a/CLZ Builds/PepperDash_Core.clz b/CLZ Builds/PepperDash_Core.clz index da067cd..40350bf 100644 Binary files a/CLZ Builds/PepperDash_Core.clz and b/CLZ Builds/PepperDash_Core.clz differ diff --git a/CLZ Builds/PepperDash_Core.dll b/CLZ Builds/PepperDash_Core.dll index dbd207a..8ac60b2 100644 Binary files a/CLZ Builds/PepperDash_Core.dll and b/CLZ Builds/PepperDash_Core.dll differ diff --git a/Pepperdash Core/Pepperdash Core/Comm/GenericSshClient.cs b/Pepperdash Core/Pepperdash Core/Comm/GenericSshClient.cs index 681ecfc..3d1101a 100644 --- a/Pepperdash Core/Pepperdash Core/Comm/GenericSshClient.cs +++ b/Pepperdash Core/Pepperdash Core/Comm/GenericSshClient.cs @@ -212,55 +212,28 @@ namespace PepperDash.Core kauth.AuthenticationPrompt += new EventHandler(kauth_AuthenticationPrompt); PasswordAuthenticationMethod pauth = new PasswordAuthenticationMethod(Username, Password); - // Make a new client if we need it or things have changed - //if (Client == null || PropertiesHaveChanged()) - //{ - if (Client != null) - { - Debug.Console(1, this, "Cleaning up disconnected client"); - Client.ErrorOccurred -= Client_ErrorOccurred; - KillStream(); - - //if (TheStream != null) - //{ - // TheStream.DataReceived -= Stream_DataReceived; - // TheStream.ErrorOccurred -= TheStream_ErrorOccurred; - //} - //TheStream = null; - } + if (Client != null) + { + Debug.Console(1, this, "Cleaning up disconnected client"); + Client.ErrorOccurred -= Client_ErrorOccurred; + KillStream(); + } - Debug.Console(1, this, "Creating new SshClient"); - ConnectionInfo connectionInfo = new ConnectionInfo(Hostname, Port, Username, pauth, kauth); - Client = new SshClient(connectionInfo); - Client.ErrorOccurred += Client_ErrorOccurred; - //} - //PreviousHostname = Hostname; - //PreviousPassword = Password; - //PreviousPort = Port; - //PreviousUsername = Username; + Debug.Console(1, this, "Creating new SshClient"); + ConnectionInfo connectionInfo = new ConnectionInfo(Hostname, Port, Username, pauth, kauth); + Client = new SshClient(connectionInfo); + Client.ErrorOccurred += Client_ErrorOccurred; //You can do it! ClientStatus = SocketStatus.SOCKET_STATUS_WAITING; try { Client.Connect(); - - // Have to assume client is connected cause Client.IsConnected is busted in some cases - // All other conditions *should* error out... - //if (Client.IsConnected) - //{ - //Client.KeepAliveInterval = TimeSpan.FromSeconds(2); - //Client.SendKeepAlive(); - TheStream = Client.CreateShellStream("PDTShell", 100, 80, 100, 200, 65534); - TheStream.DataReceived += Stream_DataReceived; - //TheStream.ErrorOccurred += TheStream_ErrorOccurred; - Debug.Console(1, this, "Connected"); - ClientStatus = SocketStatus.SOCKET_STATUS_CONNECTED; - //PreviousHostname = Hostname; - //PreviousPassword = Password; - //PreviousPort = Port; - //PreviousUsername = Username; - //} + TheStream = Client.CreateShellStream("PDTShell", 100, 80, 100, 200, 65534); + TheStream.DataReceived += Stream_DataReceived; + //TheStream.ErrorOccurred += TheStream_ErrorOccurred; + Debug.Console(1, this, "Connected"); + ClientStatus = SocketStatus.SOCKET_STATUS_CONNECTED; return; // Success will not pass here } catch (SshConnectionException e) diff --git a/Pepperdash Core/Pepperdash Core/Logging/Debug.cs b/Pepperdash Core/Pepperdash Core/Logging/Debug.cs index fbaca1e..ef7e927 100644 --- a/Pepperdash Core/Pepperdash Core/Logging/Debug.cs +++ b/Pepperdash Core/Pepperdash Core/Logging/Debug.cs @@ -234,7 +234,7 @@ namespace PepperDash.Core } /// - /// Appends a device Key to the beginning of a message + /// Logs to Console when at-level, and all messages to error log, including device key /// public static void Console(uint level, IKeyed dev, string format, params object[] items) { @@ -245,23 +245,26 @@ namespace PepperDash.Core public static void Console(uint level, IKeyed dev, ErrorLogLevel errorLogLevel, string format, params object[] items) { + var str = string.Format("[{0}] {1}", dev.Key, string.Format(format, items)); + LogError(errorLogLevel, str); if (Level >= level) { - var str = string.Format("[{0}] {1}", dev.Key, string.Format(format, items)); Console(level, str); - LogError(errorLogLevel, str); } } + /// + /// Logs to Console when at-level, and all messages to error log + /// public static void Console(uint level, ErrorLogLevel errorLogLevel, string format, params object[] items) { - if (Level >= level) - { - var str = string.Format(format, items); - Console(level, str); - LogError(errorLogLevel, str); - } + var str = string.Format(format, items); + LogError(errorLogLevel, str); + if (Level >= level) + { + Console(level, str); + } } /// diff --git a/Pepperdash Core/Pepperdash Core/Properties/AssemblyInfo.cs b/Pepperdash Core/Pepperdash Core/Properties/AssemblyInfo.cs index 49bb1c0..fc78114 100644 --- a/Pepperdash Core/Pepperdash Core/Properties/AssemblyInfo.cs +++ b/Pepperdash Core/Pepperdash Core/Properties/AssemblyInfo.cs @@ -4,4 +4,4 @@ [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Pepperdash_Core")] [assembly: AssemblyCopyright("Copyright © PepperDash 2016")] -[assembly: AssemblyVersion("1.0.7.*")] +[assembly: AssemblyVersion("1.0.8.*")]