public XmlData(string path = "data") { ObjectTypeToElement = new ReadOnlyDictionary <ushort, XElement>( type2elem_obj = new Dictionary <ushort, XElement>()); ObjectTypeToId = new ReadOnlyDictionary <ushort, string>( type2id_obj = new Dictionary <ushort, string>()); IdToObjectType = new ReadOnlyDictionary <string, ushort>( id2type_obj = new Dictionary <string, ushort>(StringComparer.InvariantCultureIgnoreCase)); TileTypeToElement = new ReadOnlyDictionary <ushort, XElement>( type2elem_tile = new Dictionary <ushort, XElement>()); TileTypeToId = new ReadOnlyDictionary <ushort, string>( type2id_tile = new Dictionary <ushort, string>()); IdToTileType = new ReadOnlyDictionary <string, ushort>( id2type_tile = new Dictionary <string, ushort>(StringComparer.InvariantCultureIgnoreCase)); Tiles = new ReadOnlyDictionary <ushort, TileDesc>( tiles = new Dictionary <ushort, TileDesc>()); Items = new ReadOnlyDictionary <ushort, Item>( items = new Dictionary <ushort, Item>()); ObjectDescs = new ReadOnlyDictionary <ushort, ObjectDesc>( objDescs = new Dictionary <ushort, ObjectDesc>()); Portals = new ReadOnlyDictionary <ushort, PortalDesc>( portals = new Dictionary <ushort, PortalDesc>()); TypeToPet = new ReadOnlyDictionary <ushort, PetStruct>( type2pet = new Dictionary <ushort, PetStruct>()); IdToPetSkin = new ReadOnlyDictionary <string, PetSkin>( id2pet_skin = new Dictionary <string, PetSkin>()); SetTypeSkins = new ReadOnlyDictionary <ushort, SetTypeSkin>( setTypeSkins = new Dictionary <ushort, SetTypeSkin>()); addition = new XElement("ExtData"); assign = new AutoAssign(this); string basePath = Path.Combine(AssemblyDirectory, path); Console.WriteLine("Loading game data from '{0}'...", basePath); string[] xmls = Directory.EnumerateFiles(basePath, "*.xml", SearchOption.AllDirectories).ToArray(); for (int i = 0; i < xmls.Length; i++) { if (CheckConfig.IsDebugOn()) { Console.WriteLine("Loading '{0}'({1}/{2})...", xmls[i], i + 1, xmls.Length); } using (Stream stream = File.OpenRead(xmls[i])) ProcessXml(XElement.Load(stream)); } if (CheckConfig.IsDebugOn()) { Console.WriteLine("Finish loading game data."); Console.WriteLine("{0} Items", items.Count); Console.WriteLine("{0} Tiles", tiles.Count); Console.WriteLine("{0} Objects", objDescs.Count); Console.WriteLine("{0} Portals", portals.Count); Console.WriteLine("{0} Additions", addition.Elements().Count()); } }
public XmlData(string path = "data") { ObjectTypeToElement = new ReadOnlyDictionary<ushort, XElement>( type2elem_obj = new Dictionary<ushort, XElement>()); ObjectTypeToId = new ReadOnlyDictionary<ushort, string>( type2id_obj = new Dictionary<ushort, string>()); IdToObjectType = new ReadOnlyDictionary<string, ushort>( id2type_obj = new Dictionary<string, ushort>(StringComparer.InvariantCultureIgnoreCase)); TileTypeToElement = new ReadOnlyDictionary<ushort, XElement>( type2elem_tile = new Dictionary<ushort, XElement>()); TileTypeToId = new ReadOnlyDictionary<ushort, string>( type2id_tile = new Dictionary<ushort, string>()); IdToTileType = new ReadOnlyDictionary<string, ushort>( id2type_tile = new Dictionary<string, ushort>(StringComparer.InvariantCultureIgnoreCase)); Tiles = new ReadOnlyDictionary<ushort, TileDesc>( tiles = new Dictionary<ushort, TileDesc>()); Items = new ReadOnlyDictionary<ushort, Item>( items = new Dictionary<ushort, Item>()); ObjectDescs = new ReadOnlyDictionary<ushort, ObjectDesc>( objDescs = new Dictionary<ushort, ObjectDesc>()); Portals = new ReadOnlyDictionary<ushort, PortalDesc>( portals = new Dictionary<ushort, PortalDesc>()); TypeToPet = new ReadOnlyDictionary<ushort, PetStruct>( type2pet = new Dictionary<ushort, PetStruct>()); IdToPetSkin = new ReadOnlyDictionary<string, PetSkin>( id2pet_skin = new Dictionary<string, PetSkin>()); SetTypeSkins = new ReadOnlyDictionary<ushort, SetTypeSkin>( setTypeSkins = new Dictionary<ushort, SetTypeSkin>()); addition = new XElement("ExtData"); assign = new AutoAssign(this); string basePath = Path.Combine(AssemblyDirectory, path); log.InfoFormat("Loading game data from '{0}'...", basePath); string[] xmls = Directory.EnumerateFiles(basePath, "*.xml", SearchOption.AllDirectories).ToArray(); for (int i = 0; i < xmls.Length; i++) { log.InfoFormat("Loading '{0}'({1}/{2})...", xmls[i], i + 1, xmls.Length); using (Stream stream = File.OpenRead(xmls[i])) ProcessXml(XElement.Load(stream)); } log.Info("Finish loading game data."); log.InfoFormat("{0} Items", items.Count); log.InfoFormat("{0} Tiles", tiles.Count); log.InfoFormat("{0} Objects", objDescs.Count); log.InfoFormat("{0} Additions", addition.Elements().Count()); }
public XmlData(string path = "data") { ObjectTypeToElement = new ReadOnlyDictionary <ushort, XElement>( type2elem_obj = new Dictionary <ushort, XElement>()); ObjectTypeToId = new ReadOnlyDictionary <ushort, string>( type2id_obj = new Dictionary <ushort, string>()); IdToObjectType = new ReadOnlyDictionary <string, ushort>( id2type_obj = new Dictionary <string, ushort>(StringComparer.InvariantCultureIgnoreCase)); TileTypeToElement = new ReadOnlyDictionary <ushort, XElement>( type2elem_tile = new Dictionary <ushort, XElement>()); TileTypeToId = new ReadOnlyDictionary <ushort, string>( type2id_tile = new Dictionary <ushort, string>()); IdToTileType = new ReadOnlyDictionary <string, ushort>( id2type_tile = new Dictionary <string, ushort>(StringComparer.InvariantCultureIgnoreCase)); Tiles = new ReadOnlyDictionary <ushort, TileDesc>( tiles = new Dictionary <ushort, TileDesc>()); Items = new ReadOnlyDictionary <ushort, Item>( items = new Dictionary <ushort, Item>()); ObjectDescs = new ReadOnlyDictionary <ushort, ObjectDesc>( objDescs = new Dictionary <ushort, ObjectDesc>()); Portals = new ReadOnlyDictionary <ushort, PortalDesc>( portals = new Dictionary <ushort, PortalDesc>()); addition = new XElement("ExtData"); assign = new AutoAssign(this); var basePath = Path.Combine(AssemblyDirectory, path); log.Info($"Loading game data from '{basePath}'..."); var xmls = Directory.EnumerateFiles(basePath, "*.xml", SearchOption.AllDirectories).ToArray(); for (var i = 0; i < xmls.Length; i++) { log.Info($"Loading '{Path.GetFileName(xmls[i])}'({i + 1}/{xmls.Length})..."); using (Stream stream = File.OpenRead(xmls[i])) ProcessXml(XElement.Load(stream)); } log.Info("Finish loading game data."); log.Info($"{items.Count} Items"); log.Info($"{tiles.Count} Tiles"); log.Info($"{objDescs.Count} Objects"); log.Info($"{addition.Elements().Count()} Additions"); }
public XmlData(string path = "data") { ObjectTypeToElement = new ReadOnlyDictionary <ushort, XElement>( type2elem_obj = new Dictionary <ushort, XElement>()); ObjectTypeToId = new ReadOnlyDictionary <ushort, string>( type2id_obj = new Dictionary <ushort, string>()); IdToObjectType = new ReadOnlyDictionary <string, ushort>( id2type_obj = new Dictionary <string, ushort>(StringComparer.InvariantCultureIgnoreCase)); TileTypeToElement = new ReadOnlyDictionary <ushort, XElement>( type2elem_tile = new Dictionary <ushort, XElement>()); TileTypeToId = new ReadOnlyDictionary <ushort, string>( type2id_tile = new Dictionary <ushort, string>()); IdToTileType = new ReadOnlyDictionary <string, ushort>( id2type_tile = new Dictionary <string, ushort>(StringComparer.InvariantCultureIgnoreCase)); SkinToItem = new ReadOnlyDictionary <ushort, Item>( skin2item = new Dictionary <ushort, Item>()); QuestTypeToElement = new ReadOnlyDictionary <ushort, XElement>( type2elem_quest = new Dictionary <ushort, XElement>()); QuestTypeToId = new ReadOnlyDictionary <ushort, string>( type2id_quest = new Dictionary <ushort, string>()); IdToQuestType = new ReadOnlyDictionary <string, ushort>( id2type_quest = new Dictionary <string, ushort>(StringComparer.InvariantCultureIgnoreCase)); AbilityTypeToElement = new ReadOnlyDictionary <ushort, XElement>( type2elem_ability = new Dictionary <ushort, XElement>()); AbilityTypeToId = new ReadOnlyDictionary <ushort, string>( type2id_ability = new Dictionary <ushort, string>()); IdToAbilityType = new ReadOnlyDictionary <string, ushort>( id2type_ability = new Dictionary <string, ushort>(StringComparer.InvariantCultureIgnoreCase)); Tiles = new ReadOnlyDictionary <ushort, TileDesc>( tiles = new Dictionary <ushort, TileDesc>()); Items = new ReadOnlyDictionary <ushort, Item>( items = new Dictionary <ushort, Item>()); ObjectDescs = new ReadOnlyDictionary <ushort, ObjectDesc>( objDescs = new Dictionary <ushort, ObjectDesc>()); Portals = new ReadOnlyDictionary <ushort, PortalDesc>( portals = new Dictionary <ushort, PortalDesc>()); Skins = new ReadOnlyDictionary <ushort, SkinDesc>( skins = new Dictionary <ushort, SkinDesc>()); Quests = new ReadOnlyDictionary <ushort, Quest>( quests = new Dictionary <ushort, Quest>()); Abilities = new ReadOnlyDictionary <ushort, Ability>( abilities = new Dictionary <ushort, Ability>()); ItemPrices = new ReadOnlyDictionary <ushort, int>( itemPrices = new Dictionary <ushort, int>()); KeyPrices = new ReadOnlyDictionary <ushort, int>( keyPrices = new Dictionary <ushort, int>()); ItemShops = new ReadOnlyDictionary <int, string>( itemShops = new Dictionary <int, string>()); Keys = new List <ushort>(); addition = new XElement("ExtData"); assign = new AutoAssign(this); string basePath = Path.Combine(AssemblyDirectory, path); log.InfoFormat("Loading game data from '{0}'...", basePath); string[] xmls = Directory.EnumerateFiles(basePath, "*.xml", SearchOption.AllDirectories).ToArray(); for (int i = 0; i < xmls.Length; i++) { log.InfoFormat("Loading '{0}'({1}/{2})...", xmls[i], i + 1, xmls.Length); using (Stream stream = File.OpenRead(xmls[i])) ProcessXml(XElement.Load(stream)); } log.Info("Finish loading game data."); log.InfoFormat("{0} Items", items.Count); log.InfoFormat("{0} Tiles", tiles.Count); log.InfoFormat("{0} Objects", objDescs.Count); log.InfoFormat("{0} Abilities", abilities.Count); log.InfoFormat("{0} Additions", addition.Elements().Count()); }