/// <Summary>
/// Convert a decimal string to hexadecimal
/// </Summary>
/// <Param name = "strcharset"> </param>
/// <Returns> </returns>
Public String Tensstringtohexstring ( String Strcharset)
{
Stringbuilder strbcharset = New Stringbuilder ();
Char[] Chararray = strcharset. tochararray ();
For(IntI =0; I <chararray. length; I ++)
{
Strbcharset. append (convert. tostring (chararray [I],16). Padleft (3,' '));
}
Return Strbcharset. tostring ();
}
/// <Summary>
/// Convert a decimal string to a decimal byte array
/// </Summary>
/// <Param name = "strcharset"> </param>
/// <Returns> </returns>
Public Byte [] Tensstringtobytearray ( String Strcharset)
{
Byte [] Buffer = New Byte [Strcharset. Length];
for ( int I = 0 ; I {< br> buffer [I] = convert. tobyte (strcharset. substring (I, 1 ), 10 );
}
ReturnBuffer;
}
//Hexadecimal conversion of hexadecimal byte Arrays
Public Byte[] Hexstringtobytearray (StringStrcharset)
{
Strcharset = strcharset. Replace (" ","");
Byte[] Buffer =New Byte[Strcharset. Length/2];
for ( int I = 0 ; I 2 )
{< br> buffer [I/ 2 ] = ( byte ) convert. tobyte (strcharset. substring (I, 2 ), 16 );
}
return buffer;
}< br> /// convert byte arrays to hexadecimal notation
Public string bytearraytohexstring ( byte [] btdata)
{< br> stringbuilder sbdata = New stringbuilder (btdata. length * 3 );
Foreach(ByteBInBtdata)
{
Sbdata. append (convert. tostring (B,16). Padleft (2,'0'). Padright (3,' '));
}
ReturnSbdata. tostring (). toupper ();
}