diff --git a/S7.Net.UnitTest/Helpers/NativeMethods.cs b/S7.Net.UnitTest/Helpers/NativeMethods.cs
index 774136e..a177850 100644
--- a/S7.Net.UnitTest/Helpers/NativeMethods.cs
+++ b/S7.Net.UnitTest/Helpers/NativeMethods.cs
@@ -1,9 +1,5 @@
using System;
-using System.Collections.Generic;
-using System.Linq;
using System.Runtime.InteropServices;
-using System.Text;
-using System.Threading.Tasks;
namespace S7.Net.UnitTest.Helpers
{
diff --git a/S7.Net.UnitTest/Helpers/S7TestServer.cs b/S7.Net.UnitTest/Helpers/S7TestServer.cs
index 4a94142..57ed663 100644
--- a/S7.Net.UnitTest/Helpers/S7TestServer.cs
+++ b/S7.Net.UnitTest/Helpers/S7TestServer.cs
@@ -1,8 +1,4 @@
using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
using Snap7;
namespace S7.Net.UnitTest.Helpers
diff --git a/S7.Net.UnitTest/Helpers/TestClass.cs b/S7.Net.UnitTest/Helpers/TestClass.cs
index bb23785..5f1f271 100644
--- a/S7.Net.UnitTest/Helpers/TestClass.cs
+++ b/S7.Net.UnitTest/Helpers/TestClass.cs
@@ -1,9 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
+
namespace S7.Net.UnitTest.Helpers
{
class TestClass
diff --git a/S7.Net.UnitTest/Helpers/TestStruct.cs b/S7.Net.UnitTest/Helpers/TestStruct.cs
index 448e9ce..50455d5 100644
--- a/S7.Net.UnitTest/Helpers/TestStruct.cs
+++ b/S7.Net.UnitTest/Helpers/TestStruct.cs
@@ -1,9 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
+
namespace S7.Net.UnitTest.Helpers
{
public struct TestStruct
diff --git a/S7.Net.UnitTest/S7.Net.UnitTest.csproj b/S7.Net.UnitTest/S7.Net.UnitTest.csproj
index 9b825a2..202e509 100644
--- a/S7.Net.UnitTest/S7.Net.UnitTest.csproj
+++ b/S7.Net.UnitTest/S7.Net.UnitTest.csproj
@@ -8,7 +8,7 @@
Properties
S7.UnitTest
S7Net.UnitTest
- v4.5
+ v3.5
512
{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
10.0
diff --git a/S7.Net/S7.Net.csproj b/S7.Net/S7.Net.csproj
index 269b735..9632066 100644
--- a/S7.Net/S7.Net.csproj
+++ b/S7.Net/S7.Net.csproj
@@ -10,7 +10,7 @@
Properties
S7.Net
S7.Net
- v4.5
+ v3.5
512
diff --git a/S7.Net/Types/Class.cs b/S7.Net/Types/Class.cs
index 3881e2c..9489afb 100644
--- a/S7.Net/Types/Class.cs
+++ b/S7.Net/Types/Class.cs
@@ -1,9 +1,4 @@
using System;
-using System.Collections.Generic;
-using System.Globalization;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
namespace S7.Net.Types
{
@@ -11,8 +6,8 @@ namespace S7.Net.Types
{
///
/// Gets the size of the struct in bytes.
- ///
- /// the type of the struct
+ ///
+ /// the type of the class
/// the number of bytes
public static int GetClassSize(Type classType)
{
@@ -27,8 +22,8 @@ namespace S7.Net.Types
///
/// Given a property name, it returns the number of bytes that is composed
- ///
- ///
+ ///
+ /// type of the property
///
static double CalculateBytes(string propertyType)
{
@@ -70,6 +65,7 @@ namespace S7.Net.Types
///
/// Creates a struct of a specified type by an array of bytes.
///
+ ///
/// The struct type
/// The array of bytes
/// The object depending on the struct type or null if fails(array-length != struct-length
@@ -97,14 +93,14 @@ namespace S7.Net.Types
bytePos = (int)Math.Floor(numBytes);
bitPos = (int)((numBytes - (double)bytePos) / 0.125);
if ((bytes[bytePos] & (int)Math.Pow(2, bitPos)) != 0)
- property.SetValue(sourceClass, true);
- else
- property.SetValue(sourceClass, false);
+ property.SetValue(sourceClass, true, null);
+ else
+ property.SetValue(sourceClass, false, null);
numBytes += 0.125;
break;
case "Byte":
- numBytes = Math.Ceiling(numBytes);
- property.SetValue(sourceClass, (byte)(bytes[(int)numBytes]));
+ numBytes = Math.Ceiling(numBytes);
+ property.SetValue(sourceClass, (byte)(bytes[(int)numBytes]), null);
numBytes++;
break;
case "Int16":
@@ -112,16 +108,16 @@ namespace S7.Net.Types
if ((numBytes / 2 - Math.Floor(numBytes / 2.0)) > 0)
numBytes++;
// hier auswerten
- ushort source = Word.FromBytes(bytes[(int)numBytes + 1], bytes[(int)numBytes]);
- property.SetValue(sourceClass, source.ConvertToShort());
+ ushort source = Word.FromBytes(bytes[(int)numBytes + 1], bytes[(int)numBytes]);
+ property.SetValue(sourceClass, source.ConvertToShort(), null);
numBytes += 2;
break;
case "UInt16":
numBytes = Math.Ceiling(numBytes);
if ((numBytes / 2 - Math.Floor(numBytes / 2.0)) > 0)
numBytes++;
- // hier auswerten
- property.SetValue(sourceClass, Word.FromBytes(bytes[(int)numBytes + 1], bytes[(int)numBytes]));
+ // hier auswerten
+ property.SetValue(sourceClass, Word.FromBytes(bytes[(int)numBytes + 1], bytes[(int)numBytes]), null);
numBytes += 2;
break;
case "Int32":
@@ -132,8 +128,8 @@ namespace S7.Net.Types
uint sourceUInt = DWord.FromBytes(bytes[(int)numBytes + 3],
bytes[(int)numBytes + 2],
bytes[(int)numBytes + 1],
- bytes[(int)numBytes + 0]);
- property.SetValue(sourceClass, sourceUInt.ConvertToInt());
+ bytes[(int)numBytes + 0]);
+ property.SetValue(sourceClass, sourceUInt.ConvertToInt(), null);
numBytes += 4;
break;
case "UInt32":
@@ -143,8 +139,8 @@ namespace S7.Net.Types
// hier auswerten
property.SetValue(sourceClass, DWord.FromBytes(bytes[(int)numBytes],
bytes[(int)numBytes + 1],
- bytes[(int)numBytes + 2],
- bytes[(int)numBytes + 3]));
+ bytes[(int)numBytes + 2],
+ bytes[(int)numBytes + 3]), null);
numBytes += 4;
break;
case "Double":
@@ -155,7 +151,7 @@ namespace S7.Net.Types
property.SetValue(sourceClass, Double.FromByteArray(new byte[] { bytes[(int)numBytes],
bytes[(int)numBytes + 1],
bytes[(int)numBytes + 2],
- bytes[(int)numBytes + 3] }));
+ bytes[(int)numBytes + 3] }), null);
numBytes += 4;
break;
}
@@ -187,8 +183,8 @@ namespace S7.Net.Types
case "Boolean":
// get the value
bytePos = (int)Math.Floor(numBytes);
- bitPos = (int)((numBytes - (double)bytePos) / 0.125);
- if ((bool)property.GetValue(sourceClass))
+ bitPos = (int)((numBytes - (double)bytePos) / 0.125);
+ if ((bool)property.GetValue(sourceClass, null))
bytes[bytePos] |= (byte)Math.Pow(2, bitPos); // is true
else
bytes[bytePos] &= (byte)(~(byte)Math.Pow(2, bitPos)); // is false
@@ -196,24 +192,24 @@ namespace S7.Net.Types
break;
case "Byte":
numBytes = (int)Math.Ceiling(numBytes);
- bytePos = (int)numBytes;
- bytes[bytePos] = (byte)property.GetValue(sourceClass);
+ bytePos = (int)numBytes;
+ bytes[bytePos] = (byte)property.GetValue(sourceClass, null);
numBytes++;
break;
- case "Int16":
- bytes2 = Int.ToByteArray((Int16)property.GetValue(sourceClass));
+ case "Int16":
+ bytes2 = Int.ToByteArray((Int16)property.GetValue(sourceClass, null));
break;
- case "UInt16":
- bytes2 = Word.ToByteArray((UInt16)property.GetValue(sourceClass));
+ case "UInt16":
+ bytes2 = Word.ToByteArray((UInt16)property.GetValue(sourceClass, null));
break;
- case "Int32":
- bytes2 = DInt.ToByteArray((Int32)property.GetValue(sourceClass));
+ case "Int32":
+ bytes2 = DInt.ToByteArray((Int32)property.GetValue(sourceClass, null));
break;
- case "UInt32":
- bytes2 = DWord.ToByteArray((UInt32)property.GetValue(sourceClass));
+ case "UInt32":
+ bytes2 = DWord.ToByteArray((UInt32)property.GetValue(sourceClass, null));
break;
- case "Double":
- bytes2 = Double.ToByteArray((double)property.GetValue(sourceClass));
+ case "Double":
+ bytes2 = Double.ToByteArray((double)property.GetValue(sourceClass, null));
break;
}
if (bytes2 != null)