mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-04-13 20:47:24 +00:00
fix: Ignoring Crestron ethernet parameters that say "Invalid Value"
This commit is contained in:
parent
49f8f116fd
commit
89f0214cce
2 changed files with 17 additions and 6 deletions
|
|
@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
- Network/MAC/DNS address utils are now enumerating all adapter types
|
- Network/MAC/DNS address utils are now enumerating all adapter types
|
||||||
|
- Ignoring Crestron ethernet parameters that say "Invalid Value"
|
||||||
|
|
||||||
## [10.2.0] - 2019-12-04
|
## [10.2.0] - 2019-12-04
|
||||||
### Added
|
### Added
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,19 @@
|
||||||
using ICD.Common.Utils.Extensions;
|
#if SIMPLSHARP
|
||||||
#if SIMPLSHARP
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Crestron.SimplSharp;
|
using Crestron.SimplSharp;
|
||||||
using ICD.Common.Properties;
|
using ICD.Common.Properties;
|
||||||
|
using ICD.Common.Utils.Extensions;
|
||||||
|
|
||||||
namespace ICD.Common.Utils
|
namespace ICD.Common.Utils
|
||||||
{
|
{
|
||||||
public static partial class IcdEnvironment
|
public static partial class IcdEnvironment
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// For some reason crestron returns "Invalid Value" for ethernet parameters sometimes :/
|
||||||
|
/// </summary>
|
||||||
|
private const string INVALID_VALUE = "Invalid Value";
|
||||||
|
|
||||||
#region Properties
|
#region Properties
|
||||||
|
|
||||||
public static string NewLine { get { return CrestronEnvironment.NewLine; } }
|
public static string NewLine { get { return CrestronEnvironment.NewLine; } }
|
||||||
|
|
@ -48,7 +53,7 @@ namespace ICD.Common.Utils
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(address))
|
if (!string.IsNullOrEmpty(address) && !address.Equals(INVALID_VALUE))
|
||||||
yield return address;
|
yield return address;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -79,7 +84,7 @@ namespace ICD.Common.Utils
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(macAddress))
|
if (!string.IsNullOrEmpty(macAddress) && !macAddress.Equals(INVALID_VALUE))
|
||||||
yield return macAddress;
|
yield return macAddress;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -100,7 +105,12 @@ namespace ICD.Common.Utils
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
short id = CrestronEthernetHelper.GetAdapterdIdForSpecifiedAdapterType(type);
|
short id = CrestronEthernetHelper.GetAdapterdIdForSpecifiedAdapterType(type);
|
||||||
return CrestronEthernetHelper.GetEthernetParameter(param, id);
|
string status = CrestronEthernetHelper.GetEthernetParameter(param, id);
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(status) && !status.Equals(INVALID_VALUE))
|
||||||
|
return status;
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
catch (ArgumentException)
|
catch (ArgumentException)
|
||||||
{
|
{
|
||||||
|
|
@ -134,7 +144,7 @@ namespace ICD.Common.Utils
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(hostname))
|
if (!string.IsNullOrEmpty(hostname) && !hostname.Equals(INVALID_VALUE))
|
||||||
yield return hostname;
|
yield return hostname;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue