private static JsonExtensionDataItem UnpackExtensionDataMember(object Item) { PropertyInfo NameProperty; JsonExtensionDataItem ReturnValue = null; PropertyInfo ValueProperty; NameProperty = FindProperty(Item, "Name"); ValueProperty = FindProperty(Item, "Value"); if (NameProperty != null && ValueProperty != null) { string Name; object Value; Name = NameProperty.GetValue(Item).ToString(); Value = ValueProperty.GetValue(Item); if (Value != null) { switch (Value.GetType().Name) { case "DataNode`1": PropertyInfo ItemValueProperty; PropertyInfo TypeProperty; TypeProperty = FindProperty(Value, "DataType"); ItemValueProperty = FindProperty(Value, "Value"); if (TypeProperty != null && ItemValueProperty != null) { Type DataType; object ItemValue; DataType = (Type)TypeProperty.GetValue(Value); ItemValue = ItemValueProperty.GetValue(Value); ReturnValue = new JsonExtensionDataItem(Name, DataType, ItemValue); } break; case "ClassDataNode": JsonExtensionDataItemCollection NewItems; NewItems = UnpackExtensionDataMembers(Value); ReturnValue = new JsonExtensionDataItem(Name, NewItems); break; case "CollectionDataNode": break; default: Console.WriteLine("WTF"); break; } } } return(ReturnValue); }
public bool TryReadValue(object optional, out bool has, out object value) { if (Type.IsInstanceOfType(optional)) { has = (bool)HasValueProperty.GetValue(optional); value = ValueProperty.GetValue(optional); return(true); } has = false; value = null; return(false); }
void IFlowExecutionComponent.FlowExecution(Flow flow, Flow.ExecutionStackItem entryItem) { if (valueProperty != null) { var value = valueProperty.GetValue(this, null); valueProperty.SetValue(this, value, null); } FlowInput next = Exit; if (next != null) { flow.ExecutionStack.Push(new Flow.ExecutionStackItem(next)); } }
void IFlowExecutionComponent.FlowExecution(Flow flow, Flow.ExecutionStackItem entryItem) { var variable = Variable.Value; if (variable != null && valueProperty != null) { var value = ReferenceUtility.GetUnreferencedValue(valueProperty.GetValue(this, null)); flow.SetVariable(variable.GetVariableName(), value); } FlowInput next = Exit; if (next != null) { flow.ExecutionStack.Push(new Flow.ExecutionStackItem(next)); } }
public override object GetValue(object component) { var target = GetTarget(component); return(target != null?ValueProperty.GetValue(target) : null); }