从SuperSocket的App.config中读取配置,并修改保存,再重启服务
string XmlPath = System.Windows.Forms.Application.ExecutablePath + ".config";
XmlDocument xDoc = new XmlDocument();
xDoc.Load(XmlPath);
XmlNode Node_superSocket= xDoc.SelectSingleNode("//superSocket");
if (Node_superSocket == null)
{
return;
}
XmlNode Node_servers= Node_superSocket.SelectSingleNode("//servers");
if (Node_servers == null)
{
return;
}
XmlNode Node_server = Node_servers.FirstChild;
if (Node_server == null)
{
return;
}
#region 参数合法性检查
#endregion
XmlAttribute att;
att = Node_server.Attributes["ip"];
att.Value = this.tb_ip.Text;
att = Node_server.Attributes["port"];
att.Value = this.tb_port.Text;
att = Node_server.Attributes["idleSessionTimeOut"];
att.Value = this.tb_idleSessionTimeOut.Text;
att = Node_server.Attributes["receiveBufferSize"];
att.Value = this.tb_receiveBufferSize.Text;
att = Node_server.Attributes["maxConnectionNumber"];
att.Value = this.tb_maxConnectionNumber.Text;
xDoc.Save(XmlPath);
Application.ExitThread();
Application.Exit();
Application.Restart();
Process.GetCurrentProcess().Kill();
从SuperSocket的App.config中读取配置,并修改保存,再重启服务的更多相关文章
- 从App.config中读取数据库连接字符串
1.首先在App.config文件中添加如下代码注意<connectionStrings>插入位置. <connectionStrings> <add name=&quo ...
- web.config or app.config 中configSections配置节点
以前还真没见过,今天看项目中有在用,简单写了个Demo,这样配置的好处就是可以自定义配置,更加模块化,直接上代码; 1.配置文件 由于我创建的是一个控制台项目,所以配置文件是App.Config:(这 ...
- asp.net 在自己指定的文件夹下面弄个App.config来读取配置
.注意首先你要在你的应用程序的根目录下面新建一个Config的文件夹,然后在你新建的Config文件夹下面建立一个MyApp.config文件,根据标准的App.config复制一个过来稍作修改就好, ...
- 项目文件中含有两个config文件,app.config与app1.config,如何获取app1.config中的配置
想要通过配置文件配置C#前台画面,好奇做了以下测试:在项目中新建了app.config与app1.config两个配置文件,请教一下各位高手如果想从app1.config中读取配置信息应该如何读取?采 ...
- 在Web.config或App.config中的添加自定义配置
.Net中的System.Configuration命名空间为我们在web.config或者app.config中自定义配置提供了完美的支持.最近看到一些项目中还在自定义xml文件做程序的配置,所以忍 ...
- 在Web.config或App.config中的添加自定义配置 <转>
.Net中的System.Configuration命名空间为我们在web.config或者app.config中自定义配置提供了完美的支持.最近看到一些项目中还在自定义xml文件做程序的配置 ...
- [转]WinForm和WebForm下读取app.config web.config 中邮件配置的方法
本文转自:http://blog.csdn.net/jinbinhan/article/details/1598386 1. 在WinForm下读取 App.config中的邮件配置语句如下: Con ...
- 修改和获取web.config或app.config文件appSettings配置节中的Add里的value属性 函数
1: /// <summary> 2: /// 修改web.config或app.config文件appSettings配置节中的Add里的value属性 3: /// </summ ...
- winform中读取App.config中数据连接字符串
1.首先要在工程引用中导入System.Configuration.dll文件的引用. 2.通过System.Configuration.ConfigurationManager.Connection ...
随机推荐
- Jmeter使用指南----压力测试工具
来源: https://blog.csdn.net/u012111923/article/details/80705141 https://www.cnblogs.com/st-leslie/p/51 ...
- Dijkstra实现最短路径
#include<cstdio> #include<iostream> #include<algorithm> using namespace std; const ...
- SpringCloud---消息驱动的微服务---Spring Cloud Stream
1.概述 1.1 Spring Cloud Stream:用来 为微服务应用 构建 消息驱动能力的框架: 可基于SpringBoot来创建独立.可用于生产的Spring应用程序: 使用Sp ...
- Hive中 使用 Round() 的坑
有个算法如下: SELECT MEMBERNUMBER, ROUND(SUM(SumPointAmount)) AS VALUE FROM BSUM_CRMPOINT WHERE UPPER(POIN ...
- [Mysql高可用]——双主互备+keepalived
实验架构图 实验环境 主机名 操作系统 Mysql版本 keepalived版本 主机IP VIP lyj1(Master/Slave) Red Hat release 6.5 Mysql5.6 ...
- 面向对象 OOP中的抽象类,接口以及多态
[抽象类与抽象方法] 1.什么是抽象方法? 没有方法体{}的方法,必须使用abstract关键字修饰,这样的方法,我们称之为抽象方法. abstract function say() 2.什么是抽象类 ...
- 关于eclipse的编码注释等Code Template设置
啥也不说直接放东西: 首先进入eclipse的preferences里的java 点击Insert variable可以自己设置需要的 1. 设置Files:点击edit, /** * <p&g ...
- 限流(四)nginx接入层限流
一.nginx限流模块 接入层指的是请求流量的入口,我们可以在这里做很多控制,比如:负载均衡,缓存,限流等. nginx中针对限流有两个模块可以处理: 1)ngx_http_limit_req_mod ...
- Spring Cloud实战之初级入门(六)— 服务网关zuul
目录 1.环境介绍 2.api网关服务 2.1 创建工程 2.3 api网关中使用token机制 2.4 测试 2.5 小结 3.一点点重要的事情 1.环境介绍 好了,不知不觉中我们已经来到了最后一篇 ...
- sql:日期操作注意的,如果以字符串转日期时的函数,因为数据量大,会出问题
---1.以日期字符操作转换日期 如果是VIP1生日不对,可以以上传的数据日期为生日 begin declare @NowBirthday datetime, @birthday datetime,@ ...