mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-04-12 03:57:32 +00:00
fix: Fixing DHCP status return type and Hostnames property name
This commit is contained in:
parent
d31b698cea
commit
99945b41a4
2 changed files with 11 additions and 13 deletions
|
|
@ -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
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
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()
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue