OSDP.Net 5.2.1
A .NET library for implementing the Open Supervised Device Protocol (OSDP)
Loading...
Searching...
No Matches
OSDP.Net.Utilities.BinaryUtils Class Reference

Helper routines for manipulating binary representations of data that are used within the OSDP.NET library and its unit tests. More...

Static Public Member Functions

static BitArray HexStringToBitArray (string hex)
 Convert a string containing hex digits into BitArray.
static BitArray HexStringToBitArray (IEnumerable< char > hex)
 Convert a sequence of hex digit characters into BitArray.
static IEnumerable< byte > HexToBytes (IEnumerable< char > seq)
 Convert a sequence of hex digit characters into their byte representation.
static string BitArrayToString (BitArray arr)
 Convert the BitArray instance to a binary string representation.

Detailed Description

Helper routines for manipulating binary representations of data that are used within the OSDP.NET library and its unit tests.

Definition at line 13 of file BinaryUtils.cs.

Member Function Documentation

◆ BitArrayToString()

string OSDP.Net.Utilities.BinaryUtils.BitArrayToString ( BitArray arr)
inlinestatic

Convert the BitArray instance to a binary string representation.

Parameters
arrBitArray to be converted
Returns
A string consisting almost entirely of 0s and 1s

Definition at line 66 of file BinaryUtils.cs.

◆ HexStringToBitArray() [1/2]

BitArray OSDP.Net.Utilities.BinaryUtils.HexStringToBitArray ( IEnumerable< char > hex)
static

Convert a sequence of hex digit characters into BitArray.

Parameters
hexCharacter sequence to be converted
Returns
BitArray instance with most-significant bit first order

◆ HexStringToBitArray() [2/2]

BitArray OSDP.Net.Utilities.BinaryUtils.HexStringToBitArray ( string hex)
static

Convert a string containing hex digits into BitArray.

Parameters
hexString to be converted
Returns
BitArray instance with most-significant bit first order

◆ HexToBytes()

IEnumerable< byte > OSDP.Net.Utilities.BinaryUtils.HexToBytes ( IEnumerable< char > seq)
inlinestatic

Convert a sequence of hex digit characters into their byte representation.

Parameters
seqcharacter digit sequence to be converted
Returns
Sequence of bytes
Exceptions
InvalidOperationExceptionThrown if an invalid character is encountered

Definition at line 39 of file BinaryUtils.cs.

Referenced by OSDP.Net.Tracing.MessageSpy.ParseCaptureFile().


The documentation for this class was generated from the following file: