Пример #1
0
        /// <summary>
        /// 转换行文本
        /// </summary>
        /// <param name="line">行文本</param>
        /// <returns>新文本</returns>
        private string ConvertLine(string line)
        {
            string newLine = line;

            CodeConvert codeConvert = CodeConvert.GetCodeConvert();

            codeConvert.ConvertTableName = "stringTable";
            List <string> wordList = codeConvert.GetStringList(line);

            if (wordList.Count > 0) // 需要字符串替换
            {
                DataBaseManager dataBaseManager = DataBaseManager.GetDataBaseManager();

                foreach (string s in wordList)
                {
                    if (!s.Contains(",") && !line.Contains(string.Format("context, {0}", s))) // 参数类型不用替换
                    {
                        string id = dataBaseManager.InsertIntoFlowChartLS(s.Replace("'", "''"), mapName);
                        newLine = newLine.Replace(s, string.Format("{0}[{1}]", codeConvert.ConvertTableName, id));
                    }
                }
            }

            return(newLine);
        }
Пример #2
0
        /// <summary>
        /// 转换脚本里的字符串
        /// </summary>
        /// <param name="content">脚本内容</param>
        /// <returns>转换后的字符串</returns>
        private string ConvertScriptText(string content)
        {
            CodeConvert codeConvert = CodeConvert.GetCodeConvert();

            codeConvert.ConvertTableName = "ARGUMENT_STRING_TABLE";
            List <string> wordList = codeConvert.GetStringList(content);

            if (wordList.Count > 0) // 需要字符串替换
            {
                DataBaseManager dataBaseManager = DataBaseManager.GetDataBaseManager();
                foreach (string s in wordList)
                {
                    string id = dataBaseManager.InsertIntoLS(s.Replace("'", "''"));
                    content = content.Replace(s, string.Format("{0}[{1}]", codeConvert.ConvertTableName, id));
                }
            }

            return(content);
        }