mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-04-12 03:57:32 +00:00
fix: catch PlatformNotSupportedException for linux systems
This commit is contained in:
parent
80786dd84c
commit
9cdc8b26a2
1 changed files with 14 additions and 7 deletions
|
|
@ -57,14 +57,21 @@ namespace ICD.Common.Utils
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
bool enabled =
|
try
|
||||||
NetworkInterface.GetAllNetworkInterfaces()
|
{
|
||||||
.Where(ni => ni.NetworkInterfaceType == NetworkInterfaceType.Wireless80211 ||
|
bool enabled =
|
||||||
ni.NetworkInterfaceType == NetworkInterfaceType.Ethernet)
|
NetworkInterface.GetAllNetworkInterfaces()
|
||||||
.Select(ni => ni.GetIPProperties().GetIPv4Properties().IsDhcpEnabled)
|
.Where(ni => ni.NetworkInterfaceType == NetworkInterfaceType.Wireless80211 ||
|
||||||
.FirstOrDefault();
|
ni.NetworkInterfaceType == NetworkInterfaceType.Ethernet)
|
||||||
|
.Select(ni => ni.GetIPProperties().GetIPv4Properties().IsDhcpEnabled)
|
||||||
|
.FirstOrDefault();
|
||||||
|
|
||||||
return enabled.ToString();
|
return enabled.ToString();
|
||||||
|
}
|
||||||
|
catch(PlatformNotSupportedException)
|
||||||
|
{
|
||||||
|
return false.ToString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue