void Execute(String arg, Boolean bContinue) { DynamicObject dobj = JsonConvert.DeserializeObject <ExpandoObject>(arg); var tpName = dobj.Get <String>("$type"); var tp = Type.GetType(tpName); var elem = Activator.CreateInstance(tp); var props = tp.GetProperties(BindingFlags.Public | BindingFlags.Instance); foreach (var p in props) { if (p.IsSpecialName) { continue; } if (!p.CanWrite) { continue; } var val = dobj.Get <Object>(p.Name); p.SetValue(elem, val); } if (elem is CustomActivity customActivity) { if (bContinue) { customActivity.Continue(_script); } else { customActivity.Execute(_script); } } }
public void Store(String refer, String varName, Object value) { if (_storage == null) { return; } if (!_storage.TryGetValue(refer, out Object val)) { _storage.Set(refer, new ExpandoObject()); } DynamicObject dobj = _storage.Get <ExpandoObject>(refer); dobj.Set(varName, value); }
public T Restore <T>(String refer, String varName) { DynamicObject dobj = _storage.Get <ExpandoObject>(refer); return(dobj.Get <T>(varName)); }