コード例 #1
0
ファイル: FormDiff.cs プロジェクト: xfoxfu/MifareOneToolCli
        private void button2_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();

            ofd.CheckFileExists = true;
            ofd.Filter          = Resources.MFD文件_mfd_dump;
            ofd.Title           = Resources.请选择需要打开的MFD文件_比较B;
            ofd.Multiselect     = false;
            if (ofd.ShowDialog() == DialogResult.OK)
            {
                fb = ofd.FileName;
            }
            else
            {
                return;
            }
            sb = new S50();
            try
            {
                sb.LoadFromMfd(fb);
                button2.Text = "B=" + ofd.SafeFileName;
            }
            catch (IOException ioe)
            {
                MessageBox.Show(ioe.Message, Resources.打开出错, MessageBoxButtons.OK, MessageBoxIcon.Error);
                sb = new S50();
                return;
            }
        }
コード例 #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();

            ofd.CheckFileExists = true;
            ofd.Filter          = "MFD文件|*.mfd;*.dump";
            ofd.Title           = "请选择需要打开的MFD文件(比较A)";
            ofd.Multiselect     = false;
            if (ofd.ShowDialog() == DialogResult.OK)
            {
                fa = ofd.FileName;
            }
            else
            {
                return;
            }
            sa = new S50();
            try
            {
                sa.LoadFromMfd(fa);
                button1.Text = "A=" + ofd.SafeFileName;
            }
            catch (IOException ioe)
            {
                MessageBox.Show(ioe.Message, "打开出错", MessageBoxButtons.OK, MessageBoxIcon.Error);
                sa = new S50();
                return;
            }
        }
コード例 #3
0
        private void 导入MCT格式ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            reloadEdit(-1);
            OpenFileDialog ofd = new OpenFileDialog();

            ofd.CheckFileExists = true;
            ofd.Filter          = "MCT格式|*.*";
            ofd.Title           = "请选择需要打开的MCT格式文件";
            ofd.Multiselect     = false;
            if (ofd.ShowDialog() == DialogResult.OK)
            {
                currentFilename = ofd.FileName;
            }
            else
            {
                return;
            }
            this.currentS50 = new S50();
            try
            {
                this.currentS50.LoadFromMctTxt(currentFilename);
            }
            catch (IOException ioe)
            {
                MessageBox.Show(ioe.Message, "打开出错", MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.currentS50 = new S50();
                return;
            }
            reloadList();
            logAppend("打开了" + ofd.FileName);
        }
コード例 #4
0
 private void 新建ToolStripMenuItem_Click(object sender, EventArgs e)
 {
     reloadEdit(-1);
     this.currentS50 = new S50();
     reloadList();
     logAppend("已重置并新建卡。");
 }
コード例 #5
0
ファイル: FormHTool.cs プロジェクト: xfoxfu/MifareOneToolCli
        private void 打开ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            reloadEdit(-1);
            OpenFileDialog ofd = new OpenFileDialog();

            ofd.CheckFileExists = true;
            ofd.Filter          = Resources.MFD文件_mfd_dump;
            ofd.Title           = Resources.请选择需要打开的MFD文件;
            ofd.Multiselect     = false;
            if (ofd.ShowDialog() == DialogResult.OK)
            {
                currentFilename = ofd.FileName;
            }
            else
            {
                return;
            }
            this.currentS50 = new S50();
            try
            {
                this.currentS50.LoadFromMfd(currentFilename);
            }
            catch (IOException ioe)
            {
                MessageBox.Show(ioe.Message, Resources.打开出错, MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.currentS50 = new S50();
                return;
            }
            reloadList();
            logAppend(Resources.打开了 + ofd.FileName);
        }
コード例 #6
0
        private void buttonWriteEmpty_Click(object sender, EventArgs e)
        {
            if (lprocess)
            {
                MessageBox.Show(Resources.任务运行中_不可执行, Resources.设备忙, MessageBoxButtons.OK, MessageBoxIcon.Warning); return;
            }
            S50 empty = new S50();

            empty.ExportToMfd("mff08_empty.kmf");
            BackgroundWorker bgw = new BackgroundWorker();

            bgw.DoWork += new DoWorkEventHandler(cmf_write);
            bgw.WorkerReportsProgress = true;
            bgw.ProgressChanged      += new ProgressChangedEventHandler(default_rpt);
            bgw.RunWorkerAsync(new string[] { "mff08_empty.kmf", "A", "x", "" });
        }
コード例 #7
0
        private void buttonKeyWrite_Click(object sender, EventArgs e)
        {
            if (lprocess)
            {
                MessageBox.Show(Resources.任务运行中_不可执行, Resources.设备忙, MessageBoxButtons.OK, MessageBoxIcon.Warning); return;
            }
            S50 empty = new S50();

            empty.ExportToMfd("mff08_empty.kmf");
            if (keyfileBox.Text == "")
            {
                MessageBox.Show(Resources.您没有给定最后一次写卡导致0块损坏的卡数据文件来作为写卡时的, Resources.错误, MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            BackgroundWorker bgw = new BackgroundWorker();

            bgw.DoWork += new DoWorkEventHandler(cmf_write);
            bgw.WorkerReportsProgress = true;
            bgw.ProgressChanged      += new ProgressChangedEventHandler(default_rpt);
            bgw.RunWorkerAsync(new string[] { "mff08_empty.kmf", "C", "", keyfileBox.Text });
        }
コード例 #8
0
ファイル: Form1.cs プロジェクト: LxKxC/MifareOneTool
        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);
            }
        }