private void PopulateXmlResources(ContentDirectory source)
        {
            var files = source.EnumerateXmlFiles(DredmorInfo.XmlFilesToLoadResources, SearchOption.AllDirectories);

            foreach (var file in files)
            {
                XDocument doc = XDocument.Load(file.OpenRead());

                switch (file.Name.ToLower())
                {
                case "craftdb.xml":
                    PopulateCraftResources(doc, file.ExpansionNumber);
                    break;

                case "itemdb.xml":
                    PopulateItemResources(doc, file.ExpansionNumber);
                    PopulatePowerResources(doc, file.ExpansionNumber);
                    break;

                case "mondb.xml":
                    PopulateMonsterResources(doc, file.ExpansionNumber);
                    PopulateTaxaResources(doc, file.ExpansionNumber);
                    break;

                case "soundfx.xml":
                    PopulateSfxResources(doc, file.ExpansionNumber);
                    break;

                case "spelldb.xml":
                    PopulateSpellResources(doc, file.ExpansionNumber);
                    break;
                }
            }
        }
        /// <summary>
        /// Performs XML and XSD validation. If no files are malformed the performs resource validation.
        /// </summary>
        /// <returns></returns>
        public CoreValidationResult Validate()
        {
            CoreValidationResult result = new CoreValidationResult();

            var xmlFiles = core.EnumerateXmlFiles(DredmorInfo.XmlFilesToValidate, SearchOption.AllDirectories);

            XsdValidator xsd = new XsdValidator();

            result.XmlErrors = xsd.Validate(xmlFiles, true);

            if (!result.IsValid && result.XmlErrors.Any(p => p.XmlExceptionOccurred))
            {
                return(result);
            }

            resources.LoadResources(core);

            result.XmlErrors.AddRange(
                XmlResourceValidator.Validate(xmlFiles, resources)
                .Where(p => p.Errors.Count > 0)
                );

            return(result);
        }