Skip to content

Commit 099f902

Browse files
committed
Style cleanup
1 parent 7ce2722 commit 099f902

File tree

6 files changed

+83
-93
lines changed

6 files changed

+83
-93
lines changed

src/S7CommPlusDriver/ClientApi/PlcTags.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public void AddTag(PlcTag tag)
1717

1818
public int ReadTags(S7CommPlusConnection conn)
1919
{
20-
List<ItemAddress> readlist = new List<ItemAddress>();
20+
var readlist = new List<ItemAddress>();
2121
List<object> values;
2222
List<UInt64> errors;
2323
int res;

src/S7CommPlusDriver/Core/PObject.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public PObject GetObjectByClassId(UInt32 classId, UInt32 relId)
7979

8080
public List<PObject> GetObjectsByClassId(UInt32 classId)
8181
{
82-
List<PObject> objList = new List<PObject>();
82+
var objList = new List<PObject>();
8383
foreach(var obj in Objects)
8484
{
8585
if (obj.Key.Item1 == classId)
@@ -92,7 +92,7 @@ public List<PObject> GetObjectsByClassId(UInt32 classId)
9292

9393
public List<PObject> GetObjects()
9494
{
95-
List<PObject> objList = new List<PObject>();
95+
var objList = new List<PObject>();
9696
foreach (var obj in Objects)
9797
{
9898
objList.Add(obj.Value);

src/S7CommPlusDriver/Core/PVartypeList.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public int Deserialize(Stream buffer)
4141
{
4242
do
4343
{
44-
PVartypeListElement elem = new PVartypeListElement();
44+
var elem = new PVartypeListElement();
4545
ret += elem.Deserialize(buffer);
4646
Elements.Add(elem);
4747
} while (ret < maxret);

src/S7CommPlusDriver/Core/S7p.cs

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,6 @@ public static int EncodeInt32Vlq(System.IO.Stream buffer, Int32 value)
310310
}
311311

312312
b[0] = (byte)(value & 0x7f);
313-
//Console.WriteLine(String.Format("B{0}: v={1,-20} abs_v={2,-20} B={3:X2} BX={4:X2}", 0, value, abs_v, b[0], (byte)(value & 0xff)));
314313
int length = 1;
315314
for (int i = 1; i < 5; i++)
316315
{
@@ -320,7 +319,6 @@ public static int EncodeInt32Vlq(System.IO.Stream buffer, Int32 value)
320319
abs_v >>= 7;
321320
value >>= 7;
322321
b[i] = (byte)((value & 0x7f) + 0x80);
323-
//Console.WriteLine(String.Format("B{0}: v={1,-20} abs_v={2,-20} B={3:X2} BX={4:X2}", i, value, abs_v, b[i], (byte)(value & 0xff)));
324322
}
325323
else
326324
{
@@ -355,8 +353,7 @@ public static int EncodeUInt64Vlq(System.IO.Stream buffer, UInt64 value)
355353
{
356354
b[0] = (byte)(value & 0x7f);
357355
}
358-
//Console.WriteLine(String.Format("value : {0:X16}", value) + " special=" + special.ToString());
359-
//Console.WriteLine(String.Format("B{0}: v={1,-20} B={2:X2} BX={3:X2}", 0, value, b[0], (byte)(value & 0xff)));
356+
360357
int length = 1;
361358
for (int i = 1; i < 9; i++)
362359
{
@@ -372,7 +369,6 @@ public static int EncodeUInt64Vlq(System.IO.Stream buffer, UInt64 value)
372369
value >>= 7;
373370
}
374371
b[i] = (byte)((value & 0x7f) + 0x80);
375-
//Console.WriteLine(String.Format("B{0}: v={1,-20} B={2:X2} BX={3:X2}", i, value, b[i], (byte)(value & 0xff)));
376372
}
377373
else
378374
{
@@ -496,8 +492,7 @@ public static int EncodeInt64Vlq(System.IO.Stream buffer, Int64 value)
496492
{
497493
b[0] = (byte)(value & 0x7f);
498494
}
499-
//Console.WriteLine(String.Format("value : {0:X16}", value) + " special=" + special.ToString());
500-
//Console.WriteLine(String.Format("B{0}: v={1,-20} abs_v={2,-20} B={3:X2} BX={4:X2}", 0, value, abs_v, b[0], (byte)(value & 0xff)));
495+
501496
int length = 1;
502497
for (int i = 1; i < 9; i++)
503498
{
@@ -515,7 +510,6 @@ public static int EncodeInt64Vlq(System.IO.Stream buffer, Int64 value)
515510
value >>= 7;
516511
}
517512
b[i] = (byte)((value & 0x7f) + 0x80);
518-
//Console.WriteLine(String.Format("B{0}: v={1,-20} abs_v={2,-20} B={3:X2} BX={4:X2}", i, value, abs_v, b[i], (byte)(value & 0xff)));
519513
}
520514
else
521515
{
@@ -741,9 +735,9 @@ public static int EncodeObjectQualifier(System.IO.Stream buffer)
741735

742736
ret += EncodeUInt32(buffer, Ids.ObjectQualifier);
743737

744-
ValueRID parentRID = new ValueRID(0);
745-
ValueAID compositionAID = new ValueAID(0);
746-
ValueUDInt keyQualifier = new ValueUDInt(0);
738+
var parentRID = new ValueRID(0);
739+
var compositionAID = new ValueAID(0);
740+
var keyQualifier = new ValueUDInt(0);
747741

748742
ret += EncodeUInt32Vlq(buffer, Ids.ParentRID);
749743
ret += parentRID.Serialize(buffer);

src/S7CommPlusDriver/Core/SystemEvent.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ public static SystemEvent DeserializeFromPdu(Stream pdu)
146146
{
147147
return null;
148148
}
149-
SystemEvent sysevt = new SystemEvent(protocolVersion);
149+
var sysevt = new SystemEvent(protocolVersion);
150150
sysevt.Deserialize(pdu);
151151
return sysevt;
152152
}

0 commit comments

Comments
 (0)