From 452cb40bd3291e23e238a884d802d01bca04a183 Mon Sep 17 00:00:00 2001 From: abenedykt Date: Fri, 8 Aug 2014 20:56:26 +0200 Subject: [PATCH] fixing namespaces to c# style of coding --- S7.Net/Conversion.cs | 3 +-- S7.Net/Enums.cs | 2 +- S7.Net/PLC.cs | 5 +++-- S7.Net/S7.Net.csproj | 5 ++++- S7.Net/Types/Boolean.cs | 4 +--- S7.Net/Types/Byte.cs | 6 +----- S7.Net/Types/ByteArray.cs | 2 +- S7.Net/Types/Counter.cs | 4 +--- S7.Net/Types/DInt.cs | 2 +- S7.Net/Types/DWord.cs | 4 +--- S7.Net/Types/Double.cs | 9 +++------ S7.Net/Types/Int.cs | 2 +- S7.Net/Types/String.cs | 6 +----- S7.Net/Types/Struct.cs | 22 ++++++++++------------ S7.Net/Types/Timer.cs | 4 +--- S7.Net/Types/Word.cs | 4 +--- 16 files changed, 32 insertions(+), 52 deletions(-) diff --git a/S7.Net/Conversion.cs b/S7.Net/Conversion.cs index 0ba6bab..a8f3265 100644 --- a/S7.Net/Conversion.cs +++ b/S7.Net/Conversion.cs @@ -1,7 +1,6 @@ using System; -using System.Linq; -namespace S7 +namespace S7.Net { public static class Conversion { diff --git a/S7.Net/Enums.cs b/S7.Net/Enums.cs index 1811d36..2bbee06 100644 --- a/S7.Net/Enums.cs +++ b/S7.Net/Enums.cs @@ -1,4 +1,4 @@ -namespace S7 +namespace S7.Net { public enum CpuType { diff --git a/S7.Net/PLC.cs b/S7.Net/PLC.cs index cfcd6ed..c700e03 100644 --- a/S7.Net/PLC.cs +++ b/S7.Net/PLC.cs @@ -1,9 +1,10 @@ using System; using System.Net; -using System.Net.Sockets; using System.Net.NetworkInformation; +using System.Net.Sockets; +using S7.Net.Interfaces; -namespace S7 +namespace S7.Net { public class Plc : IPlc { diff --git a/S7.Net/S7.Net.csproj b/S7.Net/S7.Net.csproj index b5869f3..b6e50c2 100644 --- a/S7.Net/S7.Net.csproj +++ b/S7.Net/S7.Net.csproj @@ -10,7 +10,7 @@ Properties S7.Net S7.Net - v3.5 + v4.5 512 @@ -32,6 +32,7 @@ false false true + true @@ -41,6 +42,7 @@ DEBUG;TRACE prompt 4 + false pdbonly @@ -49,6 +51,7 @@ TRACE prompt 4 + false diff --git a/S7.Net/Types/Boolean.cs b/S7.Net/Types/Boolean.cs index 497fd30..32c96c3 100644 --- a/S7.Net/Types/Boolean.cs +++ b/S7.Net/Types/Boolean.cs @@ -1,8 +1,6 @@ using System; -using System.Collections.Generic; -using System.Text; -namespace S7.Types +namespace S7.Net.Types { public static class Boolean { diff --git a/S7.Net/Types/Byte.cs b/S7.Net/Types/Byte.cs index 99b8683..62a0d61 100644 --- a/S7.Net/Types/Byte.cs +++ b/S7.Net/Types/Byte.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace S7.Types +namespace S7.Net.Types { public static class Byte { diff --git a/S7.Net/Types/ByteArray.cs b/S7.Net/Types/ByteArray.cs index 343a1ce..63c2701 100644 --- a/S7.Net/Types/ByteArray.cs +++ b/S7.Net/Types/ByteArray.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; -namespace S7.Types +namespace S7.Net.Types { class ByteArray { diff --git a/S7.Net/Types/Counter.cs b/S7.Net/Types/Counter.cs index 4e49712..b5174d6 100644 --- a/S7.Net/Types/Counter.cs +++ b/S7.Net/Types/Counter.cs @@ -1,8 +1,6 @@ using System; -using System.Collections.Generic; -using System.Text; -namespace S7.Types +namespace S7.Net.Types { public static class Counter { diff --git a/S7.Net/Types/DInt.cs b/S7.Net/Types/DInt.cs index f02ab88..8f92575 100644 --- a/S7.Net/Types/DInt.cs +++ b/S7.Net/Types/DInt.cs @@ -1,6 +1,6 @@ using System; -namespace S7.Types +namespace S7.Net.Types { public static class DInt { diff --git a/S7.Net/Types/DWord.cs b/S7.Net/Types/DWord.cs index 5c71dcf..bded772 100644 --- a/S7.Net/Types/DWord.cs +++ b/S7.Net/Types/DWord.cs @@ -1,8 +1,6 @@ using System; -using System.Collections.Generic; -using System.Text; -namespace S7.Types +namespace S7.Net.Types { public static class DWord { diff --git a/S7.Net/Types/Double.cs b/S7.Net/Types/Double.cs index cb79fa9..1e18fc4 100644 --- a/S7.Net/Types/Double.cs +++ b/S7.Net/Types/Double.cs @@ -1,9 +1,6 @@ using System; -using System.Collections.Generic; -using System.Text; -using S7; -namespace S7.Types +namespace S7.Net.Types { public static class Double { @@ -48,14 +45,14 @@ namespace S7.Types #region FromDWord public static double FromDWord(Int32 value) { - byte[] b = S7.Types.DInt.ToByteArray(value); + byte[] b = DInt.ToByteArray(value); double d = FromByteArray(b); return d; } public static double FromDWord(UInt32 value) { - byte[] b = S7.Types.DWord.ToByteArray(value); + byte[] b = DWord.ToByteArray(value); double d = FromByteArray(b); return d; } diff --git a/S7.Net/Types/Int.cs b/S7.Net/Types/Int.cs index 582aa3a..1215ecb 100644 --- a/S7.Net/Types/Int.cs +++ b/S7.Net/Types/Int.cs @@ -1,6 +1,6 @@ using System; -namespace S7.Types +namespace S7.Net.Types { public static class Int { diff --git a/S7.Net/Types/String.cs b/S7.Net/Types/String.cs index b8f12da..a0a8230 100644 --- a/S7.Net/Types/String.cs +++ b/S7.Net/Types/String.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace S7.Types +namespace S7.Net.Types { public static class String { diff --git a/S7.Net/Types/Struct.cs b/S7.Net/Types/Struct.cs index daf7976..0c6ed7b 100644 --- a/S7.Net/Types/Struct.cs +++ b/S7.Net/Types/Struct.cs @@ -1,8 +1,6 @@ using System; -using System.Collections.Generic; -using System.Text; -namespace S7.Types +namespace S7.Net.Types { public static class Struct { @@ -99,7 +97,7 @@ namespace S7.Types if ((numBytes / 2 - Math.Floor(numBytes / 2.0)) > 0) numBytes++; // hier auswerten - info.SetValue(structValue, S7.Types.Word.FromBytes(bytes[(int)numBytes + 1], + info.SetValue(structValue, Word.FromBytes(bytes[(int)numBytes + 1], bytes[(int)numBytes])); numBytes += 2; break; @@ -109,7 +107,7 @@ namespace S7.Types if ((numBytes / 2 - Math.Floor(numBytes / 2.0)) > 0) numBytes++; // hier auswerten - info.SetValue(structValue, S7.Types.DWord.FromBytes(bytes[(int)numBytes], + info.SetValue(structValue, DWord.FromBytes(bytes[(int)numBytes], bytes[(int)numBytes + 1], bytes[(int)numBytes + 2], bytes[(int)numBytes + 3])); @@ -120,7 +118,7 @@ namespace S7.Types if ((numBytes / 2 - Math.Floor(numBytes / 2.0)) > 0) numBytes++; // hier auswerten - info.SetValue(structValue, S7.Types.Double.FromByteArray(new byte[] { bytes[(int)numBytes], + info.SetValue(structValue, Double.FromByteArray(new byte[] { bytes[(int)numBytes], bytes[(int)numBytes + 1], bytes[(int)numBytes + 2], bytes[(int)numBytes + 3] })); @@ -140,7 +138,7 @@ namespace S7.Types { Type type = structValue.GetType(); - int size = S7.Types.Struct.GetStructSize(type); + int size = Struct.GetStructSize(type); byte[] bytes = new byte[size]; byte[] bytes2 = null; @@ -171,19 +169,19 @@ namespace S7.Types numBytes++; break; case "Int16": - bytes2 = S7.Types.Int.ToByteArray((Int16)info.GetValue(structValue)); + bytes2 = Int.ToByteArray((Int16)info.GetValue(structValue)); break; case "UInt16": - bytes2 = S7.Types.Word.ToByteArray((UInt16)info.GetValue(structValue)); + bytes2 = Word.ToByteArray((UInt16)info.GetValue(structValue)); break; case "Int32": - bytes2 = S7.Types.DInt.ToByteArray((Int32)info.GetValue(structValue)); + bytes2 = DInt.ToByteArray((Int32)info.GetValue(structValue)); break; case "UInt32": - bytes2 = S7.Types.DWord.ToByteArray((UInt32)info.GetValue(structValue)); + bytes2 = DWord.ToByteArray((UInt32)info.GetValue(structValue)); break; case "Double": - bytes2 = S7.Types.Double.ToByteArray((double)info.GetValue(structValue)); + bytes2 = Double.ToByteArray((double)info.GetValue(structValue)); break; } if (bytes2 != null) diff --git a/S7.Net/Types/Timer.cs b/S7.Net/Types/Timer.cs index 713ac41..b374c8e 100644 --- a/S7.Net/Types/Timer.cs +++ b/S7.Net/Types/Timer.cs @@ -1,8 +1,6 @@ using System; -using System.Collections.Generic; -using System.Text; -namespace S7.Types +namespace S7.Net.Types { public static class Timer { diff --git a/S7.Net/Types/Word.cs b/S7.Net/Types/Word.cs index 1f957c1..aba4026 100644 --- a/S7.Net/Types/Word.cs +++ b/S7.Net/Types/Word.cs @@ -1,8 +1,6 @@ using System; -using System.Collections.Generic; -using System.Text; -namespace S7.Types +namespace S7.Net.Types { public static class Word {