Ejemplo n.º 1
0
        /// <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>
        private 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((String)typeTextNode.Value, false, true);
                    ConstructorInfo cInfo          = constraintType.GetConstructor(new Type[] { typeof(Hemrika.SharePresence.SPLicense.LicenseFile.SPLicenseFile) });
                    IConstraint     c = (IConstraint)cInfo.Invoke(new Object[] { this.License });
                    c.FromXml(constraint);
                    this.Items.Add(c);
                }
            }
        }