日期:2014-05-18 浏览次数:20805 次
byte[] _Key = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; byte sector = 0; string strErrMsg = string.Empty; for (int i = 0; i < 16; i++) { if (rf_load_key(icDev, byteCardFindMode, sector, _Key) != 0) { strErrMsg += sector.ToString() + "扇区装载密码失败\r\n"; } else { if (rf_authentication(icDev, byteCardPwdMode, sector) == 0)//进行验证 { if (rf_read(icDev, (byte)(sector * 4 + 1), ref _Data) == 0) { DisplayInfo(rtbICCard, System.Text.Encoding.Default.GetString(_Data));//将读出的信息显示到RichTextBox中 } } else { strErrMsg += sector.ToString() + "扇区密码验证失败\r\n"; } } sector++; } //如果有错误信息则提示 if (strErrMsg != "") { MessageBox.Show(strErrMsg,"错误",MessageBoxButtons.OK,MessageBoxIcon.Error); bolIsICCardFound = false; rf_halt(icDev); }