mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-02-17 13:45:05 +00:00
fix: Fixing DHCP status return type and Hostnames property name
This commit is contained in:
@@ -100,7 +100,7 @@ namespace ICD.Common.Utils
|
|||||||
/// Gets the dhcp status of the processor.
|
/// Gets the dhcp status of the processor.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[PublicAPI]
|
[PublicAPI]
|
||||||
public static string DhcpStatus
|
public static bool DhcpStatus
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
@@ -112,18 +112,18 @@ namespace ICD.Common.Utils
|
|||||||
{
|
{
|
||||||
short id = CrestronEthernetHelper.GetAdapterdIdForSpecifiedAdapterType(type);
|
short id = CrestronEthernetHelper.GetAdapterdIdForSpecifiedAdapterType(type);
|
||||||
if (id >= InitialParametersClass.NumberOfEthernetInterfaces)
|
if (id >= InitialParametersClass.NumberOfEthernetInterfaces)
|
||||||
return null;
|
return false;
|
||||||
|
|
||||||
string status = CrestronEthernetHelper.GetEthernetParameter(param, id);
|
string status = CrestronEthernetHelper.GetEthernetParameter(param, id);
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(status) && !status.Equals(INVALID_VALUE))
|
if (!string.IsNullOrEmpty(status) && !status.Equals(INVALID_VALUE))
|
||||||
return status;
|
return status == "ON";
|
||||||
|
|
||||||
return null;
|
return false;
|
||||||
}
|
}
|
||||||
catch (ArgumentException)
|
catch (ArgumentException)
|
||||||
{
|
{
|
||||||
return null;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -132,7 +132,7 @@ namespace ICD.Common.Utils
|
|||||||
/// Gets the hostname of the processor.
|
/// Gets the hostname of the processor.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[PublicAPI]
|
[PublicAPI]
|
||||||
public static IEnumerable<string> Hostname
|
public static IEnumerable<string> Hostnames
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -53,24 +53,22 @@ namespace ICD.Common.Utils
|
|||||||
/// Gets the dhcp status of the processor.
|
/// Gets the dhcp status of the processor.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[PublicAPI]
|
[PublicAPI]
|
||||||
public static string DhcpStatus
|
public static bool DhcpStatus
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
bool enabled =
|
return
|
||||||
NetworkInterface.GetAllNetworkInterfaces()
|
NetworkInterface.GetAllNetworkInterfaces()
|
||||||
.Where(ni => ni.NetworkInterfaceType == NetworkInterfaceType.Wireless80211 ||
|
.Where(ni => ni.NetworkInterfaceType == NetworkInterfaceType.Wireless80211 ||
|
||||||
ni.NetworkInterfaceType == NetworkInterfaceType.Ethernet)
|
ni.NetworkInterfaceType == NetworkInterfaceType.Ethernet)
|
||||||
.Select(ni => ni.GetIPProperties().GetIPv4Properties().IsDhcpEnabled)
|
.Select(ni => ni.GetIPProperties().GetIPv4Properties().IsDhcpEnabled)
|
||||||
.FirstOrDefault();
|
.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.
|
/// Gets the hostname of the processor.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[PublicAPI]
|
[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()
|
public static DateTime GetLocalTime()
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user