public void Response(bool success, JSC.JSValue value) { if (success) { _topic.ValuePublished(this._value); _tcs.SetResult(true); } else { _tcs.SetException(new ApplicationException(value == null ? "TopicSetError" : value.ToString())); } _complete = true; }
public void Process() { var ps = _path.Split(PATH_SEPARATOR, StringSplitOptions.RemoveEmptyEntries); DTopic cur = _root, next; bool noCreation = (_cmd == 12 && _p1 == null && _p2 == null) || (_cmd == 10 && _p1 != null && _p1.ValueType == JSC.JSValueType.String && _p2 != null && _p2.ValueType == JSC.JSValueType.String); for (int i = 0; i < ps.Length; i++) { next = cur.GetChild(ps[i], !noCreation); if (next == null) // Topic not exist { return; } cur = next; } if (noCreation) { if (_cmd == 10) // move { DTopic parent = _root; ps = (_p1.Value as string).Split(PATH_SEPARATOR, StringSplitOptions.RemoveEmptyEntries); //-V3095 for (int i = 0; i < ps.Length; i++) { next = parent.GetChild(ps[i], false); if (next == null) // Topic not exist { return; } parent = next; } next = new DTopic(parent, _p2.Value as string); //-V3095 next._children = cur._children; next._state = cur._state; next._manifest = cur._manifest; next._typeTopic = cur._typeTopic; cur.parent.ChangedReise(Art.RemoveChild, cur); cur.parent._children.Remove(cur); parent.SetChild(next); next.UpdatePath(); parent.ChangedReise(Art.addChild, next); } else if (_cmd == 12) // delete { cur._disposed = true; var parent = cur.parent; if (parent != null) { parent.RemoveChild(cur); cur.ChangedReise(Art.RemoveChild, cur); parent.ChangedReise(Art.RemoveChild, cur); } } } else { if (_p1 != null) { cur.ValuePublished(_p1); } if (_p2 != null) { cur.ManifestPublished(_p2); } } }