2014-08-30 update 1 small changes in ResourceManager
This commit is contained in:
@@ -77,23 +77,5 @@ namespace ModBus.Net {
|
|||||||
return ResourceManager.GetString("IP", resourceCulture);
|
return ResourceManager.GetString("IP", resourceCulture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 查找类似 502 的本地化字符串。
|
|
||||||
/// </summary>
|
|
||||||
internal static string Port {
|
|
||||||
get {
|
|
||||||
return ResourceManager.GetString("Port", resourceCulture);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 查找类似 1000 的本地化字符串。
|
|
||||||
/// </summary>
|
|
||||||
internal static string SocketTimeOut {
|
|
||||||
get {
|
|
||||||
return ResourceManager.GetString("SocketTimeOut", resourceCulture);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -123,10 +123,4 @@
|
|||||||
<data name="IP" xml:space="preserve">
|
<data name="IP" xml:space="preserve">
|
||||||
<value>192.168.3.247</value>
|
<value>192.168.3.247</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Port" xml:space="preserve">
|
|
||||||
<value>502</value>
|
|
||||||
</data>
|
|
||||||
<data name="SocketTimeOut" xml:space="preserve">
|
|
||||||
<value>1000</value>
|
|
||||||
</data>
|
|
||||||
</root>
|
</root>
|
||||||
@@ -10,15 +10,23 @@ namespace ModBus.Net
|
|||||||
/// 连接对象
|
/// 连接对象
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
||||||
protected TcpProtocalLinker()
|
protected TcpProtocalLinker() : this(ConfigurationManager.IP)
|
||||||
{
|
{
|
||||||
//初始化连对象
|
|
||||||
_baseConnector = new TcpConnector(ConfigurationManager.IP, int.Parse(ConfigurationManager.Port), false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected TcpProtocalLinker(string ip)
|
protected TcpProtocalLinker(string ip)
|
||||||
{
|
{
|
||||||
_baseConnector = new TcpConnector(ip, int.Parse(ConfigurationManager.Port), false);
|
int port;
|
||||||
|
if (ConfigurationManager.ResourceManager.GetString("Port") != null && int.TryParse(ConfigurationManager.ResourceManager.GetString("Port"),out port))
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
port = 502;
|
||||||
|
}
|
||||||
|
_baseConnector = new TcpConnector(ip, port, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user