private void btnOk_Click(object sender, EventArgs e) { HostSettingConfig.SetValue("hostname", txthostname.Text); HostSettingConfig.SetValue("debug", ckdebug.Checked ? "1" : "0"); HostSettingConfig.SetValue("wcfservice", ckwcf.Checked ? "1" : "0"); HostSettingConfig.SetValue("router", ckrouter.Checked ? "1" : "0"); HostSettingConfig.SetValue("filetransfer", ckfile.Checked ? "1" : "0"); HostSettingConfig.SetValue("heartbeat", ckheartbeat.Checked ? "1" : "0"); HostSettingConfig.SetValue("heartbeattime", txtheartbeattime.Text); HostSettingConfig.SetValue("message", ckmessage.Checked ? "1" : "0"); HostSettingConfig.SetValue("messagetime", txtmessagetime.Text); HostSettingConfig.SetValue("compress", ckJsoncompress.Checked ? "1" : "0"); HostSettingConfig.SetValue("encryption", ckEncryption.Checked ? "1" : "0"); HostSettingConfig.SetValue("overtime", ckovertime.Checked ? "1" : "0"); HostSettingConfig.SetValue("overtimetime", txtovertime.Text); HostSettingConfig.SaveConfig(); XmlNode node; node = xmldoc_app.DocumentElement.SelectSingleNode("system.serviceModel/services/service[@name='EFWCoreLib.WcfFrame.WcfService.WCFHandlerService']/host/baseAddresses/add"); if (node != null) { node.Attributes["baseAddress"].Value = txtwcf.Text; } node = xmldoc_app.DocumentElement.SelectSingleNode("system.serviceModel/services/service[@name='EFWCoreLib.WcfFrame.WcfService.RouterHandlerService']/host/baseAddresses/add"); if (node != null) { node.Attributes["baseAddress"].Value = txtrouter.Text; } node = xmldoc_app.DocumentElement.SelectSingleNode("system.serviceModel/services/service[@name='EFWCoreLib.WcfFrame.WcfService.FileTransferHandlerService']/host/baseAddresses/add"); if (node != null) { node.Attributes["baseAddress"].Value = txtfile.Text; } node = xmldoc_app.DocumentElement.SelectSingleNode("system.serviceModel/services/service[@name='EFWCoreLib.WcfFrame.WcfService.WebAPIHandlerService']/host/baseAddresses/add"); if (node != null) { node.Attributes["baseAddress"].Value = txtweb.Text; } node = xmldoc_entlib.DocumentElement.SelectSingleNode("connectionStrings"); if (node != null) { node.InnerXml = txtconnstr.Text; } xmldoc_app.Save(appconfig); xmldoc_entlib.Save(entlibconfig); isOk = true; MessageBox.Show("保存参数后,需重启程序才会生效!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); }
private void btnOk_Click(object sender, EventArgs e) { HostSettingConfig.SetValue("hostname", txthostname.Text); HostSettingConfig.SetValue("rootmnode", ckRoot.Checked ? "1" : "0"); HostSettingConfig.SetValue("debug", ckdebug.Checked ? "1" : "0"); HostSettingConfig.SetValue("timingtask", cktask.Checked ? "1" : "0"); HostSettingConfig.SetValue("wcfservice", ckwcf.Checked ? "1" : "0"); HostSettingConfig.SetValue("router", ckrouter.Checked ? "1" : "0"); HostSettingConfig.SetValue("filetransfer", ckfile.Checked ? "1" : "0"); HostSettingConfig.SetValue("webapi", ckWebapi.Checked ? "1" : "0"); HostSettingConfig.SetValue("mongodb", ckmongo.Checked ? "1" : "0"); HostSettingConfig.SetValue("mongodb_binpath", txtmongobinpath.Text); HostSettingConfig.SetValue("mongodb_conn", txtmongodb_conn.Text); HostSettingConfig.SetValue("heartbeat", ckheartbeat.Checked ? "1" : "0"); HostSettingConfig.SetValue("heartbeattime", txtheartbeattime.Text); HostSettingConfig.SetValue("message", ckmessage.Checked ? "1" : "0"); HostSettingConfig.SetValue("messagetime", txtmessagetime.Text); HostSettingConfig.SetValue("compress", ckJsoncompress.Checked ? "1" : "0"); HostSettingConfig.SetValue("encryption", ckEncryption.Checked ? "1" : "0"); HostSettingConfig.SetValue("token", cktoken.Checked ? "1" : "0"); HostSettingConfig.SetValue("overtime", ckovertime.Checked ? "1" : "0"); HostSettingConfig.SetValue("overtimetime", txtovertime.Text); HostSettingConfig.SetValue("serializetype", cbSerializeType.SelectedIndex.ToString()); HostSettingConfig.SetValue("nginx", ckNginx.Checked ? "1" : "0"); HostSettingConfig.SaveConfig(); HostAddressConfig.SetWcfAddress(txtwcf.Text); HostAddressConfig.SetFileAddress(txtfile.Text); HostAddressConfig.SetRouterAddress(txtrouter.Text); HostAddressConfig.SetfileRouterAddress(txtfilerouter.Text); HostAddressConfig.SetClientWcfAddress(txtwcfurl.Text); HostAddressConfig.SetClientFileAddress(txtfileurl.Text); HostAddressConfig.SetClientLocalAddress(txtlocalurl.Text); //HostAddressConfig.SetWebapiAddress(txtweb.Text); //HostAddressConfig.SetWebapiClientBase(txtclientwcf.Text); //HostAddressConfig.SetWebapiClientFile(txtclientfile.Text); HostAddressConfig.SetUpdaterUrl(txtupdate.Text); HostAddressConfig.SaveConfig(); HostDataBaseConfig.SetConnString(txtconnstr.Text); HostDataBaseConfig.SaveConfig(); HostMongoDBConfig.SetConfig(txtMongodb.Text);//保存mongodb配置文件 isOk = true; MessageBox.Show("保存参数后,需重启程序才会生效!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); }
private void btnOk_Click(object sender, EventArgs e) { HostSettingConfig.SetValue("hostname", txthostname.Text); HostSettingConfig.SetValue("debug", ckdebug.Checked ? "1" : "0"); HostSettingConfig.SetValue("wcfservice", ckwcf.Checked ? "1" : "0"); HostSettingConfig.SetValue("router", ckrouter.Checked ? "1" : "0"); HostSettingConfig.SetValue("filetransfer", ckfile.Checked ? "1" : "0"); HostSettingConfig.SetValue("webapi", ckWebapi.Checked ? "1" : "0"); HostSettingConfig.SetValue("heartbeat", ckheartbeat.Checked ? "1" : "0"); HostSettingConfig.SetValue("heartbeattime", txtheartbeattime.Text); HostSettingConfig.SetValue("message", ckmessage.Checked ? "1" : "0"); HostSettingConfig.SetValue("messagetime", txtmessagetime.Text); HostSettingConfig.SetValue("compress", ckJsoncompress.Checked ? "1" : "0"); HostSettingConfig.SetValue("encryption", ckEncryption.Checked ? "1" : "0"); HostSettingConfig.SetValue("overtime", ckovertime.Checked ? "1" : "0"); HostSettingConfig.SetValue("overtimetime", txtovertime.Text); HostSettingConfig.SetValue("serializetype", cbSerializeType.SelectedIndex.ToString()); HostSettingConfig.SaveConfig(); HostAddressConfig.SetWcfAddress(txtwcf.Text); HostAddressConfig.SetFileAddress(txtfile.Text); HostAddressConfig.SetRouterAddress(txtrouter.Text); HostAddressConfig.SetfileRouterAddress(txtfilerouter.Text); HostAddressConfig.SetClientWcfAddress(txtwcfurl.Text); HostAddressConfig.SetClientFileAddress(txtfileurl.Text); HostAddressConfig.SetWebapiAddress(txtweb.Text); HostAddressConfig.SaveConfig(); HostDataBaseConfig.SetConnString(txtconnstr.Text); HostDataBaseConfig.SaveConfig(); isOk = true; MessageBox.Show("保存参数后,需重启程序才会生效!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); }
/*写入注册表*/ public static void WriteSetting(string Setting) { HostSettingConfig.SetValue("cdkey", Setting); HostSettingConfig.SaveConfig(); }