C# Class KMotion_dotNet.HexEncoding

Helper class for working with hex-binary stack objects
Mostra file Open project: parhansson/KMotionX

Public Methods

Method Description
GetByteCount ( string hexString ) : int

Counts the byte length of a Hex value

GetBytes ( string hexString, int &discarded ) : byte[]

Creates a byte array from the hexadecimal string. Each two characters are combined to create one byte. First two hexadecimal characters become first byte in returned array. Non-hexadecimal characters are ignored.

HexEncoding ( ) : System

Default constructor for HexEncoding

InHexFormat ( string hexString ) : bool

Determines if given string is in proper hexadecimal string format

IsHexDigit ( Char c ) : bool

Returns true is c is a hexadecimal digit (A-F, a-f, 0-9)

ToString ( byte bytes ) : string

Converts an array of bytes to a hexidecimal value represented by a string

Private Methods

Method Description
HexToByte ( string hex ) : byte

Converts 1 or 2 character string into equivalant byte value

Method Details

GetByteCount() public static method

Counts the byte length of a Hex value
public static GetByteCount ( string hexString ) : int
hexString string Hex number in string format
return int

GetBytes() public static method

Creates a byte array from the hexadecimal string. Each two characters are combined to create one byte. First two hexadecimal characters become first byte in returned array. Non-hexadecimal characters are ignored.
public static GetBytes ( string hexString, int &discarded ) : byte[]
hexString string string to convert to byte array
discarded int number of characters in string ignored
return byte[]

HexEncoding() public method

Default constructor for HexEncoding
public HexEncoding ( ) : System
return System

InHexFormat() public static method

Determines if given string is in proper hexadecimal string format
public static InHexFormat ( string hexString ) : bool
hexString string
return bool

IsHexDigit() public static method

Returns true is c is a hexadecimal digit (A-F, a-f, 0-9)
public static IsHexDigit ( Char c ) : bool
c Char Character to test
return bool

ToString() public static method

Converts an array of bytes to a hexidecimal value represented by a string
public static ToString ( byte bytes ) : string
bytes byte byte array
return string