1
0
mirror of https://github.com/DarthAffe/OBD.NET.git synced 2025-12-12 16:58:30 +00:00

Small refactorings to make the code fit the code-style of the library

This commit is contained in:
Darth Affe 2018-04-04 20:34:21 +02:00
parent b4f7a3480e
commit b9da9787ba
8 changed files with 21 additions and 36 deletions

View File

@ -1,6 +1,4 @@
using System.Collections.Generic; namespace OBD.NET.Common.OBDData
namespace OBD.NET.Common.OBDData
{ {
public class PidsSupported01_20 : AbstractPidsSupported public class PidsSupported01_20 : AbstractPidsSupported
{ {

View File

@ -1,6 +1,4 @@
using System.Collections.Generic; namespace OBD.NET.Common.OBDData
namespace OBD.NET.Common.OBDData
{ {
public class PidsSupported21_40 : AbstractPidsSupported public class PidsSupported21_40 : AbstractPidsSupported
{ {

View File

@ -1,6 +1,4 @@
using System.Collections.Generic; namespace OBD.NET.Common.OBDData
namespace OBD.NET.Common.OBDData
{ {
public class PidsSupported41_60 : AbstractPidsSupported public class PidsSupported41_60 : AbstractPidsSupported
{ {

View File

@ -1,6 +1,4 @@
using System.Collections.Generic; namespace OBD.NET.Common.OBDData
namespace OBD.NET.Common.OBDData
{ {
public class PidsSupported61_80 : AbstractPidsSupported public class PidsSupported61_80 : AbstractPidsSupported
{ {

View File

@ -1,6 +1,4 @@
using System.Collections.Generic; namespace OBD.NET.Common.OBDData
namespace OBD.NET.Common.OBDData
{ {
public class PidsSupported81_A0 : AbstractPidsSupported public class PidsSupported81_A0 : AbstractPidsSupported
{ {

View File

@ -1,6 +1,4 @@
using System.Collections.Generic; namespace OBD.NET.Common.OBDData
namespace OBD.NET.Common.OBDData
{ {
public class PidsSupportedA1_C0 : AbstractPidsSupported public class PidsSupportedA1_C0 : AbstractPidsSupported
{ {

View File

@ -1,35 +1,34 @@
using System; using System.Collections;
using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace OBD.NET.Common.OBDData namespace OBD.NET.Common.OBDData
{ {
public abstract class AbstractPidsSupported : AbstractOBDData public abstract class AbstractPidsSupported : AbstractOBDData
{ {
public AbstractPidsSupported(byte pid, int length) : base(pid, length) #region Properties & Fields
{
}
public int[] SupportedPids public int[] SupportedPids
{ {
get get
{ {
List<int> supportedPids = new List<int>(); List<int> supportedPids = new List<int>();
byte[] byteArray = new byte[] { D, C, B, A }; BitArray bitArray = new BitArray(new[] { D, C, B, A });
var bitArray = new BitArray(byteArray);
for (int i = 0x01; i <= 0x20; i++) for (int i = 0x01; i <= 0x20; i++)
{
if (bitArray.Get(bitArray.Length - i)) if (bitArray.Get(bitArray.Length - i))
{
supportedPids.Add(PID + i); supportedPids.Add(PID + i);
}
}
return supportedPids.ToArray(); return supportedPids.ToArray();
} }
} }
#endregion
#region Constructors
public AbstractPidsSupported(byte pid, int length) : base(pid, length)
{ }
#endregion
} }
} }

View File

@ -1,6 +1,4 @@
using System.Collections.Generic; namespace OBD.NET.Common.OBDData
namespace OBD.NET.Common.OBDData
{ {
public class PidsSupportedC1_E0 : AbstractPidsSupported public class PidsSupportedC1_E0 : AbstractPidsSupported
{ {