Example #1
0
        private static TemplateMap ReadTemplates(string mapFileLocation)
        {
            var parser = new TemplateFileParser();


            var map = new TemplateMap(File.Exists(mapFileLocation)
                ? parser.Parse(mapFileLocation).ToArray()
                : new MapObjectTemplate[0]);

            foreach (var format in new[] { MapFormat.RoE, MapFormat.AB, MapFormat.SoD, MapFormat.HotA, MapFormat.WoG })
            {
                var file = Path.ChangeExtension(mapFileLocation, $"{format}.txt");
                if (File.Exists(file))
                {
                    var values = parser.Parse(file).ToArray();
                    map.AddFormatMapping(format, values);
                }
                else
                {
                    Log.Debug("ID mapping file {file} doesn't exist. Skipping.", file);
                }
            }

            return(map);
        }