Exemple #1
0
 private void 检查全卡ToolStripMenuItem_Click(object sender, EventArgs e)
 {
     int[] res = currentS50.Verify();
     if (res[16] == 0)
     {
         MessageBox.Show("该文件一切正常。");
     }
     else
     {
         string msg = "该文件存在以下错误:\n";
         for (int i = 0; i < 16; i++)
         {
             msg += "扇区" + i.ToString() + ":\n";
             if ((res[i] & 0x01) == 0x01)
             {
                 msg += "该扇区UID校验值错误,请点击打开扇区0来自动更正。\n";
             }
             if ((res[i] & 0x02) == 0x02)
             {
                 msg += "该扇区访问控制位无效,写入将会损坏卡片,请重新设置。\n";
             }
             if ((res[i] & 0x04) == 0x04)
             {
                 msg += "该扇区访问控制位损坏,写入将会损坏卡片,请重新设置。\n";
             }
             if (res[i] == 0)
             {
                 msg += "该扇区一切正常。\n";
             }
         }
         richTextBox1.Clear();
         richTextBox1.Text = msg;
     }
 }
Exemple #2
0
 private void 检查全卡ToolStripMenuItem_Click(object sender, EventArgs e)
 {
     int[] res = currentS50.Verify();
     if (res[16] == 0)
     {
         MessageBox.Show(Resources.该文件一切正常);
     }
     else
     {
         string msg = Resources.该文件存在以下错误;
         for (int i = 0; i < 16; i++)
         {
             msg += Resources.扇区 + i.ToString() + Resources.res4;
             if ((res[i] & 0x01) == 0x01)
             {
                 msg += Resources.该扇区UID校验值错误_请点击打开扇区0来自动更正;
             }
             if ((res[i] & 0x02) == 0x02)
             {
                 msg += Resources.该扇区访问控制位无效_写入将会损坏卡片_请重新设置;
             }
             if ((res[i] & 0x04) == 0x04)
             {
                 msg += Resources.该扇区访问控制位损坏_写入将会损坏卡片_请重新设置;
             }
             if (res[i] == 0)
             {
                 msg += Resources.该扇区一切正常;
             }
         }
         richTextBox1.Clear();
         richTextBox1.Text = msg;
     }
 }
Exemple #3
0
        bool writecheck(string file)
        {
            S50 card = new S50();

            try
            {
                card.LoadFromMfd(file);
            }
            catch (IOException ioe)
            {
                MessageBox.Show(ioe.Message, "打开出错", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }
            if (card.Verify()[16] == 0x00)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }