void LoadMappings(string mappingFilePath) { XPathNavigator top; XPathDocument doc; try { doc = new XPathDocument(mappingFilePath); top = doc.CreateNavigator(); } catch (Exception ex) { throw new ApplicationException("Error loading mapping settings", ex); } XPathNodeIterator iter; if (_mappers == null) { _mappers = new Dictionary <Type, SettingsMapping> (); } else { iter = top.Select("//settingsMap/clear"); if (iter.MoveNext()) { _mappers.Clear(); } } iter = top.Select("//settingsMap/map[string-length (@sectionType) > 0 and string-length (@mapperType) > 0 and string-length (@platform) > 0]"); SettingsMapping map; while (iter.MoveNext()) { map = new SettingsMapping(iter.Current); if (_myPlatform != map.Platform) { continue; } if (!_mappers.ContainsKey(map.SectionType)) { _mappers.Add(map.SectionType, map); } else { _mappers [map.SectionType] = map; } } }
void LoadMappings (string mappingFilePath) { XPathNavigator top; XPathDocument doc; try { doc = new XPathDocument (mappingFilePath); top = doc.CreateNavigator (); } catch (Exception ex) { throw new ApplicationException ("Error loading mapping settings", ex); } XPathNodeIterator iter; if (_mappers == null) _mappers = new Dictionary <Type, SettingsMapping> (); else { iter = top.Select ("//settingsMap/clear"); if (iter.MoveNext ()) _mappers.Clear (); } iter = top.Select ("//settingsMap/map[string-length (@sectionType) > 0 and string-length (@mapperType) > 0 and string-length (@platform) > 0]"); SettingsMapping map; while (iter.MoveNext ()) { map = new SettingsMapping (iter.Current); if (_myPlatform != map.Platform) continue; if (!_mappers.ContainsKey (map.SectionType)) _mappers.Add (map.SectionType, map); else _mappers [map.SectionType] = map; } }