public void LoadConfig(XmlElement info) { caption = ConfigControl.GetXmlElementInnerText(info, "caption"); folder = ConfigControl.GetXmlElementInnerText(info, "folder"); package = ConfigControl.GetXmlElementInnerText(info, "package_basic"); XmlElement beanImportElement = info.SelectSingleNode("beanImport") as XmlElement; XmlNodeList beanList = beanImportElement.SelectNodes("string"); if (beanList.Count > 0) { beanImport = new string[beanList.Count]; for (int i = 0; i < beanList.Count; i++) { beanImport[i] = ((XmlElement)beanList[i]).InnerText; } } XmlElement containerImpoerElement = info.SelectSingleNode("containerImport") as XmlElement; XmlNodeList containerList = containerImpoerElement.SelectNodes("string"); if (containerList.Count > 0) { containerImport = new string[containerList.Count]; for (int i = 0; i < containerList.Count; i++) { containerImport[i] = ((XmlElement)containerList[i]).InnerText; } } isSet = ConfigControl.GetXmlElementInnerText(info, "isSet"); }
public void InitSetting(CheckedListBox listbox, List <ExcelData> sheets) { dataList = listbox; dataExcels = sheets; XmlDocument doc = ConfigControl.GetXmlDocument(@".\Config\JavaDataConfig.xml"); XmlElement root = ConfigControl.GetXmlRootAsElement(doc, "JavaDataGenerateConfig"); XmlElement config = root.SelectSingleNode("configs") as XmlElement; if (config != null) { XmlNodeList configList = config.SelectNodes("JavaDataGenerateInfo"); if (configList.Count > 0) { for (int i = 0; i < configList.Count; i++) { CJavaDataConfig dataConfig = new CJavaDataConfig(); dataConfig.LoadConfig((XmlElement)configList[i]); dataConfigs.Add(dataConfig); } } } int index = Convert.ToInt32(ConfigControl.GetXmlElementInnerText(root, "lastIndex")); currentConfig = index; //comboBoxConfigList.Items.Clear(); //for (int i = 0; i < dataConfigs.Count; i++) //{ // comboBoxConfigList.Items.Add(dataConfigs[i].caption); //} comBonRefreshFlag = true; RefreshData(); comboBoxConfigList.SelectedIndex = index; }
public void WriteConfig(XmlDocument doc, XmlElement parenteElement) { XmlElement captionElement = ConfigControl.CreateNewElement(doc, "caption", caption); parenteElement.AppendChild(captionElement); XmlElement folderElement = ConfigControl.CreateNewElement(doc, "folder", folder); parenteElement.AppendChild(folderElement); XmlElement dbConfigFileElement = ConfigControl.CreateNewElement(doc, "db_configFile", dbConfigFile); parenteElement.AppendChild(dbConfigFileElement); XmlElement baseDaoElement = ConfigControl.CreateNewElement(doc, "baseDao", baseDao); parenteElement.AppendChild(baseDaoElement); XmlElement packageElement = ConfigControl.CreateNewElement(doc, "package_basic", package); parenteElement.AppendChild(packageElement); XmlElement managerElement = ConfigControl.CreateNewElement(doc, "manager", manager); parenteElement.AppendChild(managerElement); XmlElement dbConfigElement = ConfigControl.CreateNewElement(doc, "db_config"); XmlElement dbTypeElement = ConfigControl.CreateNewElement(doc, "DbType", dbType); dbConfigElement.AppendChild(dbTypeElement); XmlElement userNameElement = ConfigControl.CreateNewElement(doc, "Username", dbUser); dbConfigElement.AppendChild(userNameElement); XmlElement pswElement = ConfigControl.CreateNewElement(doc, "Password", dbPsw); dbConfigElement.AppendChild(pswElement); XmlElement ipElement = ConfigControl.CreateNewElement(doc, "IPAddress", dbIp); dbConfigElement.AppendChild(ipElement); XmlElement portElement = ConfigControl.CreateNewElement(doc, "Port", dbport); dbConfigElement.AppendChild(portElement); XmlElement dbNameElement = ConfigControl.CreateNewElement(doc, "Database", dbName); dbConfigElement.AppendChild(dbNameElement); XmlElement verInfoElement = ConfigControl.CreateNewElement(doc, "VersionInfo"); XmlElement tableNameElement = ConfigControl.CreateNewElement(doc, "TableName", verInfoTableName); verInfoElement.AppendChild(tableNameElement); XmlElement tableFieldElement = ConfigControl.CreateNewElement(doc, "TableField", verInfoTablefield); verInfoElement.AppendChild(tableFieldElement); XmlElement intValfieldElement = ConfigControl.CreateNewElement(doc, "IntValueField", verInfoIntValueField); verInfoElement.AppendChild(intValfieldElement); XmlElement descFieldElement = ConfigControl.CreateNewElement(doc, "DescField", verDescField); verInfoElement.AppendChild(descFieldElement); dbConfigElement.AppendChild(verInfoElement); parenteElement.AppendChild(dbConfigElement); XmlElement overLapElement = ConfigControl.CreateNewElement(doc, "overlap", overLap); parenteElement.AppendChild(overLapElement); }
public void Init(LinkLabel linkLabel) { linkLabel1 = linkLabel; doc = ConfigControl.GetXmlDocument(@".\Config\BasicConfig.xml"); XmlElement rootElement = ConfigControl.GetXmlRootAsElement(doc, "BasicConfig"); folderElement = ConfigControl.GetXmlElement(rootElement, "folder"); path = folderElement.InnerText; textBoxPath.Text = path; }
public void Init(string[] xmlPath) { filepaths = xmlPath; doc = ConfigControl.GetXmlDocument(@".\Config\MessageConfig.xml"); XmlElement rootElement = ConfigControl.GetXmlRootAsElement(doc, "MessageConfig"); XmlElement csElement = ConfigControl.GetXmlElement(rootElement, "CS"); outPathElement = ConfigControl.GetXmlElement(csElement, "OutPath"); outPath = outPathElement.InnerText; textBoxPath.Text = outPath; }
public static void SaveMessageSetting() { XmlDocument doc = ConfigControl.GetXmlDocument(@".\Config\MessageConfig.xml"); XmlElement rootElement = ConfigControl.GetXmlRootAsElement(doc, "MessageConfig"); XmlElement csElement = ConfigControl.GetXmlElement(rootElement, "CS"); ConfigControl.SetXmlelementInnerText(csElement, "CsMessageFile", CsMessageFilePath, doc); ConfigControl.SetXmlelementInnerText(csElement, "CsBeanTemplate", CsBeanTemplatePath, doc); ConfigControl.SetXmlelementInnerText(csElement, "CsMessageTemplate", CsMessageTemplatePath, doc); ConfigControl.SetXmlelementInnerText(csElement, "CsMessageTypeTemplate", CsMessageTypeTemplatePath, doc); ConfigControl.SetXmlelementInnerText(csElement, "CsFunMap", CsFunMapFilePath, doc); doc.Save(@".\Config\MessageConfig.xml"); }
public static bool GetXmlInnerTextTrueOrFalse(XmlElement element, string nodeName) { bool boolValue = false; XmlElement ele = ConfigControl.GetXmlElement(element, nodeName); if (ele != null) { if (ele.InnerText.Trim() == "true") { boolValue = true; } } return(boolValue); }
public void CreateJavaMessageSeries(string messageFilePath) { CMessages messages = ConfigControl.ReadMessageXml(messageFilePath); string messageCreatePath = Global.ResFolder + @"\Java\NetWork\" + messages.name; if (messages.beans != null && messages.beans.Length > 0) { CreateJavaMsBean(messages, messageCreatePath); } if (messages.messages != null && messages.messages.Length > 0) { CreateJavaMsMessage(messages, messageCreatePath); CreateJavaMsHandler(messages, messageCreatePath); UpdateMsgPool(messages, Global.ResFolder + @"\Java\NetWork\"); } }
public void LoadConfig(XmlElement Info) { caption = ConfigControl.GetXmlElementInnerText(Info, "caption"); folder = ConfigControl.GetXmlElementInnerText(Info, "folder"); dbConfigFile = ConfigControl.GetXmlElementInnerText(Info, "db_configFile"); baseDao = ConfigControl.GetXmlElementInnerText(Info, "baseDao"); package = ConfigControl.GetXmlElementInnerText(Info, "package_basic"); manager = ConfigControl.GetXmlElementInnerText(Info, "manager"); XmlElement dbConfig = Info.SelectSingleNode("db_config") as XmlElement; dbUser = ConfigControl.GetXmlElementInnerText(dbConfig, "Username"); dbPsw = ConfigControl.GetXmlElementInnerText(dbConfig, "Password"); dbIp = ConfigControl.GetXmlElementInnerText(dbConfig, "IPAddress"); dbport = ConfigControl.GetXmlElementInnerText(dbConfig, "Port"); dbName = ConfigControl.GetXmlElementInnerText(dbConfig, "Database"); }
public CDataBaseInfo(XmlElement dbElement) { dbType = ConfigControl.GetXmlElementInnerText(dbElement, "DbType"); address = ConfigControl.GetXmlElementInnerText(dbElement, "IPAddress"); title = ConfigControl.GetXmlElementInnerText(dbElement, "Title"); databaseName = ConfigControl.GetXmlElementInnerText(dbElement, "Database"); userName = ConfigControl.GetXmlElementInnerText(dbElement, "Username"); password = ConfigControl.GetXmlElementInnerText(dbElement, "Password"); port = ConfigControl.GetXmlElementInnerText(dbElement, "Port"); XmlElement versionElement = ConfigControl.GetXmlElement(dbElement, "VersionInfo"); versionTableName = ConfigControl.GetXmlElementInnerText(versionElement, "TableName"); versionTableField = ConfigControl.GetXmlElementInnerText(versionElement, "TableField"); versionValueField = ConfigControl.GetXmlElementInnerText(versionElement, "IntValueField"); versionDescField = ConfigControl.GetXmlElementInnerText(versionElement, "DescField"); localPositionPath = ConfigControl.GetXmlElementInnerText(dbElement, "LocalPositionPath"); }
public void ModifyNodeInConfig(XmlDocument doc, string path, XmlElement node) { ConfigControl.SetXmlelementInnerText(node, "DbType", dbType, doc); ConfigControl.SetXmlelementInnerText(node, "Title", title, doc); ConfigControl.SetXmlelementInnerText(node, "Username", userName, doc); ConfigControl.SetXmlelementInnerText(node, "Password", password, doc); ConfigControl.SetXmlelementInnerText(node, "IPAddress", address, doc); ConfigControl.SetXmlelementInnerText(node, "Port", port, doc); ConfigControl.SetXmlelementInnerText(node, "Database", databaseName, doc); ConfigControl.SetXmlelementInnerText(node, "TableName", versionTableName, doc); ConfigControl.SetXmlelementInnerText(node, "TableField", versionTableField, doc); ConfigControl.SetXmlelementInnerText(node, "IntValueField", title, doc); ConfigControl.SetXmlelementInnerText(node, "DescField", versionDescField, doc); ConfigControl.SetXmlelementInnerText(node, "Title", title, doc); ConfigControl.SetXmlelementInnerText(node, "LocalPositionPath", localPositionPath, doc); doc.Save(path); }
private void BtnSave_Click(object sender, EventArgs e) { SetCurrentData(); for (int i = 0; i < dataConfigs.Count; i++) { if (string.IsNullOrEmpty(dataConfigs[i].folder)) { if (MessageBox.Show(dataConfigs[i].caption + "配置路径为空,请设置", "空路径", MessageBoxButtons.OKCancel, MessageBoxIcon.Error) == DialogResult.OK) { currentConfig = i; return; } else { return; } } } XmlDocument doc = ConfigControl.GetXmlDocument(@".\Config\JavaDataConfig.xml"); XmlElement root = ConfigControl.GetXmlRootAsElement(doc, "JavaDataGenerateConfig"); XmlElement configelElement = root.SelectSingleNode("configs") as XmlElement; if (configelElement != null) { configelElement.RemoveAll(); if (dataConfigs.Count > 0) { foreach (var config in dataConfigs) { XmlElement infoElement = doc.CreateElement("JavaDataGenerateInfo"); config.WriteConfig(doc, infoElement); configelElement.AppendChild(infoElement); } } } XmlElement lastIndex = root.SelectSingleNode("lastIndex") as XmlElement; if (lastIndex != null) { lastIndex.InnerText = comboBoxConfigList.SelectedIndex.ToString(); } doc.Save(@".\Config\JavaDataConfig.xml"); }
private void btnCreate_Click(object sender, EventArgs e) { //if (btnSave.Enabled) { SaveConfig(); } Close(); foreach (string file in filepaths) { if (file.Substring(file.Length - 4) == ".xml") { Global.CsMessageFilePath = file; Global.CsMessages = ConfigControl.ReadMessageXml(Global.CsMessageFilePath); Debug.Log("配置表读取成功"); CCSHandleFuns.CreateCSMessage(checkBoxbean.Checked, checkBoxmessage.Checked, checkBoxhandler.Checked, checkBoxCservice.Checked, checkBoxMessagePool.Checked, outPath); } } System.Diagnostics.Process.Start("Explorer.exe", outPath); }
private void OKButton_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(CsTempFilePath)) { Global.CsTemplate = CsTempFilePath; } if (!string.IsNullOrEmpty(typeFilePath)) { Global.TypeBankFile = typeFilePath; } XmlDocument doc = ConfigControl.GetXmlDocument(@".\Config\BasicConfig.xml"); XmlElement rootElement = ConfigControl.GetXmlRootAsElement(doc, "BasicConfig"); ConfigControl.SetXmlelementInnerText(rootElement, "csTemplate", CsTempFilePath, doc); ConfigControl.SetXmlelementInnerText(rootElement, "typeBankFile", typeFilePath, doc); doc.Save(@".\Config\BasicConfig.xml"); this.Close(); }
public void CreateJavaResDataConfig(ExcelData excelSheetData, CJavaDataConfig javaDataConfig) { string dataConfigPath = javaDataConfig.folder + @"\src\data-config.xml"; if (File.Exists(dataConfigPath)) { XmlDocument doc = ConfigControl.GetXmlDocument(dataConfigPath); XmlElement rootElement = ConfigControl.GetXmlRootAsElement(doc, "configuration"); XmlElement mappersElement = rootElement.SelectSingleNode("mappers") as XmlElement; if (mappersElement.ChildNodes.Count > 0) { XmlNodeList list = mappersElement.ChildNodes; MapperNode[] nodes = new MapperNode[list.Count / 2]; for (int i = 0; i < nodes.Length; i++) { nodes[i] = new MapperNode(); //nodes[i].nodeValue = list[i*2].Value; XmlElement element = (XmlElement)list[i * 2 + 1]; string fullNmae = element.GetAttribute("resource"); int beginIndex = fullNmae.LastIndexOf(@"/"); int endIndex = fullNmae.LastIndexOf("."); nodes[i].name = fullNmae.Substring(beginIndex + 1, endIndex - beginIndex - 1).Trim(); string nodeValue = list[i * 2].Value; int startIndex = nodeValue.IndexOf(":"); nodes[i].time = nodeValue.Substring(startIndex + 1).Trim(); } WriteToDataConfig(excelSheetData, dataConfigPath, javaDataConfig, nodes); } else { WriteToDataConfig(excelSheetData, dataConfigPath, javaDataConfig, null); } Debug.Log(" data-config" + ".xml文件更新完毕"); } else { WriteToDataConfig(excelSheetData, dataConfigPath, javaDataConfig, null); Debug.Log(" data-config" + ".xml文件生成完毕"); } }
public static void InitMessageSetting() { XmlDocument doc = ConfigControl.GetXmlDocument(@".\Config\MessageConfig.xml"); XmlElement rootElement = ConfigControl.GetXmlRootAsElement(doc, "MessageConfig"); ///C#配置读取 XmlElement csElement = ConfigControl.GetXmlElement(rootElement, "CS"); XmlElement csMessageFileElement = ConfigControl.GetXmlElement(csElement, "CsMessageFile"); if (csMessageFileElement != null) { CsMessageFilePath = csMessageFileElement.InnerText.Trim(); } XmlElement csBeanTemplateElement = ConfigControl.GetXmlElement(csElement, "CsBeanTemplate"); if (csBeanTemplateElement != null) { CsBeanTemplatePath = csBeanTemplateElement.InnerText.Trim(); } XmlElement csMessageTemplateElement = ConfigControl.GetXmlElement(csElement, "CsMessageTemplate"); if (csMessageTemplateElement != null) { CsMessageTemplatePath = csMessageTemplateElement.InnerText.Trim(); } CsMessageTypeTemplatePath = ConfigControl.GetXmlElementInnerText(csElement, "CsMessageTypeTemplate"); XmlElement csFunMapElement = ConfigControl.GetXmlElement(csElement, "CsFunMap"); if (csFunMapElement != null) { CsFunMapFilePath = csFunMapElement.InnerText.Trim(); } ///AS配置读取 XmlElement asElement = ConfigControl.GetXmlElement(rootElement, "AS"); AsMessageFilePath = ConfigControl.GetXmlElementInnerText(asElement, "AsMessageFile"); AsBeanTemplatePath = ConfigControl.GetXmlElementInnerText(asElement, "AsBeanTemplate"); AsMessageTemplatePath = ConfigControl.GetXmlElementInnerText(asElement, "AsMessageTemplate"); AsHandleTemplatePath = ConfigControl.GetXmlElementInnerText(asElement, "AsHandleTemplate"); AsFunMapFilePath = ConfigControl.GetXmlElementInnerText(asElement, "AsFunMap"); }
public void InitSetting(CheckedListBox listbox, List <ExcelData> sheets, bool asFlag = true) { isAs = asFlag; dataList = listbox; dataExcels = sheets; XmlElement root; if (isAs) { XmlDocument doc = ConfigControl.GetXmlDocument(@".\Config\AsDataConfig.xml"); root = ConfigControl.GetXmlRootAsElement(doc, "AsDataGenerateConfig"); XmlElement config = root.SelectSingleNode("configs") as XmlElement; if (config != null) { XmlNodeList configList = config.SelectNodes("AsDataGenerateInfo"); if (configList.Count > 0) { for (int i = 0; i < configList.Count; i++) { CAsDataConfig dataConfig = new CAsDataConfig(); dataConfig.LoadConfig((XmlElement)configList[i]); dataConfigs.Add(dataConfig); } } } } else { label1.Text = "Cs Src目录:"; label2.Text = "Cs包:"; label3.Text = "bean using List:"; label4.Text = "Container using list:"; XmlDocument doc = ConfigControl.GetXmlDocument(@".\Config\CsDataConfig.xml"); root = ConfigControl.GetXmlRootAsElement(doc, "CsDataGenerateConfig"); XmlElement config = root.SelectSingleNode("configs") as XmlElement; if (config != null) { XmlNodeList configList = config.SelectNodes("CsDataGenerateInfo"); if (configList.Count > 0) { for (int i = 0; i < configList.Count; i++) { CAsDataConfig dataConfig = new CAsDataConfig(); dataConfig.LoadConfig((XmlElement)configList[i]); dataConfigs.Add(dataConfig); } } } checkBoxLoad.Checked = false; } int index = Convert.ToInt32(ConfigControl.GetXmlElementInnerText(root, "lastIndex")); currentConfig = index; //comboBoxCapterList.Items.Clear(); //for (int i = 0; i < dataConfigs.Count; i++) //{ // comboBoxCapterList.Items.Add(dataConfigs[i].caption); //} comBoxRefreshFlag = true; RefreshData(); //comboBoxCapterList.SelectedIndex = index; }
private void Save_Click(object sender, EventArgs e) { Global.FilterSheets = FilterSheetText.Text; Global.StartLoadFolder = StartLoadFoldercheckBox.Checked; Global.LoadData = LoadDataCheckBox.Checked; Global.ResFolder = ResFolderText.Text; Global.IsDataBase = IsDataBaseCheckBox.Checked; Global.IsDisorder = IsDisorderCheckBox.Checked; Global.IsResEnc = IsResEncCheckBox.Checked; if (VersionCheckBox.Checked) { Global.DisEncType = SeedType.Version; } else if (CRC32CheckBox.Checked) { Global.DisEncType = SeedType.CRC32; } else if (MD5CheckBox.Checked) { Global.DisEncType = SeedType.MD5; } else if (SHA1CheckBox.Checked) { Global.DisEncType = SeedType.SHA1; } XmlDocument doc = ConfigControl.GetXmlDocument(@".\Config\BasicConfig.xml"); XmlElement rootElement = ConfigControl.GetXmlRootAsElement(doc, "BasicConfig"); XmlElement filterElement = ConfigControl.GetXmlElement(rootElement, "filterSheets"); XmlNodeList list = filterElement.SelectNodes("string"); foreach (XmlNode node in list) { filterElement.RemoveChild(node); } if (Global.FilterSheets != "") { string[] splites = Global.FilterSheets.Split(','); foreach (var sp in splites) { if (sp != "") { XmlElement element = doc.CreateElement("string"); element.InnerText = sp; filterElement.AppendChild(element); } } } ConfigControl.SetXmlelementInnerText(rootElement, "startLoadFolder", Global.StartLoadFolder, doc); ConfigControl.SetXmlelementInnerText(rootElement, "loadData", Global.LoadData, doc); ConfigControl.SetXmlelementInnerText(rootElement, "resFolder", Global.ResFolder, doc); ConfigControl.SetXmlelementInnerText(rootElement, "isDatabase", Global.IsDataBase, doc); ConfigControl.SetXmlelementInnerText(rootElement, "isDisorder", Global.IsDisorder, doc); ConfigControl.SetXmlelementInnerText(rootElement, "isResEnc", Global.IsResEnc, doc); ConfigControl.SetXmlelementInnerText(rootElement, "resFolder", Global.ResFolder, doc); switch (Global.DisEncType) { case SeedType.Version: ConfigControl.SetXmlelementInnerText(rootElement, "disEncType", "Version", doc); break; case SeedType.CRC32: ConfigControl.SetXmlelementInnerText(rootElement, "disEncType", "CRC32", doc); break; case SeedType.MD5: ConfigControl.SetXmlelementInnerText(rootElement, "disEncType", "MD5", doc); break; case SeedType.SHA1: ConfigControl.SetXmlelementInnerText(rootElement, "disEncType", "SHA1", doc); break; default: break; } doc.Save(@".\Config\BasicConfig.xml"); this.Close(); }