mirror of
https://github.com/evopro-ag/Sharp7Reactive.git
synced 2025-12-16 03:42:51 +00:00
Fix or ignore build warnings
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
#nullable enable
|
||||
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
namespace Sharp7.Rx;
|
||||
|
||||
public static class S7ErrorCodes
|
||||
@@ -7,12 +9,12 @@ public static class S7ErrorCodes
|
||||
/// <summary>
|
||||
/// This list is not exhaustive and should be considered work in progress.
|
||||
/// </summary>
|
||||
private static readonly HashSet<int> notDisconnectedErrorCodes = new HashSet<int>
|
||||
{
|
||||
private static readonly HashSet<int> notDisconnectedErrorCodes =
|
||||
[
|
||||
0x000000, // OK
|
||||
0xC00000, // CPU: Item not available
|
||||
0x900000, // CPU: Address out of range
|
||||
};
|
||||
0x900000 // CPU: Address out of range
|
||||
];
|
||||
|
||||
private static readonly IReadOnlyDictionary<int, string> additionalErrorTexts = new Dictionary<int, string>
|
||||
{
|
||||
@@ -31,11 +33,9 @@ public static class S7ErrorCodes
|
||||
/// Other error codes indicate a user error, like reading from an unavailable DB or exceeding
|
||||
/// the DBs range. In this case the driver should not consider the connection to be lost.
|
||||
/// </summary>
|
||||
public static bool AssumeConnectionLost(int errorCode)
|
||||
{
|
||||
return !notDisconnectedErrorCodes.Contains(errorCode);
|
||||
}
|
||||
public static bool AssumeConnectionLost(int errorCode) =>
|
||||
!notDisconnectedErrorCodes.Contains(errorCode);
|
||||
|
||||
public static string? GetAdditionalErrorText(int errorCode) =>
|
||||
additionalErrorTexts.TryGetValue(errorCode, out var text) ? text : null;
|
||||
additionalErrorTexts.GetValueOrDefault(errorCode);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user