From b9da9787bacd7636661481088aa3bebff0584cc3 Mon Sep 17 00:00:00 2001 From: Darth Affe Date: Wed, 4 Apr 2018 20:34:21 +0200 Subject: [PATCH] Small refactorings to make the code fit the code-style of the library --- .../OBDData/00-1F/PidsSupported01_20.cs | 4 +-- .../OBDData/20-3F/PidsSupported21_40.cs | 4 +-- .../OBDData/40-5F/PidsSupported41_60.cs | 4 +-- .../OBDData/60-7F/PidsSupported61_80.cs | 4 +-- .../OBDData/80-9F/PidsSupported81_A0.cs | 4 +-- .../OBDData/A0-BF/PidsSupportedA1_C0.cs | 4 +-- .../OBDData/AbstractPidsSupported.cs | 29 +++++++++---------- .../OBDData/C0-DF/PidsSupportedC1_E0.cs | 4 +-- 8 files changed, 21 insertions(+), 36 deletions(-) diff --git a/OBD.NET/OBD.NET.Common/OBDData/00-1F/PidsSupported01_20.cs b/OBD.NET/OBD.NET.Common/OBDData/00-1F/PidsSupported01_20.cs index 9fb5869..18794e2 100644 --- a/OBD.NET/OBD.NET.Common/OBDData/00-1F/PidsSupported01_20.cs +++ b/OBD.NET/OBD.NET.Common/OBDData/00-1F/PidsSupported01_20.cs @@ -1,6 +1,4 @@ -using System.Collections.Generic; - -namespace OBD.NET.Common.OBDData +namespace OBD.NET.Common.OBDData { public class PidsSupported01_20 : AbstractPidsSupported { diff --git a/OBD.NET/OBD.NET.Common/OBDData/20-3F/PidsSupported21_40.cs b/OBD.NET/OBD.NET.Common/OBDData/20-3F/PidsSupported21_40.cs index b896706..cc72b10 100644 --- a/OBD.NET/OBD.NET.Common/OBDData/20-3F/PidsSupported21_40.cs +++ b/OBD.NET/OBD.NET.Common/OBDData/20-3F/PidsSupported21_40.cs @@ -1,6 +1,4 @@ -using System.Collections.Generic; - -namespace OBD.NET.Common.OBDData +namespace OBD.NET.Common.OBDData { public class PidsSupported21_40 : AbstractPidsSupported { diff --git a/OBD.NET/OBD.NET.Common/OBDData/40-5F/PidsSupported41_60.cs b/OBD.NET/OBD.NET.Common/OBDData/40-5F/PidsSupported41_60.cs index 2ae07f9..9f935a9 100644 --- a/OBD.NET/OBD.NET.Common/OBDData/40-5F/PidsSupported41_60.cs +++ b/OBD.NET/OBD.NET.Common/OBDData/40-5F/PidsSupported41_60.cs @@ -1,6 +1,4 @@ -using System.Collections.Generic; - -namespace OBD.NET.Common.OBDData +namespace OBD.NET.Common.OBDData { public class PidsSupported41_60 : AbstractPidsSupported { diff --git a/OBD.NET/OBD.NET.Common/OBDData/60-7F/PidsSupported61_80.cs b/OBD.NET/OBD.NET.Common/OBDData/60-7F/PidsSupported61_80.cs index f57944b..a946df4 100644 --- a/OBD.NET/OBD.NET.Common/OBDData/60-7F/PidsSupported61_80.cs +++ b/OBD.NET/OBD.NET.Common/OBDData/60-7F/PidsSupported61_80.cs @@ -1,6 +1,4 @@ -using System.Collections.Generic; - -namespace OBD.NET.Common.OBDData +namespace OBD.NET.Common.OBDData { public class PidsSupported61_80 : AbstractPidsSupported { diff --git a/OBD.NET/OBD.NET.Common/OBDData/80-9F/PidsSupported81_A0.cs b/OBD.NET/OBD.NET.Common/OBDData/80-9F/PidsSupported81_A0.cs index 357586d..cb5c658 100644 --- a/OBD.NET/OBD.NET.Common/OBDData/80-9F/PidsSupported81_A0.cs +++ b/OBD.NET/OBD.NET.Common/OBDData/80-9F/PidsSupported81_A0.cs @@ -1,6 +1,4 @@ -using System.Collections.Generic; - -namespace OBD.NET.Common.OBDData +namespace OBD.NET.Common.OBDData { public class PidsSupported81_A0 : AbstractPidsSupported { diff --git a/OBD.NET/OBD.NET.Common/OBDData/A0-BF/PidsSupportedA1_C0.cs b/OBD.NET/OBD.NET.Common/OBDData/A0-BF/PidsSupportedA1_C0.cs index 8861022..03dbbed 100644 --- a/OBD.NET/OBD.NET.Common/OBDData/A0-BF/PidsSupportedA1_C0.cs +++ b/OBD.NET/OBD.NET.Common/OBDData/A0-BF/PidsSupportedA1_C0.cs @@ -1,6 +1,4 @@ -using System.Collections.Generic; - -namespace OBD.NET.Common.OBDData +namespace OBD.NET.Common.OBDData { public class PidsSupportedA1_C0 : AbstractPidsSupported { diff --git a/OBD.NET/OBD.NET.Common/OBDData/AbstractPidsSupported.cs b/OBD.NET/OBD.NET.Common/OBDData/AbstractPidsSupported.cs index cc7288b..9ecd36a 100644 --- a/OBD.NET/OBD.NET.Common/OBDData/AbstractPidsSupported.cs +++ b/OBD.NET/OBD.NET.Common/OBDData/AbstractPidsSupported.cs @@ -1,35 +1,34 @@ -using System; -using System.Collections; +using System.Collections; using System.Collections.Generic; -using System.Linq; -using System.Text; namespace OBD.NET.Common.OBDData { public abstract class AbstractPidsSupported : AbstractOBDData { - public AbstractPidsSupported(byte pid, int length) : base(pid, length) - { - - } + #region Properties & Fields public int[] SupportedPids { get { List supportedPids = new List(); - byte[] byteArray = new byte[] { D, C, B, A }; - var bitArray = new BitArray(byteArray); + BitArray bitArray = new BitArray(new[] { D, C, B, A }); + for (int i = 0x01; i <= 0x20; i++) - { if (bitArray.Get(bitArray.Length - i)) - { supportedPids.Add(PID + i); - } - } + return supportedPids.ToArray(); } } + + #endregion + + #region Constructors + + public AbstractPidsSupported(byte pid, int length) : base(pid, length) + { } + + #endregion } } - diff --git a/OBD.NET/OBD.NET.Common/OBDData/C0-DF/PidsSupportedC1_E0.cs b/OBD.NET/OBD.NET.Common/OBDData/C0-DF/PidsSupportedC1_E0.cs index d690e90..0e92608 100644 --- a/OBD.NET/OBD.NET.Common/OBDData/C0-DF/PidsSupportedC1_E0.cs +++ b/OBD.NET/OBD.NET.Common/OBDData/C0-DF/PidsSupportedC1_E0.cs @@ -1,6 +1,4 @@ -using System.Collections.Generic; - -namespace OBD.NET.Common.OBDData +namespace OBD.NET.Common.OBDData { public class PidsSupportedC1_E0 : AbstractPidsSupported {