private void ProcessChildren(object thisKey, IReference <RuntimeGroupLeafObj> parentObj, IReference <RuntimeGroupLeafObj> thisObj) { ChildLeafInfo value = null; if (m_parentInfo != null) { m_parentInfo.TryGetValue(thisKey, out value); } if (value == null) { return; } for (int i = 0; i < value.Count; i++) { RuntimeGroupLeafObjReference runtimeGroupLeafObjReference = value[i]; using (runtimeGroupLeafObjReference.PinValue()) { RuntimeGroupLeafObj runtimeGroupLeafObj = runtimeGroupLeafObjReference.Value(); bool flag = false; IReference <RuntimeGroupObj> reference = parentObj as IReference <RuntimeGroupObj>; while (reference != null && !flag) { RuntimeGroupLeafObj runtimeGroupLeafObj2 = reference.Value() as RuntimeGroupLeafObj; if (runtimeGroupLeafObj2 == runtimeGroupLeafObj) { flag = true; } reference = runtimeGroupLeafObj2?.Parent; } if (!flag) { runtimeGroupLeafObj.RemoveFromParent((RuntimeGroupRootObjReference)m_owner.SelfReference); using (thisObj.PinValue()) { thisObj.Value().AddChild(runtimeGroupLeafObjReference); } } } } m_parentInfo.Remove(thisKey); }
private void ProcessParent(object parentKey, IReference <RuntimeGroupLeafObj> parentObj, RuntimeGroupLeafObjReference childObj, bool addToWaitList) { if (parentObj != null) { using (parentObj.PinValue()) { parentObj.Value().AddChild(childObj); } return; } (m_owner as RuntimeGroupRootObj).AddChild(childObj); if (!addToWaitList) { return; } ChildLeafInfo value = null; IDisposable reference = null; try { if (m_parentInfo == null) { m_parentInfo = CreateParentInfo(); } else { m_parentInfo.TryGetAndPin(parentKey, out value, out reference); } if (value == null) { value = new ChildLeafInfo(); reference = m_parentInfo.AddAndPin(parentKey, value); } value.Add(childObj); } finally { reference?.Dispose(); } }