private void findandReplaceInSub(DisableGetObjects.IConfigSwitchOrGroup[] iConfigSwitchOrGroup,ref DisableGetObjects.IConfigSwitchOrGroup father, DisableGetObjects.IConfigSwitchOrGroup src, DisableGetObjects.IConfigSwitchOrGroup dstValue) { if (iConfigSwitchOrGroup == null) return; for (int i = 0; i < iConfigSwitchOrGroup.Length; ++i) { if (iConfigSwitchOrGroup[i] == src) { iConfigSwitchOrGroup[i] = dstValue; father.SetItemList(iConfigSwitchOrGroup); return; } else { findandReplaceInSub(iConfigSwitchOrGroup[i].NextItems(),ref iConfigSwitchOrGroup[i], src, dstValue); } } }
private void deleteItemInSub(DisableGetObjects.IConfigSwitchOrGroup father, DisableGetObjects.IConfigSwitchOrGroup whattodel) { if (!father.IfHaveNextItems()) { return; } foreach (var m in father.NextItems()) { if (m == whattodel) { List<DisableGetObjects.IConfigSwitchOrGroup> w = new List<DisableGetObjects.IConfigSwitchOrGroup>(father.NextItems()); w.Remove(whattodel); father.SetItemList(w.ToArray()); return; } else { deleteItemInSub(m, whattodel); } } }