internal ConfigurationLockCollection UnMergeLockList(
ConfigurationLockCollection sourceLockList,
ConfigurationLockCollection parentLockList,
ConfigurationSaveMode saveMode) {
if (sourceLockList.ExceptionList == false) {
switch (saveMode) {
case ConfigurationSaveMode.Modified: {
ConfigurationLockCollection tempLockList = new ConfigurationLockCollection(this, sourceLockList.LockType);
foreach (string lockedAttributeName in sourceLockList)
if (!parentLockList.Contains(lockedAttributeName) ||
sourceLockList.IsValueModified(lockedAttributeName)) {
tempLockList.Add(lockedAttributeName, ConfigurationValueFlags.Default);
}
return tempLockList;
}
case ConfigurationSaveMode.Minimal: {
ConfigurationLockCollection tempLockList = new ConfigurationLockCollection(this, sourceLockList.LockType);
foreach (string lockedAttributeName in sourceLockList)
if (!parentLockList.Contains(lockedAttributeName)) {
tempLockList.Add(lockedAttributeName, ConfigurationValueFlags.Default);
}
return tempLockList;
}
}
}
else {
// exception list write out the entire collection unless the entire collection
// came from the parent.
if (saveMode == ConfigurationSaveMode.Modified || saveMode == ConfigurationSaveMode.Minimal) {
bool sameAsParent = false;
if (sourceLockList.Count == parentLockList.Count) {
sameAsParent = true;
foreach (string lockedAttributeName in sourceLockList) {
if (!parentLockList.Contains(lockedAttributeName) ||
(sourceLockList.IsValueModified(lockedAttributeName) &&
saveMode == ConfigurationSaveMode.Modified)) {
sameAsParent = false;
}
}
}
if (sameAsParent == true) {
return null;
}
}
}
return sourceLockList;
}