コード例 #1
0
        /// <summary>
        /// 获取单个字节的ASCII字符串
        /// </summary>
        /// <param name="inByte"></param>
        /// <returns></returns>
        public static string GetAsciiStrOfOneByte(ref byte inByte)
        {
            string ret = "";

            try
            {
                byte[] oneByte = new byte[1];
                oneByte[0] = inByte;
                ret        = RFIDTextBox.ConvertBytesToString(oneByte);
            }
            catch
            {
            }

            return(ret);
        }
コード例 #2
0
        /// <summary>
        /// 将单个ASCII码字符转化成为字节数据,inStr的长度必须为1
        /// </summary>
        /// <param name="inStr"></param>
        /// <returns></returns>
        public static byte GetOneByteOfAsciiChar(ref string inStr)
        {
            byte ret = 0x00;

            try
            {
                if (inStr.Length == 1)
                {
                    byte[] oneByte = RFIDTextBox.ConvertStringToBytes(inStr);
                    ret = oneByte[0];
                }
            }
            catch
            {
            }
            return(ret);
        }