private static CategoryMap LoadCategoryMap(XElement categoryElement) { CategoryMap category = new CategoryMap() { Name = categoryElement.Attribute("Name").Value }; foreach (XElement subcategoryElement in categoryElement.Elements("Subcategory")) { SubcategoryMap subcategory = new SubcategoryMap { Name = subcategoryElement.Attribute("Name").Value, }; foreach (XElement mapElement in subcategoryElement.Elements("Map")) { var mapping = new RecipientToPayersMap(); mapping.Recipient = mapElement.Attribute("Recipient").Value; foreach (var payer in mapElement.Elements("Payer")) { mapping.Payers.Add(payer.Value); } subcategory.MapFrom.Add(mapping); } category.Subcategories.Add(subcategory); } return(category); }
private void LoadDictionary(FileInfo dictionaryFile) { XDocument xDoc = XDocument.Load(dictionaryFile.FullName); foreach (XElement categoryElement in xDoc.Root.Descendants("Category")) { CategoryMap category = LoadCategoryMap(categoryElement); this.categories.Add(category); } }