2016-05-09 update 1 bug fix

This commit is contained in:
parallelbgls@outlook.com
2016-05-09 11:02:38 +08:00
parent 668bbf8fcf
commit 9fa0284574
6 changed files with 17 additions and 7 deletions

1
.gitignore vendored
View File

@@ -155,3 +155,4 @@ $RECYCLE.BIN/
# Mac desktop service store files # Mac desktop service store files
.DS_Store .DS_Store
/Modbus.Net/packages /Modbus.Net/packages
/Modbus.Net/.vs

View File

@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
// 方法是按如下所示使用“*”: : // 方法是按如下所示使用“*”: :
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.1.0")] [assembly: AssemblyVersion("1.1.1")]
[assembly: AssemblyFileVersion("1.1.0")] [assembly: AssemblyFileVersion("1.1.1")]

View File

@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
// 方法是按如下所示使用“*”: : // 方法是按如下所示使用“*”: :
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.1.0")] [assembly: AssemblyVersion("1.1.1")]
[assembly: AssemblyFileVersion("1.1.0")] [assembly: AssemblyFileVersion("1.1.1")]

View File

@@ -22,6 +22,9 @@ namespace Modbus.Net
public abstract class BaseMachine : IMachineProperty public abstract class BaseMachine : IMachineProperty
{ {
private int ErrorCount { get; set; } = 0;
private int _maxErrorCount = 3;
/// <summary> /// <summary>
/// 设备的Id /// 设备的Id
/// </summary> /// </summary>
@@ -186,11 +189,17 @@ namespace Modbus.Net
} }
//返回数据 //返回数据
if (ans.Count == 0) ans = null; if (ans.Count == 0) ans = null;
ErrorCount = 0;
return ans; return ans;
} }
catch (Exception e) catch (Exception e)
{ {
Console.WriteLine(ConnectionToken + " " + e.Message); Console.WriteLine(ConnectionToken + " " + e.Message);
ErrorCount++;
if (ErrorCount >= _maxErrorCount)
{
Disconnect();
}
return null; return null;
} }
} }

View File

@@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd"> <package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata> <metadata>
<id>Modbus.Net</id> <id>Modbus.Net</id>
<version>1.1.0</version> <version>1.1.1</version>
<title>Modbus.Net</title> <title>Modbus.Net</title>
<authors>Chris L.(Luo Sheng)</authors> <authors>Chris L.(Luo Sheng)</authors>
<owners>Hangzhou Delian Information and Science Technology Co.,Ltd.</owners> <owners>Hangzhou Delian Information and Science Technology Co.,Ltd.</owners>

View File

@@ -35,5 +35,5 @@ using System.Runtime.InteropServices;
// 方法是按如下所示使用“*”: // 方法是按如下所示使用“*”:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.1.0")] [assembly: AssemblyVersion("1.1.1")]
[assembly: AssemblyFileVersion("1.1.0")] [assembly: AssemblyFileVersion("1.1.1")]