mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-15 12:44:58 +00:00
Merge branch 'development' into hotfix/zoom-room-views
This commit is contained in:
@@ -77,10 +77,9 @@ namespace PepperDash.Essentials.Core
|
|||||||
var mParams = method.GetParameters();
|
var mParams = method.GetParameters();
|
||||||
|
|
||||||
var convertedParams = mParams
|
var convertedParams = mParams
|
||||||
.Select((p, i) => Convert.ChangeType(action.Params[i], p.ParameterType,
|
.Select((p, i) => ConvertType(action.Params[i], p.ParameterType))
|
||||||
System.Globalization.CultureInfo.InvariantCulture))
|
|
||||||
.ToArray();
|
.ToArray();
|
||||||
var ret = method.Invoke(obj, convertedParams);
|
method.Invoke(obj, convertedParams);
|
||||||
|
|
||||||
CrestronConsole.ConsoleCommandResponse("Method {0} successfully called on device {1}", method.Name,
|
CrestronConsole.ConsoleCommandResponse("Method {0} successfully called on device {1}", method.Name,
|
||||||
action.DeviceKey);
|
action.DeviceKey);
|
||||||
@@ -91,6 +90,23 @@ namespace PepperDash.Essentials.Core
|
|||||||
ex.Message);}
|
ex.Message);}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static object ConvertType(object value, Type conversionType)
|
||||||
|
{
|
||||||
|
if (!conversionType.IsEnum)
|
||||||
|
{
|
||||||
|
return Convert.ChangeType(value, conversionType, System.Globalization.CultureInfo.InvariantCulture);
|
||||||
|
}
|
||||||
|
|
||||||
|
var stringValue = Convert.ToString(value);
|
||||||
|
|
||||||
|
if (String.IsNullOrEmpty(stringValue))
|
||||||
|
{
|
||||||
|
throw new InvalidCastException(
|
||||||
|
String.Format("{0} cannot be converted to a string prior to conversion to enum"));
|
||||||
|
}
|
||||||
|
return Enum.Parse(conversionType, stringValue, true);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the properties on a device
|
/// Gets the properties on a device
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -275,6 +291,8 @@ namespace PepperDash.Essentials.Core
|
|||||||
//var props = t.GetProperties().Select(p => new PropertyNameType(p, obj));
|
//var props = t.GetProperties().Select(p => new PropertyNameType(p, obj));
|
||||||
//return JsonConvert.SerializeObject(props, Formatting.Indented);
|
//return JsonConvert.SerializeObject(props, Formatting.Indented);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class DeviceActionWrapper
|
public class DeviceActionWrapper
|
||||||
|
|||||||
@@ -435,7 +435,7 @@ namespace PepperDash.Essentials.Core
|
|||||||
var min = Convert.ToUInt32(timeout);
|
var min = Convert.ToUInt32(timeout);
|
||||||
|
|
||||||
device.StreamDebugging.SetDebuggingWithSpecificTimeout(debugSetting, min);
|
device.StreamDebugging.SetDebuggingWithSpecificTimeout(debugSetting, min);
|
||||||
Debug.Console(0, "Device: '{0}' debug level set to {1) for {2} minutes", deviceKey, debugSetting, min);
|
Debug.Console(0, "Device: '{0}' debug level set to {1} for {2} minutes", deviceKey, debugSetting, min);
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
|||||||
Reference in New Issue
Block a user