コード例 #1
0
        public DbNameMap Clone()
        {
            /*
             *          DbNameMap result = new DbNameMap();
             *
             *          foreach( DictionaryEntry entry in this)
             *          {
             *                  // int i =0;
             *
             *
             *                  DbNameMapItem olditem = (DbNameMapItem)this[entry.Key];
             *
             *                  DbNameMapItem newitem = new DbNameMapItem();
             *
             *                  newitem.strOrigin = olditem.strOrigin;
             *                  newitem.strStyle = olditem.strStyle;
             *                  newitem.strTarget = olditem.strTarget;
             *
             *                  result.Add(entry.Key, newitem);
             *          }
             */
            DbNameMap result = new DbNameMap();

            for (int i = 0; i < this.m_list.Count; i++)
            {
                DbNameMapItem olditem = (DbNameMapItem)this.m_list[i];

                string strError = "";
                if (result.NewItem(olditem.Origin, olditem.Target, olditem.Style, out strError) == null)
                {
                    throw new Exception(strError);
                }
            }
            return(result);
        }
コード例 #2
0
        // 构造map对象。
        // parameters:
        //		strDbPaths	分号间隔的路径。将创建为Origin和Target相同的overwrite事项。
        //					格式为 dbpathorigin-dbpathtarget|style;...
        //					可以省略为dbpath1;dbpath2;... 每个path既当origin也当target用
        public static DbNameMap Build(string strDbPaths,
                                      out string strError)
        {
            strError = "";
            DbNameMap map = new DbNameMap();

            string[] aPath = strDbPaths.Split(new char[] { ';' });

            for (int i = 0; i < aPath.Length; i++)
            {
                string strLine = aPath[i].Trim();
                if (strLine == "")
                {
                    continue;
                }
                string strOrigin = "";
                string strTarget = "";
                string strStyle  = "";

                int nRet = strLine.IndexOf("|");
                if (nRet == -1)
                {
                    strStyle = "overwrite";
                }
                else
                {
                    strStyle = strLine.Substring(nRet + 1).Trim().ToLower();
                    strLine  = strLine.Substring(0, nRet).Trim();
                }

                nRet = strLine.IndexOf("-");
                if (nRet == -1)
                {
                    strOrigin = strLine;
                    strTarget = strLine;
                }
                else
                {
                    strOrigin = strLine.Substring(0, nRet).Trim();
                    strTarget = strLine.Substring(nRet + 1).Trim();
                }

                if (map.NewItem(strOrigin, strTarget, strStyle, out strError) == null)
                {
                    return(null);
                }
            }

            return(map);
        }
コード例 #3
0
ファイル: DbNameMap.cs プロジェクト: renyh1013/dp2
		// 构造map对象。
		// parameters:
		//		strDbPaths	分号间隔的路径。将创建为Origin和Target相同的overwrite事项。
		//					格式为 dbpathorigin-dbpathtarget|style;...
		//					可以省略为dbpath1;dbpath2;... 每个path既当origin也当target用
		public static DbNameMap Build(string strDbPaths,
            out string strError)
		{
            strError = "";
			DbNameMap map = new DbNameMap();

			string[] aPath = strDbPaths.Split(new char[]{';'});

			for(int i=0;i<aPath.Length;i++)
			{
				string strLine = aPath[i].Trim();
				if (strLine == "")
					continue;
				string strOrigin = "";
				string strTarget = "";
				string strStyle = "";

				int nRet = strLine.IndexOf("|");
				if (nRet == -1)
					strStyle = "overwrite";
				else 
				{
					strStyle = strLine.Substring(nRet + 1).Trim().ToLower();
					strLine = strLine.Substring(0, nRet).Trim();
				}

				nRet = strLine.IndexOf("-");
				if (nRet == -1)
				{
					strOrigin = strLine;
					strTarget = strLine;
				}
				else 
				{
					strOrigin = strLine.Substring(0, nRet).Trim();
					strTarget = strLine.Substring(nRet + 1).Trim();
				}

				if (map.NewItem(strOrigin, strTarget, strStyle, out strError) == null)
                    return null;
			}

			return map;
		}
コード例 #4
0
ファイル: DbNameMap.cs プロジェクト: renyh1013/dp2
		public DbNameMap Clone()
		{
			/*
			DbNameMap result = new DbNameMap();

			foreach( DictionaryEntry entry in this)
			{
				// int i =0;
				

				DbNameMapItem olditem = (DbNameMapItem)this[entry.Key];

				DbNameMapItem newitem = new DbNameMapItem();

				newitem.strOrigin = olditem.strOrigin;
				newitem.strStyle = olditem.strStyle;
				newitem.strTarget = olditem.strTarget;

				result.Add(entry.Key, newitem);
			}
			*/
			DbNameMap result = new DbNameMap();

			for(int i=0;i<this.m_list.Count;i++)
			{
				DbNameMapItem olditem = (DbNameMapItem)this.m_list[i];

                string strError = "";
				if (result.NewItem(olditem.Origin, olditem.Target, olditem.Style, out strError) == null)
                    throw new Exception(strError);
			}
			return result;
		}