Ejemplo n.º 1
0
        private LBA2Quest[] getQuests(XmlNodeList nodes)
        {
            LBA2Quest[] quests = new LBA2Quest[nodes.Count];
            int         i;

            for (i = 0; i < nodes.Count; i++)
            {
                //MessageBox.Show(nodes[i].SelectSingleNode("name").InnerText.Trim());
                if (nodes[i].SelectSingleNode("name").InnerText.Trim() == "Unknown")
                {
                    continue;
                }
                quests[i] = getQuest(nodes[i]);
            }
            int notNull = 0;

            //Return an array of non-null quests, first let's count them
            for (i = 0; i < nodes.Count; i++)
            {
                if (null != quests[i])
                {
                    notNull++;
                }
            }
            LBA2Quest[] nonNullQuests = new LBA2Quest[notNull];
            for (i = 0, notNull = 0; i < quests.Count(); i++)
            {
                if (null != quests[i])
                {
                    nonNullQuests[notNull++] = quests[i];
                }
            }
            return(nonNullQuests);
        }
Ejemplo n.º 2
0
        private LBA2Quest getQuest(XmlNode xn)
        {
            LBA2Quest quest = new LBA2Quest();

            quest.name = xn.SelectSingleNode("name").InnerText.Trim();

            string s = xn.SelectSingleNode("memoryOffset").InnerText.Trim();

            quest.memoryOffset = uint.Parse(s, System.Globalization.NumberStyles.HexNumber);
            quest.size         = ushort.Parse(xn.SelectSingleNode("size").InnerText.Trim());
            quest.subquests    = getSubquests(xn.ChildNodes.Item(xn.ChildNodes.Count - 1).ChildNodes); //This is a hack
            return(quest);
        }