private bool RemoveUnusedFields(Dictionary<string, FieldDescriptor> fieldInfoList, Dictionary<string, List<string>> oldBindings, ContentListType listType, SchemaEditor editor)
{
bool hasChanges = false;
for (int i = _fieldSettings.Count - 1; i >= 0; i--)
{
FieldSetting oldType = _fieldSettings[i];
bool needtoDelete = !fieldInfoList.ContainsKey(oldType.Name);
if (!needtoDelete)
{
FieldDescriptor newType = fieldInfoList[oldType.Name];
if (oldType.DataTypes.Length != newType.DataTypes.Length)
{
needtoDelete = true;
}
else
{
for (int j = 0; j < oldType.DataTypes.Length; j++)
{
if (oldType.DataTypes[j] != newType.DataTypes[j])
{
needtoDelete = true;
break;
}
}
}
}
if (needtoDelete)
{
hasChanges = true;
foreach (string binding in oldType.Bindings)
{
PropertyType oldPropertyType = editor.PropertyTypes[binding];
editor.RemovePropertyTypeFromPropertySet(oldPropertyType, listType);
}
_fieldSettings.RemoveAt(i);
oldBindings.Remove(oldType.Name);
}
}
//-- Apply changes. Slot reusing prerequisit: values of unused slots must be null.
//if (hasChanges)
// editor.Register();
return hasChanges;
}
private void SetFieldSlots()