Exemplo n.º 1
0
        /// <summary>
        /// 获取当前读卡器上的IC卡号码,返回8位的卡号或错误信息
        /// 此方法自行处理卡号+加动态码,返回最终卡号,与ReadICCard不同
        /// </summary>
        public static string GetICCardID(bool isBeep = true, bool isCreate = false)
        {
            string sICCardID = ICAccess.ReadICCard(isBeep, isCreate);

            if (sICCardID.Length != 8)
            {
                try
                {
                    string sRepeatCode = Convert.ToInt32(sICCardID.Substring(8), 16).ToString();
                    sICCardID = sICCardID.Substring(0, 8);
                    int iICCardID = 0;
                    if (ICAccess.isNumberic(sICCardID, out iICCardID))
                    {
                        return(iICCardID.ToString());
                    }
                    else
                    {
                        return(sICCardID);
                    }
                }
                catch
                {
                    return(sICCardID);
                }
            }
            return(sICCardID);
        }