You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
953 B
36 lines
953 B
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
|
|
namespace n5coredll
|
|
{
|
|
public class Util
|
|
{
|
|
public static string bcd2Str(byte[] bytes)
|
|
{
|
|
Console.WriteLine("Execute bcd2Str!");
|
|
|
|
StringBuilder temp = new StringBuilder();
|
|
for (int i = 0; i < bytes.Length; i++)
|
|
{
|
|
int h = ((bytes[i] & 0xff) >> 4) + 48;
|
|
temp.Append((char)h);
|
|
int l = ((bytes[i] & 0x0f)) + 48;
|
|
temp.Append((char)l);
|
|
}
|
|
return temp.ToString();
|
|
}
|
|
|
|
public static string desToHex(byte[] bytes)
|
|
{
|
|
StringBuilder sb = new StringBuilder("");
|
|
for (int i = 0; i < bytes.Length; i++)
|
|
{
|
|
string st = string.Format("%02X", bytes[i]);
|
|
sb.Append(st);
|
|
}
|
|
return sb.ToString();
|
|
}
|
|
}
|
|
}
|
|
|