Пример #1
0
 void ReadData(XmlNode node, ClientHeroData data)
 {
     foreach (XmlNode a in node.ChildNodes)
     {
         if (a.Name == "logic_id")
         {
             data.logic_id = int.Parse(a.InnerText);
         }
         else if (a.Name == "res")
         {
             data.res_path = a.InnerText;
         }
     }
 }
Пример #2
0
    protected override bool ParseConfig()
    {
        try
        {
            HeroClientData    = new Dictionary <int, ClientHeroData>();
            MonsterClientData = new Dictionary <int, ClientHeroData>();

            XmlDocument doc = new XmlDocument();
            doc.LoadXml(m_XmlString);
            XmlNode root = doc.LastChild;
            foreach (XmlNode tag in root.ChildNodes)
            {
                if (tag.Name == "Heroes")
                {
                    foreach (XmlNode h in tag.ChildNodes)
                    {
                        ClientHeroData hd = new ClientHeroData();

                        ReadData(h, hd);
                        HeroClientData[hd.logic_id] = hd;
                    }
                }
                else if (tag.Name == "Monsters")
                {
                    foreach (XmlNode h in tag.ChildNodes)
                    {
                        ClientHeroData hd = new ClientHeroData();

                        ReadData(h, hd);
                        MonsterClientData[hd.logic_id] = hd;
                    }
                }
            }
            return(true);
        }
        catch (System.Exception ex) {
            m_Error = ex.ToString();
            return(true);
        }
    }