Esempio n. 1
0
        private static void WriteAddOrRemovePropertyTypes(ContentListType origSet, ContentListType newSet, List <PropertySet> modifiedPropertySets, SchemaWriter writer)
        {
            bool origSetChanged = false;

            if (origSet == null)
            {
                //-- New NodeType: add all property
                foreach (PropertyType propType in newSet.PropertyTypes)
                {
                    writer.AddPropertyTypeToPropertySet(propType, newSet, true);
                }
                return;
            }
            //-- Delete PropertyType if needed
            foreach (PropertyType propType in GetTypesToDelete <PropertyType>(origSet.PropertyTypes, newSet.PropertyTypes))
            {
                writer.RemovePropertyTypeFromPropertySet(propType, newSet);
                origSetChanged = true;
            }

            //-- Create or modify PropertyTypes
            foreach (PropertyType propType in newSet.PropertyTypes)
            {
                if (NeedToCreate <PropertyType>(origSet.PropertyTypes, propType))
                {
                    writer.AddPropertyTypeToPropertySet(propType, newSet, true);
                    origSetChanged = true;
                }
            }

            if (origSetChanged && !modifiedPropertySets.Contains(origSet))
            {
                modifiedPropertySets.Add(origSet);
            }
        }
Esempio n. 2
0
        private ContentListType CreateContentListType(int id, string name)
        {
            var listType = new ContentListType(id, name, this);

            this.ContentListTypes.Add(listType);
            return(listType);
        }
Esempio n. 3
0
 private static void WriteDeleteContentListType(SchemaWriter writer, ContentListType contentListType, SchemaEditor origSchema, List <PropertySet> modifiedPropertySets)
 {
     writer.DeleteContentListType(contentListType);
     if (!modifiedPropertySets.Contains(contentListType))
     {
         modifiedPropertySets.Add(contentListType);
     }
 }
Esempio n. 4
0
 public void DeleteContentListType(ContentListType listType)
 {
     if (listType == null)
     {
         throw new ArgumentNullException("listType");
     }
     if (listType.SchemaRoot != this)
     {
         throw new SchemaEditorCommandException(SR.Exceptions.Schema.Msg_InconsistentHierarchy);
     }
     listType.PropertyTypes.Clear();
     this.ContentListTypes.Remove(listType);
 }
Esempio n. 5
0
        private static void ContentListTypeToXml(ContentListType lt, StringBuilder sb, string indent)
        {
            //		<NodeType itemID="1" name="NodeType1">
            sb.Append(indent).Append("<ContentListType");
            sb.Append(" itemID=\"").Append(lt.Id).Append("\"");
            sb.Append(" name=\"").Append(lt.Name).Append("\"");

            if (lt.PropertyTypes.Count == 0)
            {
                sb.AppendLine(" />");
                return;
            }
            sb.AppendLine(">");

            foreach (PropertyType pt in lt.PropertyTypes)
            {
                PropertyTypeReferenceToXml(pt, sb, indent + "\t");
            }

            sb.Append(indent).AppendLine("</ContentListType>");
        }
Esempio n. 6
0
 public abstract void DeleteContentListType(ContentListType contentListType);