private byte[] HexToByte(string msg)
{
msg = msg.Replace(" ", "");
byte[] numArray = new byte[msg.Length / 2];
int startIndex = 0;
while (startIndex < msg.Length)
{
numArray[startIndex / 2] = Convert.ToByte(msg.Substring(startIndex, 2), 16);
startIndex += 2;
}
return numArray;
}