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 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 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"); }
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(); }