Ejemplo n.º 1
0
        private static void ProcessSetElement(XElement element, StringIDSetResolver resolver)
        {
            // Get the set's ID from the "id" attribute
            XAttribute idAttribute = element.Attribute("id");
            if (idAttribute == null)
                throw new ArgumentException("StringID set tags must have an \"id\" attribute");
            short id = (short)ParseNumber(idAttribute.Value);

            // Get the set's min index from the "min" attribute (optional, defaults to 0)
            ushort min = 0;
            XAttribute minAttribute = element.Attribute("min");
            if (minAttribute != null)
                min = (ushort)ParseNumber(minAttribute.Value);

            // Get the set's global index from the "startIndex" attribute
            XAttribute startIndexAttribute = element.Attribute("startIndex");
            if (startIndexAttribute == null)
                throw new ArgumentException("String id set tags must have a \"startIndex\" attribute");
            int globalIndex = ParseNumber(startIndexAttribute.Value);

            // Register the set
            resolver.RegisterSet(id, min, globalIndex);
        }