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));
        }
        /// <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);
        }
Пример #3
0
 private void LoadDatabases()
 {
     MaxTeamCollection           = Settings.GetSettingOrDefault <NameIndexCollection>("databases/maxTeams", null);
     MultiplayerObjectCollection = Settings.GetSettingOrDefault <NameIndexCollection>("databases/multiplayerObjects", null);
 }