internal void ResetLockLists(ConfigurationElement parentElement) {
_lockedAttributesList = null;
_lockedAllExceptAttributesList = null;
_lockedElementsList = null;
_lockedAllExceptElementsList = null;
if (parentElement != null) {
_fItemLocked = ((parentElement._fItemLocked & ConfigurationValueFlags.Locked) != 0) ?
(ConfigurationValueFlags.Inherited | parentElement._fItemLocked) :
ConfigurationValueFlags.Default;
if (parentElement._lockedAttributesList != null) {
_lockedAttributesList = new ConfigurationLockCollection(this, ConfigurationLockCollectionType.LockedAttributes);
foreach (string key in parentElement._lockedAttributesList)
_lockedAttributesList.Add(key, ConfigurationValueFlags.Inherited); // Mark entry as from the parent - read only
}
if (parentElement._lockedAllExceptAttributesList != null) {
_lockedAllExceptAttributesList = new ConfigurationLockCollection(this, ConfigurationLockCollectionType.LockedExceptionList, String.Empty, parentElement._lockedAllExceptAttributesList);
}
if (parentElement._lockedElementsList != null) {
_lockedElementsList = new ConfigurationLockCollection(this, ConfigurationLockCollectionType.LockedElements);
ConfigurationElementCollection collection = null;
if (Properties.DefaultCollectionProperty != null) // this is not a collection but it may contain a default collection
{
collection = this[Properties.DefaultCollectionProperty] as ConfigurationElementCollection;
if (collection != null) {
collection.internalElementTagName = parentElement.ElementTagName; // Default collections don't know there tag name
if (collection._lockedElementsList == null) {
collection._lockedElementsList = _lockedElementsList;
}
}
}
foreach (string key in parentElement._lockedElementsList) {
_lockedElementsList.Add(key, ConfigurationValueFlags.Inherited); // Mark entry as from the parent - read only
}
}
if (parentElement._lockedAllExceptElementsList != null) {
_lockedAllExceptElementsList = new ConfigurationLockCollection(this, ConfigurationLockCollectionType.LockedElementsExceptionList, parentElement._elementTagName, parentElement._lockedAllExceptElementsList);
ConfigurationElementCollection collection = null;
if (Properties.DefaultCollectionProperty != null) // this is not a collection but it may contain a default collection
{
collection = this[Properties.DefaultCollectionProperty] as ConfigurationElementCollection;
if (collection != null && collection._lockedAllExceptElementsList == null) {
collection._lockedAllExceptElementsList = _lockedAllExceptElementsList;
}
}
}
}
}