Example #1
0
        public void Parse(string text)
        {
            XML     xml      = new XML(text);
            XMLList dtoNodes = xml.Elements("structs")[0].Elements();

            foreach (XML dtoNode in dtoNodes)              //parse structs
            {
                if (!this.CreateStruct(ushort.Parse(dtoNode.GetAttribute("id")), dtoNode.GetAttribute("name"), out DTOEntry dto))
                {
                    this.ParseField(dto, dtoNode, dtoNodes);
                }
            }
            XMLList moduleNodes = xml.Elements("modules")[0].Elements();

            foreach (XML moduleNode in moduleNodes)               //parse modules
            {
                ModuleEntry module = new ModuleEntry();
                module.id  = moduleNode.GetAttribute("id");
                module.key = moduleNode.GetAttribute("key");
                this._modules.Add(module);

                XMLList packetNodes = moduleNode.Elements();
                foreach (XML packetNode in packetNodes)                   //parse packets
                {
                    PacketEntry packet = new PacketEntry(module);
                    packet.id  = packetNode.GetAttribute("cmd");
                    packet.key = packetNode.GetAttribute("key");
                    packet.dto = this.FindDTO(packetNode.GetAttribute("struct"));
                    module.packets.Add(packet);
                }
            }
        }
Example #2
0
 public PacketEntry(ModuleEntry module)
 {
     this.module = module;
 }