예제 #1
0
 private void RegisterValueTypes(XContainer root, OpcodeLookup lookup)
 {
     foreach (XElement element in root.Element("valueTypes").Descendants("type"))
     {
         string name      = XMLUtil.GetStringAttribute(element, "name");
         var    opcode    = (ushort)XMLUtil.GetNumericAttribute(element, "opcode");
         int    size      = (int)XMLUtil.GetNumericAttribute(element, "size");
         bool   quoted    = XMLUtil.GetBoolAttribute(element, "quoted", false);
         string tag       = XMLUtil.GetStringAttribute(element, "tag", null);
         bool   obj       = XMLUtil.GetBoolAttribute(element, "object", false);
         var    valueType = new ScriptValueType(name, opcode, size, quoted, tag, obj);
         foreach (XElement option in element.Descendants("enum"))
         {
             valueType.AddEnumValue(option.Value);
         }
         lookup.RegisterValueType(valueType);
     }
 }