Piscal Ssh Client cleanup

This commit is contained in:
2022-10-19 09:01:40 -04:00
parent e06d5d5b66
commit 0160c1d7b5
2 changed files with 9 additions and 9 deletions
+3 -3
View File
@@ -29,7 +29,7 @@ namespace LeafWeb.Core.Remote
private const string StatusRunning = "running";
private const string StatusNotStarted = "not started";
private readonly ILog _logger = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
private readonly ILog _logger = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod()?.DeclaringType);
private readonly int _connectionRetryCount = 3;
private readonly Policy _connectRetryPolicy;
@@ -37,11 +37,11 @@ namespace LeafWeb.Core.Remote
public PiscalSshClient(string connectionString)
{
if (string.IsNullOrEmpty(connectionString))
throw new ArgumentNullException("connectionString");
throw new ArgumentNullException(nameof(connectionString));
var conn = new DbConnectionStringBuilder {ConnectionString = connectionString};
_host = conn["host"] as string;
_port = int.Parse(conn.ContainsKey("port") ? conn["port"] as string : "22"); // default 22
_port = int.Parse(conn["port"] as string ?? "22"); // default 22
var username = conn["username"] as string;
var password = conn["password"] as string;
_connectionInfo = new PasswordConnectionInfo(_host, _port, username, password);