//继续执行自动保存 private void ContinueAutoSave() { //定义压缩路径 string inputPath = ConfigurationSettings.AppSettings["CompressInputPath"]; string outputPath = ConfigurationSettings.AppSettings["CompressOutPutPath"]; //Xml文件处理---JAVA多语言文件处理 this.CompareTab.SelectedIndex = 1; string companies = ConfigurationSettings.AppSettings["CompanyList"]; List<string> configFiles = new List<string>() { "TradingConsole.config", "Settings.xml" }; List<string> CompanyList = new List<string>(); List<string> LanguageList = new List<string>(); string[] companyLanguageArray = companies.Split('|'); //第三步:对公司循环 for (int i = 0; i < companyLanguageArray.Length; i++) { string companyName = companyLanguageArray[i].Split(';')[0].Trim(); //test if (i >= 1) return; string[] languageArray = companyLanguageArray[i].Split(';')[1].Split(','); //对语言进行循环 for (int j = 0; j < languageArray.Length; j++) { bool isHasModifyRecord = false; bool isHasAddRecord = false; //获取文件路径 PathJoin pathJoin = new PathJoin(); pathJoin.ChangeSet = this.ChangeSetTextBox.Text; pathJoin.Company = companyName; pathJoin.LanguageCode = languageArray[j]; pathJoin.ParentFileName = "Language"; pathJoin.XmlFileName = "Default.xml"; string currentFileFullName = pathJoin.Company + pathJoin.ParentFileName + pathJoin.LanguageCode + pathJoin.XmlFileName; if (this._HaveCompareFiles.Contains(currentFileFullName)) continue; string oldFilePath = this.GetJavaXmlFilePath(pathJoin).Split('|')[0]; string newFilePath = this.GetJavaXmlFilePath(pathJoin).Split('|')[1]; //导入xml数据 this.ExportJavaData(oldFilePath, newFilePath, out isHasAddRecord, out isHasModifyRecord); if (isHasAddRecord || isHasModifyRecord) { if (MessageBox.Show("文件有新增或者修改记录,是否手动编辑?", "系统提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Information) == System.Windows.Forms.DialogResult.OK) { this._HaveCompareFiles.Add(currentFileFullName); return; } //开始保存文件 this.SaveJava(newFilePath, "Languages"); this._HaveCompareFiles.Add(currentFileFullName); } } //循环配置jar文件 foreach (string fileName in configFiles) { bool isHasModifyRecord = false; bool isHasAddRecord = false; //获取文件路径 PathJoin pathJoin = new PathJoin(); pathJoin.ChangeSet = this.ChangeSetTextBox.Text; pathJoin.Company = companyName; pathJoin.LanguageCode = null; pathJoin.ParentFileName = "Configuration"; pathJoin.XmlFileName = fileName; string currentFileFullName = pathJoin.Company + pathJoin.ParentFileName + pathJoin.LanguageCode + pathJoin.XmlFileName; if (this._HaveCompareFiles.Contains(currentFileFullName)) continue; string oldFilePath = this.GetJavaXmlFilePath(pathJoin).Split('|')[0]; string newFilePath = this.GetJavaXmlFilePath(pathJoin).Split('|')[1]; //导入xml数据 this.ExportJavaData(oldFilePath, newFilePath, out isHasAddRecord, out isHasModifyRecord); if (isHasAddRecord || isHasModifyRecord) { if (MessageBox.Show("文件有新增或者修改记录,是否手动编辑?", "系统提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Information) == System.Windows.Forms.DialogResult.OK) { this._HaveCompareFiles.Add(currentFileFullName); return; } } //开始保存文件 this.SaveJava(newFilePath, "configuration"); this._HaveCompareFiles.Add(currentFileFullName); //对该公司文件进行压缩 this.CompressZip(string.Format(inputPath, "Language"), string.Format(outputPath, this.PublishChangeSetTextBox.Text, companyName, "TradingConsole.Language.jar"), "TradingConsole.Language.jar"); this.CompressZip(string.Format(inputPath, "Configuration"), string.Format(outputPath, this.PublishChangeSetTextBox.Text, companyName, "TradingConsole.Configuration.jar"), "TradingConsole.Configuration.jar"); } } }
private string GetJavaXmlFilePath(PathJoin pathJoin) { string oldFilePath = ConfigurationSettings.AppSettings["OldZipToPath"] + "\\{2}\\{3}\\{4}"; string newFilePath = ConfigurationSettings.AppSettings["NewZipToPath"] + "\\{1}\\{2}\\{3}"; oldFilePath = string.Format(oldFilePath, pathJoin.ChangeSet, pathJoin.Company,pathJoin.ParentFileName,pathJoin.LanguageCode,pathJoin.XmlFileName); newFilePath = string.Format(newFilePath, pathJoin.ParentFileName, pathJoin.ParentFileName, pathJoin.LanguageCode,pathJoin.XmlFileName); oldFilePath = oldFilePath.Replace("\\\\", "\\"); newFilePath = newFilePath.Replace("\\\\", "\\"); return oldFilePath + "|" + newFilePath; }