C# Class LibUsbDotNet.Main.Helper

General utilities class used by LudnLite and exposed publicly for your convience.
显示文件 Open project: arvydas/BlinkStickDotNet

Public Methods

Method Description
BytesToObject ( byte sourceBytes, int iStartIndex, int iLength, object destObject ) : void

Copies bytes to a blittable object.

GetEnumData ( Type type ) : int>.Dictionary

Returns a dictionary object of enumeration names and values.

HexString ( byte data, string prefix, string suffix ) : string

Builds a formatted hexidecimal string from an array of bytes.

HostEndianToLE16 ( short swapValue ) : short

Swaps low and high bytes on big endian systems. Has no effect on little endian systems.

ShowAsHex ( object standardValue ) : string

Converts standard values to decorated hex string values.

ToString ( string sep0, string names, string sep1, object values, string sep2 ) : string

Builds a delimited string of names and values.

Method Details

BytesToObject() public static method

Copies bytes to a blittable object.
public static BytesToObject ( byte sourceBytes, int iStartIndex, int iLength, object destObject ) : void
sourceBytes byte bytes to copy
iStartIndex int Start index
iLength int number of bytes to copy
destObject object blittable destination object
return void

GetEnumData() public static method

Returns a dictionary object of enumeration names and values.
public static GetEnumData ( Type type ) : int>.Dictionary
type System.Type They of enumeration.
return int>.Dictionary

HexString() public static method

Builds a formatted hexidecimal string from an array of bytes.
public static HexString ( byte data, string prefix, string suffix ) : string
data byte the byte array
prefix string string to place before each byte
suffix string string to place after each byte
return string

HostEndianToLE16() public static method

Swaps low and high bytes on big endian systems. Has no effect on little endian systems.
public static HostEndianToLE16 ( short swapValue ) : short
swapValue short The value to convert.
return short

ShowAsHex() public static method

Converts standard values to decorated hex string values.
public static ShowAsHex ( object standardValue ) : string
standardValue object The value to convert.
return string

ToString() public static method

Builds a delimited string of names and values.
public static ToString ( string sep0, string names, string sep1, object values, string sep2 ) : string
sep0 string Inserted and the begining of the entity.
names string The list of names for the object values.
sep1 string Inserted between the name and value.
values object The values for the names.
sep2 string Inserted and the end of the entity.
return string