From 4aa0aa11d20fd1fcabd5783ec6d32254db049b29 Mon Sep 17 00:00:00 2001 From: Federico Barresi Date: Fri, 5 Jun 2020 22:15:15 +0200 Subject: [PATCH] solved all warnings replaces obsoleted constants solutionwide --- Sharp7/S7.cs | 21 ++++++++++----------- Sharp7/S7MultiVar.cs | 15 +++++++-------- 2 files changed, 17 insertions(+), 19 deletions(-) diff --git a/Sharp7/S7.cs b/Sharp7/S7.cs index dce8a82..f774c2d 100644 --- a/Sharp7/S7.cs +++ b/Sharp7/S7.cs @@ -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; } } diff --git a/Sharp7/S7MultiVar.cs b/Sharp7/S7MultiVar.cs index 717ee61..a7623bf 100644 --- a/Sharp7/S7MultiVar.cs +++ b/Sharp7/S7MultiVar.cs @@ -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;