/// <exception cref="Kirikiri.Tjs2.VariantException"></exception> /// <exception cref="Kirikiri.Tjs2.TJSException"></exception> public virtual bool Callback(string name, int flags, Variant value) { if ((flags & Interface.HIDDENMEMBER) != 0) { return true; } if (value.IsObject()) { // object Dispatch2 dsp = value.AsObject(); // determin dsp's object type Variant val; if (dsp != null) { if (dsp.GetNativeInstance(DictionaryClass.ClassID) != null) { // dictionary bool objrec = false; int count = mStack.Count; for (int i = 0; i < count; i++) { Dispatch2 v = mStack[i]; if (v == dsp) { // object recursion detected objrec = true; break; } } val = new Variant(); if (objrec) { val.SetObject(null); } else { // becomes null Dispatch2 newobj = TJS.CreateDictionaryObject(); val.SetObject(newobj, newobj); DictionaryNI newni; if ((newni = (DictionaryNI)newobj.GetNativeInstance(DictionaryClass.ClassID)) != null) { newni.AssignStructure(dsp, mStack); } } } else { if (dsp.GetNativeInstance(ArrayClass.ClassID) != null) { // array bool objrec = false; int count = mStack.Count; for (int i = 0; i < count; i++) { Dispatch2 v = mStack[i]; if (v == dsp) { // object recursion detected objrec = true; break; } } val = new Variant(); if (objrec) { val.SetObject(null); } else { // becomes null Dispatch2 newobj = TJS.CreateArrayObject(); val.SetObject(newobj, newobj); ArrayNI newni; if ((newni = (ArrayNI)newobj.GetNativeInstance(ArrayClass.ClassID)) != null) { newni.AssignStructure(dsp, mStack); } } } else { val = value; } } } else { // other object types val = value; } mDest.PropSet(Interface.MEMBERENSURE | Interface.IGNOREPROP, name, val, mDest); } else { // other types mDest.PropSet(Interface.MEMBERENSURE | Interface.IGNOREPROP, name, value, mDest); } return true; }