fix: Fixing DHCP status return type and Hostnames property name

This commit is contained in:
Chris Cameron
2020-07-01 16:39:14 -04:00
parent d31b698cea
commit 99945b41a4
2 changed files with 11 additions and 13 deletions

View File

@@ -100,7 +100,7 @@ namespace ICD.Common.Utils
/// Gets the dhcp status of the processor.
/// </summary>
[PublicAPI]
public static string DhcpStatus
public static bool DhcpStatus
{
get
{
@@ -112,18 +112,18 @@ namespace ICD.Common.Utils
{
short id = CrestronEthernetHelper.GetAdapterdIdForSpecifiedAdapterType(type);
if (id >= InitialParametersClass.NumberOfEthernetInterfaces)
return null;
return false;
string status = CrestronEthernetHelper.GetEthernetParameter(param, id);
if (!string.IsNullOrEmpty(status) && !status.Equals(INVALID_VALUE))
return status;
return status == "ON";
return null;
return false;
}
catch (ArgumentException)
{
return null;
return false;
}
}
}
@@ -132,7 +132,7 @@ namespace ICD.Common.Utils
/// Gets the hostname of the processor.
/// </summary>
[PublicAPI]
public static IEnumerable<string> Hostname
public static IEnumerable<string> Hostnames
{
get
{

View File

@@ -53,24 +53,22 @@ namespace ICD.Common.Utils
/// Gets the dhcp status of the processor.
/// </summary>
[PublicAPI]
public static string DhcpStatus
public static bool DhcpStatus
{
get
{
try
{
bool enabled =
return
NetworkInterface.GetAllNetworkInterfaces()
.Where(ni => ni.NetworkInterfaceType == NetworkInterfaceType.Wireless80211 ||
ni.NetworkInterfaceType == NetworkInterfaceType.Ethernet)
.Select(ni => ni.GetIPProperties().GetIPv4Properties().IsDhcpEnabled)
.FirstOrDefault();
return enabled.ToString();
}
catch(PlatformNotSupportedException)
catch (PlatformNotSupportedException)
{
return false.ToString();
return false;
}
}
}
@@ -79,7 +77,7 @@ namespace ICD.Common.Utils
/// Gets the hostname of the processor.
/// </summary>
[PublicAPI]
public static IEnumerable<string> Hostname { get { yield return Dns.GetHostName(); } }
public static IEnumerable<string> Hostnames { get { yield return Dns.GetHostName(); } }
public static DateTime GetLocalTime()
{