using System; using System.Net.NetworkInformation; namespace Mip { public class AppOptions { public string Host { get; set; } public string Port { get; set; } public string LoginName { get; set; } public string Password { get; set; } public string Database { get; set; } public bool Connetable { get; set; } public AppOptions(string host, string port, string loginName, string password, string database) { Host = host; Port = port; LoginName = loginName; Password = password; Database = database; Connetable = CheckConnectivity(); } private bool CheckConnectivity() { Ping pingIP = new Ping(); try { var pingReply = pingIP.Send(Host); return pingReply.Status.ToString() == "Success"; } catch (Exception) { return false; } } } }