/// <summary> /// Prepares the text information about constraint. /// </summary> /// <param name="cStr">The stringBuilder class where information should be stored</param> /// <param name="additionalInformation">The additional information.</param> /// <param name="depth">The depth (Indentation level).</param> protected internal override void PrepareTextInformationAboutConstraint(StringBuilder cStr, string additionalInformation, int depth) { base.PrepareTextInformationAboutConstraint(cStr, "", depth); foreach (IConstraint icn in constraints) { AbstractConstraint cn = icn as AbstractConstraint; if (cn != null) { DoIndent(cStr, depth); cStr.AppendLine("Member constraint:"); cn.PrepareTextInformationAboutConstraint(cStr, "", depth + 1); cStr.AppendLine(); } } }
/// <summary> /// Parse the XML content of the constraints group/fields section of the license. /// </summary> /// <param name="itemsNode"> /// A <see cref="System.Xml.XmlNode">XmlNode</see> representing the /// Constraints List (System.Collections.Generic.List) section of the /// license. /// </param> protected void parseConstraintsFields(XmlNode itemsNode) { // Check if custom fields are defined if (itemsNode == null) { return; } // If they are then process all of them XmlNodeList constraints = itemsNode.ChildNodes; for (int i = 0; i < constraints.Count; i++) { XmlNode constraint = constraints[i]; XmlNode typeTextNode = constraint.SelectSingleNode("Type/text()"); if (typeTextNode != null) { Type constraintType = Type.GetType(typeTextNode.Value, false, true); ConstructorInfo cInfo = constraintType.GetConstructor(new Type[] { typeof(LicenseFile) }); AbstractConstraint c = (AbstractConstraint)cInfo.Invoke(new Object[] { this.License }); c.FromXml(constraint); this.Items.Add(c); } } }