2016-01-13 update 1

This commit is contained in:
parallelbgls@outlook.com
2016-01-13 17:51:17 +08:00
parent af45ef5231
commit 21635b0ad9
6 changed files with 22 additions and 73 deletions

View File

@@ -61,7 +61,7 @@ namespace ModBus.Net {
} }
/// <summary> /// <summary>
/// 查找类似 COM6 的本地化字符串。 /// 查找类似 COM1 的本地化字符串。
/// </summary> /// </summary>
internal static string COM { internal static string COM {
get { get {
@@ -70,7 +70,7 @@ namespace ModBus.Net {
} }
/// <summary> /// <summary>
/// 查找类似 192.168.3.247 的本地化字符串。 /// 查找类似 192.168.1.1 的本地化字符串。
/// </summary> /// </summary>
internal static string IP { internal static string IP {
get { get {
@@ -90,9 +90,18 @@ namespace ModBus.Net {
/// <summary> /// <summary>
/// 查找类似 502 的本地化字符串。 /// 查找类似 502 的本地化字符串。
/// </summary> /// </summary>
internal static string Port { internal static string ModbusPort {
get { get {
return ResourceManager.GetString("Port", resourceCulture); return ResourceManager.GetString("ModbusPort", resourceCulture);
}
}
/// <summary>
/// 查找类似 102 的本地化字符串。
/// </summary>
internal static string SiemensPort {
get {
return ResourceManager.GetString("SiemensPort", resourceCulture);
} }
} }
} }

View File

@@ -118,15 +118,18 @@
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<data name="COM" xml:space="preserve"> <data name="COM" xml:space="preserve">
<value>COM6</value> <value>COM1</value>
</data> </data>
<data name="IP" xml:space="preserve"> <data name="IP" xml:space="preserve">
<value>192.168.3.247</value> <value>192.168.1.1</value>
</data> </data>
<data name="IPConnectionTimeout" xml:space="preserve"> <data name="IPConnectionTimeout" xml:space="preserve">
<value>5000</value> <value>5000</value>
</data> </data>
<data name="Port" xml:space="preserve"> <data name="ModbusPort" xml:space="preserve">
<value>502</value> <value>502</value>
</data> </data>
<data name="SiemensPort" xml:space="preserve">
<value>102</value>
</data>
</root> </root>

View File

@@ -1,63 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{E97FCE46-855D-498B-8E58-00AFF3A1E760}</ProjectGuid>
<OutputType>Library</OutputType>
<RootNamespace>ModBus.Net</RootNamespace>
<AssemblyName>ModBus.Net</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug</OutputPath>
<DefineConstants>DEBUG;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>full</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
</PropertyGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="AddressCombiner.cs" />
<Compile Include="AddressFormater.cs" />
<Compile Include="AddressTranslator.cs" />
<Compile Include="AsyncHelper.cs" />
<Compile Include="BaseConnector.cs" />
<Compile Include="BaseMachine.cs" />
<Compile Include="BaseProtocal.cs" />
<Compile Include="BaseUtility.cs" />
<Compile Include="ComConnector.cs" />
<Compile Include="ComProtocalLinker.cs" />
<Compile Include="ConfigurationManager.Designer.cs">
<DependentUpon>ConfigurationManager.resx</DependentUpon>
</Compile>
<Compile Include="CRC16.cs" />
<Compile Include="IProtocalFormatting.cs" />
<Compile Include="ProtocalLinker.cs" />
<Compile Include="ProtocalLinkerBytesExtend.cs" />
<Compile Include="ProtocalUnit.cs" />
<Compile Include="TaskManager.cs" />
<Compile Include="TcpConnector.cs" />
<Compile Include="TcpProtocalLinker.cs" />
<Compile Include="ValueHelper.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>
<None Include="ConfigurationManager.resx" />
</ItemGroup>
<ItemGroup />
<ItemGroup>
<Reference Include="System" />
</ItemGroup>
</Project>

View File

@@ -18,7 +18,7 @@
return true; return true;
} }
public ModbusTcpProtocalLinker(string ip) : base(ip, 102) public ModbusTcpProtocalLinker(string ip) : base(ip, int.Parse(ConfigurationManager.ModbusPort))
{ {
} }

View File

@@ -29,7 +29,7 @@ namespace ModBus.Net.Siemens
} }
public SiemensTcpProtocalLinker(string ip) public SiemensTcpProtocalLinker(string ip)
: base(ip, 102) : base(ip, int.Parse(ConfigurationManager.SiemensPort))
{ {
} }

View File

@@ -8,7 +8,7 @@ namespace ModBus.Net
public abstract class TcpProtocalLinker : ProtocalLinker public abstract class TcpProtocalLinker : ProtocalLinker
{ {
protected TcpProtocalLinker() : this(ConfigurationManager.IP, int.Parse(ConfigurationManager.Port)) protected TcpProtocalLinker() : this(ConfigurationManager.IP, int.Parse(ConfigurationManager.ModbusPort))
{ {
} }