mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-15 20:54:55 +00:00
Fixes for the static GetPropertyByName method in DeviceJsonApi...now returns a property object rather than a PropertyInfo object
This commit is contained in:
@@ -83,13 +83,13 @@ namespace PepperDash.Essentials.Core
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static object GetPropertyByName(string deviceObjectPath, string propertyName)
|
public static object GetPropertyByName(string deviceObjectPath, string propertyName)
|
||||||
{
|
{
|
||||||
var obj = FindObjectOnPath(deviceObjectPath);
|
var dev = FindObjectOnPath(deviceObjectPath);
|
||||||
if(obj == null)
|
if(dev == null)
|
||||||
return "{ \"error\":\"No Device\"}";
|
return "{ \"error\":\"No Device\"}";
|
||||||
|
|
||||||
CType t = obj.GetType();
|
object prop = dev.GetType().GetCType().GetProperty(propertyName).GetValue(dev, null);
|
||||||
|
|
||||||
var prop = t.GetProperty(propertyName);
|
// var prop = t.GetProperty(propertyName);
|
||||||
if (prop != null)
|
if (prop != null)
|
||||||
{
|
{
|
||||||
return prop;
|
return prop;
|
||||||
|
|||||||
Reference in New Issue
Block a user