Example #1
0
        /// <summary>
        ///     Loads max team set definitions from an XML document.
        /// </summary>
        /// <param name="document">The XML document to load set definitions from.</param>
        /// <returns>The NameIndexCollection that was created.</returns>
        public static NameIndexCollection LoadMaxTeamSet(XDocument document)
        {
            // Make sure there is a root <maxTeams> tag
            XElement container = document.Element("maxTeams");
            if (container == null)
                throw new ArgumentException("Invalid maxTeams definition document");

            var collection = new NameIndexCollection();

            // Process <maxTeam> elements
            foreach (XElement element in container.Elements("maxTeam"))
                ProcessSetElement(element, collection);

            return collection;
        }
Example #2
0
 private static void ProcessSetElement(XElement element, NameIndexCollection collection)
 {
     int index = XMLUtil.GetNumericAttribute(element, "index", -1);
     string name = XMLUtil.GetStringAttribute(element, "name", "");
     collection.AddLayout(new NameIndexLayout(index, name));
 }