internal bool UpdatePropertyCollection()
{
bool bIsModified = false;
ArrayList removeList = null;
if (_propertyNameCollection != null)
{
// remove any data that has been delete from the collection
foreach (ConfigurationProperty prop in _properties)
{
if ((prop.Name != "name") && (prop.Name != "type"))
{
if (_propertyNameCollection.Get(prop.Name) != null)
{
continue;
}
if (removeList == null)
{
removeList = new ArrayList();
}
if ((Values.GetConfigValue(prop.Name).ValueFlags & ConfigurationValueFlags.Locked) != 0)
{
continue;
}
removeList.Add(prop.Name);
bIsModified = true;
}
}
if (removeList != null)
{
foreach (string propName in removeList)
{
_properties.Remove(propName);
}
}
// then copy any data that has been changed in the collection
foreach (string key in _propertyNameCollection)
{
string valueInCollection = _propertyNameCollection[key];
string valueInBag = GetProperty(key);
if ((valueInBag == null) || (valueInCollection != valueInBag)) // add new property
{
SetProperty(key, valueInCollection);
bIsModified = true;
}
}
}
_propertyNameCollection = null;
return(bIsModified);
}