private static void LoadFromXml(SimpleMapCollection simpleMaps, string filename) { try { FileInfo fileInfo = new FileInfo(filename); SimpleMap map; XmlAttribute attr; if (fileInfo.Exists) { XmlDocument xmldoc = new XmlDocument(); xmldoc.Load(filename); foreach (XmlNode parentnode in xmldoc.ChildNodes) { if (parentnode.HasChildNodes) { foreach (XmlNode node in parentnode.ChildNodes) { if (node.Name.ToLower() == "map") { map = new SimpleMap(); attr = node.Attributes["source"]; if (attr != null) { map.Source = attr.Value; } attr = node.Attributes["target"]; if (attr != null) { map.Target = attr.Value; } attr = node.Attributes["isregexp"]; if (attr != null) { map.isRegExp = Convert.ToBoolean(attr.Value); } simpleMaps.Add(map); } } } } } } catch // (Exception ex) { } }
public int Add(SimpleMap map) { return simpleMaps.Add(map); }
private static void LoadFromXml(SimpleMapCollection simpleMaps, string filename) { try { FileInfo fileInfo = new FileInfo(filename); SimpleMap map; XmlAttribute attr; if (fileInfo.Exists) { XmlDocument xmldoc = new XmlDocument(); xmldoc.Load(filename); foreach (XmlNode parentnode in xmldoc.ChildNodes) { if (parentnode.HasChildNodes) { foreach (XmlNode node in parentnode.ChildNodes) { if (node.Name.ToLower() == "map") { map = new SimpleMap(); attr = node.Attributes["source"]; if (attr != null) { map.Source = attr.Value; } attr = node.Attributes["target"]; if (attr != null) { map.Target = attr.Value; } attr = node.Attributes["isregexp"]; if (attr != null) { map.isRegExp = Convert.ToBoolean(attr.Value); } simpleMaps.Add(map); } } } } } } catch// (Exception ex) { } }
public int Add(SimpleMap map) { return(simpleMaps.Add(map)); }