예제 #1
0
        private void ButtonByPassMode_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog
            {
                CheckFileExists = true,
                Filter          = "dump文件|*.dump",
                Title           = "使用已有dump数据",
                Multiselect     = false
            };

            if (ofd.ShowDialog() == DialogResult.OK)
            {
                if (!Writecheck(ofd.FileName))
                {
                    MessageBox.Show("这个文件不正确", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); return;
                }
                File.Delete("work.dump");
                File.Copy(ofd.FileName, "work.dump");
                S50 card = new S50();
                card.LoadFromMfd(ofd.FileName);
                cardid = card.UIDString;
                checkBoxChkCard.Checked = true;
                checkBoxGetData.Checked = true;
                stepCount = 3;
                progressBar1.PerformStep();
                buttonByPassMode.Visible = false;
                richTextBox1.Text        = "选择的DUMP文件格式有效。请在设备上面放一张UID卡(注意CUID卡不能用),点击下一步程序会擦除这张卡并刷写卡号。";
            }
            else
            {
                ;
            }
        }
예제 #2
0
        bool Writecheck(string file)
        {
            //if (checkBoxWriteProtect.Checked == false)
            //{ return true; }//如果禁用,直接假装检查成功
            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);
            }
        }