我使用感应卡读卡器读取卡号。 使用制作人软件,当我读到我得到这个号码时:
BF 1C 08 04 01
但是使用我的应用程序:
3F-1C-01年8月4日
代码:
void sp_DataReceived(object sender, SerialDataReceivedEventArgs e)
{
_received += sp.ReadExisting();
ASCIIEncoding encoding = new ASCIIEncoding();
byte[] bytes = encoding.GetBytes(_received);
bytes = SubArray(bytes, 5, 5);//to get only that I need
string s2 = BitConverter.ToString(bytes);
_received = s2.Replace("-", "");
string result = SocketSendReceive(host, port);
_received = "";
}
有什么想法吗?