コード例 #1
0
        public static List <Set> Read(string filename)
        {
            List <Set> sets = new List <Set>();

            var xmlDocument = new XmlDocument();

            using (var stream = File.OpenRead(filename))
            {
                xmlDocument.Load(stream);
            }

            var nodes = xmlDocument.GetElementsByTagName("set");

            for (int i = 0; i < nodes.Count; i++)
            {
                var node = nodes[i];

                var set = new Set
                {
                    Name = node.Attributes["name"].Value,

                    TileInfos = new TileInfos(node.SelectNodes("tile")),
                    WallInfos = WallInfo.Read(node.SelectNodes("wall")),
                    ItemInfos = ItemInfo.ReadList(node.SelectNodes("item")),
                    NpcInfos  = NpcInfo.Read(node.SelectNodes("Npc"))
                };

                sets.Add(set);
            }

            return(sets);
        }
コード例 #2
0
        public static StaticData Read(string filename)
        {
            var staticData = new StaticData();

            var xmlDocument = new XmlDocument();

            using (var stream = File.OpenRead(filename))
            {
                xmlDocument.Load(stream);
            }

            staticData.TileInfos    = TileInfos.Read(xmlDocument);
            staticData.WallInfos    = WallInfo.Read(xmlDocument);
            staticData.GlobalColors = GlobalColors.Read(xmlDocument);
            staticData.ItemPrefixes = ItemPrefix.Read(xmlDocument);
            staticData.ItemInfos    = ItemInfo.Read(xmlDocument);
            staticData.NpcInfoList  = NpcInfo.Read(xmlDocument);

            return(staticData);
        }