solved all warnings

replaces obsoleted constants solutionwide
This commit is contained in:
Federico Barresi
2020-06-05 22:15:15 +02:00
parent db933cf62b
commit 4aa0aa11d2
2 changed files with 17 additions and 19 deletions

View File

@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Text;
#pragma warning disable 618
namespace Sharp7
{
@@ -26,16 +25,16 @@ namespace Sharp7
{
switch (wordLength)
{
case S7Consts.S7WLBit: return 1; // S7 sends 1 byte per bit
case S7Consts.S7WLByte: return 1;
case S7Consts.S7WLChar: return 1;
case S7Consts.S7WLWord: return 2;
case S7Consts.S7WLDWord: return 4;
case S7Consts.S7WLInt: return 2;
case S7Consts.S7WLDInt: return 4;
case S7Consts.S7WLReal: return 4;
case S7Consts.S7WLCounter: return 2;
case S7Consts.S7WLTimer: return 2;
case (int)S7WordLength.Bit: return 1; // S7 sends 1 byte per bit
case (int)S7WordLength.Byte: return 1;
case (int)S7WordLength.Char: return 1;
case (int)S7WordLength.Word: return 2;
case (int)S7WordLength.DWord: return 4;
case (int)S7WordLength.Int: return 2;
case (int)S7WordLength.DInt: return 4;
case (int)S7WordLength.Real: return 4;
case (int)S7WordLength.Counter: return 2;
case (int)S7WordLength.Timer: return 2;
default: return 0;
}
}

View File

@@ -1,7 +1,6 @@
using System;
using System.Linq;
using System.Runtime.InteropServices;
#pragma warning disable 618
namespace Sharp7
{
@@ -23,20 +22,20 @@ namespace Sharp7
if (WordSize == 0)
return false;
if (Area == S7Consts.S7AreaCT)
WordLen = S7Consts.S7WLCounter;
if (Area == S7Consts.S7AreaTM)
WordLen = S7Consts.S7WLTimer;
if (Area == (int)S7Area.CT)
WordLen = (int)S7WordLength.Counter;
if (Area == (int)S7Area.TM)
WordLen = (int)S7WordLength.Timer;
if (WordLen == S7Consts.S7WLBit)
if (WordLen == (int)S7WordLength.Bit)
Amount = 1; // Only 1 bit can be transferred at time
else
{
if ((WordLen != S7Consts.S7WLCounter) && (WordLen != S7Consts.S7WLTimer))
if ((WordLen != (int)S7WordLength.Counter) && (WordLen != (int)S7WordLength.Timer))
{
Amount = Amount * WordSize;
Start = Start * 8;
WordLen = S7Consts.S7WLByte;
WordLen = (int)S7WordLength.Byte;
}
}
return true;