예제 #1
0
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="node"></param>
        public TableMap(XmlNode node)
        {
            Debug.Assert(node != null, "node参数不能为null");

            // 清空field list
            this.FieldMapList.Clear();

            // 来源信息
            XmlNode nodeSourceTable = node.SelectSingleNode("Source");

            if (nodeSourceTable != null)
            {
                this.SourceTable = new TableItem(nodeSourceTable);
            }

            // 目标信息
            XmlNode nodeTargetTable = node.SelectSingleNode("Target");

            if (nodeTargetTable != null)
            {
                this.TargetTable = new TableItem(nodeTargetTable);
            }

            // 判断是否是全量数据
            string isFullData = XmlUtil.GetAttrValue(node, "IsFullData").Trim();

            if (String.Compare(isFullData, "false", true) == 0)
            {
                this._isFullData = false;
            }

            // Name Jane 2009.6.5 加 用于区分Header和Detail
            this.Name = XmlUtil.GetAttrValue(node, "Name").Trim();

            // 初始化FieldMap列表,
            // 如果FieldMap不存在,则认为同步全部字段,且服务器表与客户端表结构完成一致
            XmlNodeList FieldMapList = node.SelectNodes("FieldMap");

            if (FieldMapList.Count > 0)
            {
                for (int i = 0; i < FieldMapList.Count; i++)
                {
                    XmlNode  nodeFieldMap = FieldMapList[i];
                    FieldMap fieldMap     = new FieldMap(nodeFieldMap);
                    this.FieldMapList.Add(fieldMap);
                }
            }
        }
예제 #2
0
        /// <summary>
        /// 规范化文件路径
        /// </summary>
        /// <param name="fileName"></param>
        /// <returns></returns>
        public static string RegularFilePath(string filePath)
        {
            // 替换宏
            filePath = TableItem.ReplaceMacro(filePath);

            // 转换为物理路径
            int nTempIndex = filePath.IndexOf("\\");

            if (nTempIndex > 0)
            {
                string leftFilePath = filePath.Substring(0, nTempIndex);
                if (leftFilePath == ".")
                {
                    string strFullyQualifiedName = Assembly.GetExecutingAssembly().GetModules()[0].FullyQualifiedName;
                    string appDir = Path.GetDirectoryName(strFullyQualifiedName);
                    filePath = appDir + filePath.Substring(nTempIndex);
                }
            }
            return(filePath);
        }