public CswDelimitedString ToDelimitedString() { CswDelimitedString ret = new CswDelimitedString(CswNbtView.delimiter); ret.Add(CswEnumNbtViewNodeType.CswNbtViewProperty.ToString()); ret.Add(Type.ToString()); ret.Add(NodeTypePropId.ToString()); ret.Add(Name.ToString()); ret.Add(ArbitraryId.ToString()); ret.Add(SortBy.ToString()); ret.Add(SortMethod.ToString()); if (FieldType != CswNbtResources.UnknownEnum) { ret.Add(FieldType.ToString()); } else { ret.Add(""); } if (Order != Int32.MinValue) { ret.Add(Order.ToString()); } else { ret.Add(""); } if (Width != Int32.MinValue) { ret.Add(Width.ToString()); } else { ret.Add(""); } ret.Add(ShowInGrid.ToString()); ret.Add(ObjectClassPropId.ToString()); return(ret); }
public JProperty ToJson(string PName = null, bool FirstLevelOnly = false, bool ShowAtRuntimeOnly = false) { JObject FilterObj = new JObject(); if (string.IsNullOrEmpty(PName)) { PName = CswEnumNbtViewXmlNodeName.Property.ToString() + "_" + ArbitraryId; } JProperty PropertyProp = new JProperty(PName, new JObject( new JProperty("nodename", CswEnumNbtViewXmlNodeName.Property.ToString().ToLower()), new JProperty("type", Type.ToString()), new JProperty("nodetypepropid", NodeTypePropId.ToString()), new JProperty("objectclasspropid", ObjectClassPropId.ToString()), new JProperty("name", Name), new JProperty("arbitraryid", ArbitraryId), new JProperty("sortby", SortBy.ToString()), new JProperty("sortmethod", SortMethod.ToString()), new JProperty("fieldtype", (FieldType != CswNbtResources.UnknownEnum) ? FieldType.ToString() : ""), new JProperty("order", (Order != Int32.MinValue) ? Order.ToString() : ""), new JProperty("width", (Width != Int32.MinValue) ? Width.ToString() : ""), new JProperty("filters", FilterObj), new JProperty("showingrid", ShowInGrid), new JProperty("showdelete", true) //for ViewContentTree - always show "X" for Property nodes ) ); if (!FirstLevelOnly) { foreach (CswNbtViewPropertyFilter Filter in this.Filters) { if (false == ShowAtRuntimeOnly || Filter.ShowAtRuntime) { FilterObj.Add(Filter.ToJson()); } } } return(PropertyProp); }
public XmlNode ToXml(XmlDocument XmlDoc) { XmlNode NewPropNode = XmlDoc.CreateNode(XmlNodeType.Element, CswEnumNbtViewXmlNodeName.Property.ToString(), ""); XmlAttribute PropTypeAttribute = XmlDoc.CreateAttribute("type"); PropTypeAttribute.Value = Type.ToString(); NewPropNode.Attributes.Append(PropTypeAttribute); XmlAttribute NodeTypePropIdAttribute = XmlDoc.CreateAttribute("nodetypepropid"); NodeTypePropIdAttribute.Value = NodeTypePropId.ToString(); NewPropNode.Attributes.Append(NodeTypePropIdAttribute); XmlAttribute ObjectClassPropIdAttribute = XmlDoc.CreateAttribute("objectclasspropid"); ObjectClassPropIdAttribute.Value = ObjectClassPropId.ToString(); NewPropNode.Attributes.Append(ObjectClassPropIdAttribute); XmlAttribute PropNameAttribute = XmlDoc.CreateAttribute("name"); PropNameAttribute.Value = Name; NewPropNode.Attributes.Append(PropNameAttribute); XmlAttribute ArbitraryIdAttribute = XmlDoc.CreateAttribute("arbitraryid"); ArbitraryIdAttribute.Value = ArbitraryId; NewPropNode.Attributes.Append(ArbitraryIdAttribute); XmlAttribute SortByAttribute = XmlDoc.CreateAttribute("sortby"); SortByAttribute.Value = SortBy.ToString(); NewPropNode.Attributes.Append(SortByAttribute); XmlAttribute SortMethodAttribute = XmlDoc.CreateAttribute("sortmethod"); SortMethodAttribute.Value = SortMethod.ToString(); NewPropNode.Attributes.Append(SortMethodAttribute); XmlAttribute FieldTypeAttribute = XmlDoc.CreateAttribute("fieldtype"); if (FieldType != CswNbtResources.UnknownEnum) { FieldTypeAttribute.Value = FieldType.ToString(); } else { FieldTypeAttribute.Value = string.Empty; } NewPropNode.Attributes.Append(FieldTypeAttribute); XmlAttribute OrderAttribute = XmlDoc.CreateAttribute("order"); if (Order != Int32.MinValue) { OrderAttribute.Value = Order.ToString(); } else { OrderAttribute.Value = string.Empty; } NewPropNode.Attributes.Append(OrderAttribute); XmlAttribute WidthAttribute = XmlDoc.CreateAttribute("width"); if (Width != Int32.MinValue) { WidthAttribute.Value = Width.ToString(); } else { WidthAttribute.Value = string.Empty; } NewPropNode.Attributes.Append(WidthAttribute); XmlAttribute ShowInGridAttribute = XmlDoc.CreateAttribute("showingrid"); ShowInGridAttribute.Value = ShowInGrid.ToString(); NewPropNode.Attributes.Append(ShowInGridAttribute); foreach (CswNbtViewPropertyFilter Filter in this.Filters) { XmlNode FilterNode = Filter.ToXml(XmlDoc); NewPropNode.AppendChild(FilterNode); } return(NewPropNode); }