コード例 #1
0
ファイル: SimpleMap.cs プロジェクト: zhh007/MyGen
        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)
            {
            }
        }
コード例 #2
0
		public int Add(SimpleMap map)
		{
			return simpleMaps.Add(map);
		}
コード例 #3
0
		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)
			{
			}
		}
コード例 #4
0
ファイル: SimpleMapCollection.cs プロジェクト: zhh007/MyGen
 public int Add(SimpleMap map)
 {
     return(simpleMaps.Add(map));
 }