Beispiel #1
0
        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");
        }
Beispiel #2
0
 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);
 }
Beispiel #3
0
        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();
        }
        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();
        }