From f887577006ee5058c1410128c7bdaf3ee7a1f395 Mon Sep 17 00:00:00 2001 From: XAS-712 Date: Tue, 5 Feb 2019 09:38:25 +0800 Subject: [PATCH] v1.6.3 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 自动探测key.mfd 界面设置 设置面板独立 --- MifareOneTool/Form1.Designer.cs | 438 ++++++++++++------ MifareOneTool/Form1.cs | 90 +++- MifareOneTool/Properties/AssemblyInfo.cs | 6 +- MifareOneTool/Properties/Settings.Designer.cs | 48 ++ MifareOneTool/Properties/Settings.settings | 12 + MifareOneTool/app.config | 12 + 6 files changed, 454 insertions(+), 152 deletions(-) diff --git a/MifareOneTool/Form1.Designer.cs b/MifareOneTool/Form1.Designer.cs index 3247e91..174b5f3 100644 --- a/MifareOneTool/Form1.Designer.cs +++ b/MifareOneTool/Form1.Designer.cs @@ -31,7 +31,6 @@ this.components = new System.ComponentModel.Container(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1)); this.groupBox1 = new System.Windows.Forms.GroupBox(); - this.buttonSniffDev = new System.Windows.Forms.Button(); this.buttonCLI = new System.Windows.Forms.Button(); this.buttonScanCard = new System.Windows.Forms.Button(); this.buttonListDev = new System.Windows.Forms.Button(); @@ -63,26 +62,44 @@ this.groupBox4 = new System.Windows.Forms.GroupBox(); this.tabControl1 = new System.Windows.Forms.TabControl(); this.tabPage2 = new System.Windows.Forms.TabPage(); + this.label8 = new System.Windows.Forms.Label(); + this.label7 = new System.Windows.Forms.Label(); + this.label6 = new System.Windows.Forms.Label(); + this.label4 = new System.Windows.Forms.Label(); + this.label3 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.buttonECheckEncrypt = new System.Windows.Forms.Button(); this.buttonEAdv = new System.Windows.Forms.Button(); + this.buttoEScanCard = new System.Windows.Forms.Button(); this.groupBox7 = new System.Windows.Forms.GroupBox(); this.buttonECuidWrite = new System.Windows.Forms.Button(); this.buttonEUIDWrite = new System.Windows.Forms.Button(); this.button4 = new System.Windows.Forms.Button(); this.buttonEMfWrite = new System.Windows.Forms.Button(); - this.buttonECheckEncrypt = new System.Windows.Forms.Button(); - this.buttoEScanCard = new System.Windows.Forms.Button(); this.buttonEscan = new System.Windows.Forms.Button(); this.groupBox5 = new System.Windows.Forms.GroupBox(); + this.buttonEReadUID = new System.Windows.Forms.Button(); this.buttonESelectKey = new System.Windows.Forms.Button(); this.buttonECmfoc = new System.Windows.Forms.Button(); this.buttonEMfRead = new System.Windows.Forms.Button(); this.buttonEMfoc = new System.Windows.Forms.Button(); + this.label5 = new System.Windows.Forms.Label(); this.tabPage1 = new System.Windows.Forms.TabPage(); this.groupBox10 = new System.Windows.Forms.GroupBox(); this.buttonHardNested = new System.Windows.Forms.Button(); this.groupBox9 = new System.Windows.Forms.GroupBox(); this.label1 = new System.Windows.Forms.Label(); this.groupBox8 = new System.Windows.Forms.GroupBox(); + this.tabPage3 = new System.Windows.Forms.TabPage(); + this.groupBox12 = new System.Windows.Forms.GroupBox(); + this.numericCLIFontSize = new System.Windows.Forms.NumericUpDown(); + this.label10 = new System.Windows.Forms.Label(); + this.buttonCLIColor = new System.Windows.Forms.Button(); + this.label9 = new System.Windows.Forms.Label(); + this.checkBoxWriteProtect = new System.Windows.Forms.CheckBox(); + this.groupBox6 = new System.Windows.Forms.GroupBox(); + this.checkBoxAutoLoadKey = new System.Windows.Forms.CheckBox(); + this.checkBoxAutoABN = new System.Windows.Forms.CheckBox(); this.statusStrip1 = new System.Windows.Forms.StatusStrip(); this.statusLabel = new System.Windows.Forms.ToolStripStatusLabel(); this.runTimeLabel = new System.Windows.Forms.ToolStripStatusLabel(); @@ -90,16 +107,8 @@ this.remoteVersionLabel = new System.Windows.Forms.ToolStripStatusLabel(); this.toolStripCheckUpdate = new System.Windows.Forms.ToolStripSplitButton(); this.timer1 = new System.Windows.Forms.Timer(this.components); - this.checkBoxAutoABN = new System.Windows.Forms.CheckBox(); - this.buttonEReadUID = new System.Windows.Forms.Button(); - this.label2 = new System.Windows.Forms.Label(); - this.label3 = new System.Windows.Forms.Label(); - this.label4 = new System.Windows.Forms.Label(); - this.label5 = new System.Windows.Forms.Label(); - this.label6 = new System.Windows.Forms.Label(); - this.checkBoxWriteProtect = new System.Windows.Forms.CheckBox(); - this.label7 = new System.Windows.Forms.Label(); - this.label8 = new System.Windows.Forms.Label(); + this.groupBox13 = new System.Windows.Forms.GroupBox(); + this.checkBoxDefIsAdv = new System.Windows.Forms.CheckBox(); this.groupBox1.SuspendLayout(); this.groupBox2.SuspendLayout(); this.groupBox3.SuspendLayout(); @@ -112,12 +121,16 @@ this.groupBox10.SuspendLayout(); this.groupBox9.SuspendLayout(); this.groupBox8.SuspendLayout(); + this.tabPage3.SuspendLayout(); + this.groupBox12.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.numericCLIFontSize)).BeginInit(); + this.groupBox6.SuspendLayout(); this.statusStrip1.SuspendLayout(); + this.groupBox13.SuspendLayout(); this.SuspendLayout(); // // groupBox1 // - this.groupBox1.Controls.Add(this.buttonSniffDev); this.groupBox1.Controls.Add(this.buttonCLI); this.groupBox1.Controls.Add(this.buttonScanCard); this.groupBox1.Controls.Add(this.buttonListDev); @@ -128,16 +141,6 @@ this.groupBox1.TabStop = false; this.groupBox1.Text = "设备控制"; // - // buttonSniffDev - // - this.buttonSniffDev.Enabled = false; - this.buttonSniffDev.Location = new System.Drawing.Point(102, 52); - this.buttonSniffDev.Name = "buttonSniffDev"; - this.buttonSniffDev.Size = new System.Drawing.Size(90, 25); - this.buttonSniffDev.TabIndex = 12; - this.buttonSniffDev.Text = "联机嗅探"; - this.buttonSniffDev.UseVisualStyleBackColor = true; - // // buttonCLI // this.buttonCLI.Font = new System.Drawing.Font("宋体", 8.5F); @@ -465,8 +468,6 @@ // // groupBox4 // - this.groupBox4.Controls.Add(this.checkBoxWriteProtect); - this.groupBox4.Controls.Add(this.checkBoxAutoABN); this.groupBox4.Controls.Add(this.buttonDiffTool); this.groupBox4.Controls.Add(this.buttonHexTool); this.groupBox4.Location = new System.Drawing.Point(3, 94); @@ -480,6 +481,7 @@ // this.tabControl1.Controls.Add(this.tabPage2); this.tabControl1.Controls.Add(this.tabPage1); + this.tabControl1.Controls.Add(this.tabPage3); this.tabControl1.Location = new System.Drawing.Point(0, 5); this.tabControl1.Name = "tabControl1"; this.tabControl1.SelectedIndex = 0; @@ -509,6 +511,72 @@ this.tabPage2.Text = "复制卡模式"; this.tabPage2.UseVisualStyleBackColor = true; // + // label8 + // + this.label8.AutoSize = true; + this.label8.ForeColor = System.Drawing.Color.Green; + this.label8.Location = new System.Drawing.Point(392, 9); + this.label8.Name = "label8"; + this.label8.Size = new System.Drawing.Size(37, 30); + this.label8.TabIndex = 12; + this.label8.Text = "请放\r\n新卡"; + // + // label7 + // + this.label7.AutoSize = true; + this.label7.ForeColor = System.Drawing.Color.Green; + this.label7.Location = new System.Drawing.Point(84, 50); + this.label7.Name = "label7"; + this.label7.Size = new System.Drawing.Size(37, 30); + this.label7.TabIndex = 11; + this.label7.Text = "请放\r\n原卡"; + // + // label6 + // + this.label6.AutoSize = true; + this.label6.Location = new System.Drawing.Point(574, 101); + this.label6.Name = "label6"; + this.label6.Size = new System.Drawing.Size(159, 15); + this.label6.TabIndex = 10; + this.label6.Text = ">>> 尝试一下是否成功"; + // + // label4 + // + this.label4.AutoSize = true; + this.label4.Location = new System.Drawing.Point(387, 41); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(47, 15); + this.label4.TabIndex = 8; + this.label4.Text = ">>>>>"; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(214, 29); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(31, 15); + this.label3.TabIndex = 7; + this.label3.Text = ">>>"; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(97, 29); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(23, 15); + this.label2.TabIndex = 6; + this.label2.Text = ">>"; + // + // buttonECheckEncrypt + // + this.buttonECheckEncrypt.Location = new System.Drawing.Point(123, 55); + this.buttonECheckEncrypt.Name = "buttonECheckEncrypt"; + this.buttonECheckEncrypt.Size = new System.Drawing.Size(85, 25); + this.buttonECheckEncrypt.TabIndex = 5; + this.buttonECheckEncrypt.Text = "检测加密"; + this.buttonECheckEncrypt.UseVisualStyleBackColor = true; + this.buttonECheckEncrypt.Click += new System.EventHandler(this.buttonECheckEncrypt_Click); + // // buttonEAdv // this.buttonEAdv.Location = new System.Drawing.Point(574, 6); @@ -519,6 +587,16 @@ this.buttonEAdv.UseVisualStyleBackColor = true; this.buttonEAdv.Click += new System.EventHandler(this.buttonEAdv_Click); // + // buttoEScanCard + // + this.buttoEScanCard.Location = new System.Drawing.Point(123, 24); + this.buttoEScanCard.Name = "buttoEScanCard"; + this.buttoEScanCard.Size = new System.Drawing.Size(85, 25); + this.buttoEScanCard.TabIndex = 1; + this.buttoEScanCard.Text = "扫描卡片"; + this.buttoEScanCard.UseVisualStyleBackColor = true; + this.buttoEScanCard.Click += new System.EventHandler(this.buttoEScanCard_Click); + // // groupBox7 // this.groupBox7.Controls.Add(this.buttonECuidWrite); @@ -572,26 +650,6 @@ this.buttonEMfWrite.UseVisualStyleBackColor = true; this.buttonEMfWrite.Click += new System.EventHandler(this.buttonEMfWrite_Click); // - // buttonECheckEncrypt - // - this.buttonECheckEncrypt.Location = new System.Drawing.Point(123, 55); - this.buttonECheckEncrypt.Name = "buttonECheckEncrypt"; - this.buttonECheckEncrypt.Size = new System.Drawing.Size(85, 25); - this.buttonECheckEncrypt.TabIndex = 5; - this.buttonECheckEncrypt.Text = "检测加密"; - this.buttonECheckEncrypt.UseVisualStyleBackColor = true; - this.buttonECheckEncrypt.Click += new System.EventHandler(this.buttonECheckEncrypt_Click); - // - // buttoEScanCard - // - this.buttoEScanCard.Location = new System.Drawing.Point(123, 24); - this.buttoEScanCard.Name = "buttoEScanCard"; - this.buttoEScanCard.Size = new System.Drawing.Size(85, 25); - this.buttoEScanCard.TabIndex = 1; - this.buttoEScanCard.Text = "扫描卡片"; - this.buttoEScanCard.UseVisualStyleBackColor = true; - this.buttoEScanCard.Click += new System.EventHandler(this.buttoEScanCard_Click); - // // buttonEscan // this.buttonEscan.Location = new System.Drawing.Point(8, 24); @@ -616,6 +674,16 @@ this.groupBox5.TabStop = false; this.groupBox5.Text = "[2]读取原卡"; // + // buttonEReadUID + // + this.buttonEReadUID.Location = new System.Drawing.Point(6, 49); + this.buttonEReadUID.Name = "buttonEReadUID"; + this.buttonEReadUID.Size = new System.Drawing.Size(116, 25); + this.buttonEReadUID.TabIndex = 3; + this.buttonEReadUID.Text = "从UID卡读回"; + this.buttonEReadUID.UseVisualStyleBackColor = true; + this.buttonEReadUID.Click += new System.EventHandler(this.buttonEReadUID_Click); + // // buttonESelectKey // this.buttonESelectKey.Location = new System.Drawing.Point(6, 109); @@ -656,6 +724,17 @@ this.buttonEMfoc.UseVisualStyleBackColor = true; this.buttonEMfoc.Click += new System.EventHandler(this.buttonEMfoc_Click); // + // label5 + // + this.label5.AutoSize = true; + this.label5.ForeColor = System.Drawing.Color.Blue; + this.label5.Location = new System.Drawing.Point(8, 6); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(232, 165); + this.label5.TabIndex = 9; + this.label5.Text = "从这里开始\r\n\r\n\r\n\r\n\r\n\r\n\r\n本工具仅支持SAK=08/18/28的\r\n卡片复制。\r\n若要复制S70卡片,请在高级界\r\n面上取消勾选“数据写入保护”。\r\n" + + ""; + // // tabPage1 // this.tabPage1.Controls.Add(this.groupBox10); @@ -734,6 +813,135 @@ this.groupBox8.TabStop = false; this.groupBox8.Text = "UID/UFUID卡操作"; // + // tabPage3 + // + this.tabPage3.Controls.Add(this.groupBox13); + this.tabPage3.Controls.Add(this.groupBox12); + this.tabPage3.Controls.Add(this.groupBox6); + this.tabPage3.Location = new System.Drawing.Point(4, 25); + this.tabPage3.Name = "tabPage3"; + this.tabPage3.Size = new System.Drawing.Size(759, 183); + this.tabPage3.TabIndex = 2; + this.tabPage3.Text = "软件设置"; + this.tabPage3.UseVisualStyleBackColor = true; + // + // groupBox12 + // + this.groupBox12.Controls.Add(this.numericCLIFontSize); + this.groupBox12.Controls.Add(this.label10); + this.groupBox12.Controls.Add(this.buttonCLIColor); + this.groupBox12.Controls.Add(this.label9); + this.groupBox12.Location = new System.Drawing.Point(209, 3); + this.groupBox12.Name = "groupBox12"; + this.groupBox12.Size = new System.Drawing.Size(200, 80); + this.groupBox12.TabIndex = 12; + this.groupBox12.TabStop = false; + this.groupBox12.Text = "界面设置"; + // + // numericCLIFontSize + // + this.numericCLIFontSize.DecimalPlaces = 1; + this.numericCLIFontSize.Location = new System.Drawing.Point(109, 47); + this.numericCLIFontSize.Maximum = new decimal(new int[] { + 36, + 0, + 0, + 0}); + this.numericCLIFontSize.Minimum = new decimal(new int[] { + 7, + 0, + 0, + 0}); + this.numericCLIFontSize.Name = "numericCLIFontSize"; + this.numericCLIFontSize.Size = new System.Drawing.Size(85, 25); + this.numericCLIFontSize.TabIndex = 16; + this.numericCLIFontSize.Value = new decimal(new int[] { + 9, + 0, + 0, + 0}); + this.numericCLIFontSize.ValueChanged += new System.EventHandler(this.numericCLIFontSize_ValueChanged); + // + // label10 + // + this.label10.AutoSize = true; + this.label10.Location = new System.Drawing.Point(6, 50); + this.label10.Name = "label10"; + this.label10.Size = new System.Drawing.Size(97, 15); + this.label10.TabIndex = 15; + this.label10.Text = "终端文字大小"; + // + // buttonCLIColor + // + this.buttonCLIColor.BackColor = System.Drawing.Color.Black; + this.buttonCLIColor.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.buttonCLIColor.ForeColor = System.Drawing.Color.Lime; + this.buttonCLIColor.Location = new System.Drawing.Point(109, 16); + this.buttonCLIColor.Name = "buttonCLIColor"; + this.buttonCLIColor.Size = new System.Drawing.Size(85, 25); + this.buttonCLIColor.TabIndex = 14; + this.buttonCLIColor.Text = "#M1T#"; + this.buttonCLIColor.UseVisualStyleBackColor = false; + this.buttonCLIColor.Click += new System.EventHandler(this.buttonCLIColor_Click); + // + // label9 + // + this.label9.AutoSize = true; + this.label9.Location = new System.Drawing.Point(6, 21); + this.label9.Name = "label9"; + this.label9.Size = new System.Drawing.Size(97, 15); + this.label9.TabIndex = 13; + this.label9.Text = "终端文字颜色"; + // + // checkBoxWriteProtect + // + this.checkBoxWriteProtect.AutoSize = true; + this.checkBoxWriteProtect.Checked = true; + this.checkBoxWriteProtect.CheckState = System.Windows.Forms.CheckState.Checked; + this.checkBoxWriteProtect.Location = new System.Drawing.Point(6, 74); + this.checkBoxWriteProtect.Name = "checkBoxWriteProtect"; + this.checkBoxWriteProtect.Size = new System.Drawing.Size(165, 19); + this.checkBoxWriteProtect.TabIndex = 11; + this.checkBoxWriteProtect.Text = "数据写入保护(建议)"; + this.checkBoxWriteProtect.UseVisualStyleBackColor = true; + this.checkBoxWriteProtect.CheckedChanged += new System.EventHandler(this.checkBoxWriteProtect_CheckedChanged); + // + // groupBox6 + // + this.groupBox6.Controls.Add(this.checkBoxWriteProtect); + this.groupBox6.Controls.Add(this.checkBoxAutoLoadKey); + this.groupBox6.Controls.Add(this.checkBoxAutoABN); + this.groupBox6.Location = new System.Drawing.Point(3, 3); + this.groupBox6.Name = "groupBox6"; + this.groupBox6.Size = new System.Drawing.Size(200, 100); + this.groupBox6.TabIndex = 0; + this.groupBox6.TabStop = false; + this.groupBox6.Text = "卡操作相关"; + // + // checkBoxAutoLoadKey + // + this.checkBoxAutoLoadKey.AutoSize = true; + this.checkBoxAutoLoadKey.Location = new System.Drawing.Point(6, 49); + this.checkBoxAutoLoadKey.Name = "checkBoxAutoLoadKey"; + this.checkBoxAutoLoadKey.Size = new System.Drawing.Size(175, 19); + this.checkBoxAutoLoadKey.TabIndex = 12; + this.checkBoxAutoLoadKey.Text = "自动加载uid.Key文件"; + this.checkBoxAutoLoadKey.UseVisualStyleBackColor = true; + this.checkBoxAutoLoadKey.CheckedChanged += new System.EventHandler(this.checkBoxAutoLoadKey_CheckedChanged); + // + // checkBoxAutoABN + // + this.checkBoxAutoABN.AutoSize = true; + this.checkBoxAutoABN.Checked = true; + this.checkBoxAutoABN.CheckState = System.Windows.Forms.CheckState.Checked; + this.checkBoxAutoABN.Location = new System.Drawing.Point(6, 24); + this.checkBoxAutoABN.Name = "checkBoxAutoABN"; + this.checkBoxAutoABN.Size = new System.Drawing.Size(161, 19); + this.checkBoxAutoABN.TabIndex = 2; + this.checkBoxAutoABN.Text = "自动判断Key(beta)"; + this.checkBoxAutoABN.UseVisualStyleBackColor = true; + this.checkBoxAutoABN.CheckedChanged += new System.EventHandler(this.checkBoxAutoABN_CheckedChanged); + // // statusStrip1 // this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { @@ -791,108 +999,26 @@ this.timer1.Enabled = true; this.timer1.Tick += new System.EventHandler(this.timer1_Tick); // - // checkBoxAutoABN + // groupBox13 // - this.checkBoxAutoABN.AutoSize = true; - this.checkBoxAutoABN.Checked = true; - this.checkBoxAutoABN.CheckState = System.Windows.Forms.CheckState.Checked; - this.checkBoxAutoABN.Location = new System.Drawing.Point(120, 25); - this.checkBoxAutoABN.Name = "checkBoxAutoABN"; - this.checkBoxAutoABN.Size = new System.Drawing.Size(161, 19); - this.checkBoxAutoABN.TabIndex = 2; - this.checkBoxAutoABN.Text = "自动判断Key(beta)"; - this.checkBoxAutoABN.UseVisualStyleBackColor = true; - this.checkBoxAutoABN.CheckedChanged += new System.EventHandler(this.checkBoxAutoABN_CheckedChanged); + this.groupBox13.Controls.Add(this.checkBoxDefIsAdv); + this.groupBox13.Location = new System.Drawing.Point(3, 109); + this.groupBox13.Name = "groupBox13"; + this.groupBox13.Size = new System.Drawing.Size(200, 71); + this.groupBox13.TabIndex = 13; + this.groupBox13.TabStop = false; + this.groupBox13.Text = "偏好设置"; // - // buttonEReadUID + // checkBoxDefIsAdv // - this.buttonEReadUID.Location = new System.Drawing.Point(6, 49); - this.buttonEReadUID.Name = "buttonEReadUID"; - this.buttonEReadUID.Size = new System.Drawing.Size(116, 25); - this.buttonEReadUID.TabIndex = 3; - this.buttonEReadUID.Text = "从UID卡读回"; - this.buttonEReadUID.UseVisualStyleBackColor = true; - this.buttonEReadUID.Click += new System.EventHandler(this.buttonEReadUID_Click); - // - // label2 - // - this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(97, 29); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(23, 15); - this.label2.TabIndex = 6; - this.label2.Text = ">>"; - // - // label3 - // - this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(214, 29); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(31, 15); - this.label3.TabIndex = 7; - this.label3.Text = ">>>"; - // - // label4 - // - this.label4.AutoSize = true; - this.label4.Location = new System.Drawing.Point(387, 41); - this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(47, 15); - this.label4.TabIndex = 8; - this.label4.Text = ">>>>>"; - // - // label5 - // - this.label5.AutoSize = true; - this.label5.ForeColor = System.Drawing.Color.Blue; - this.label5.Location = new System.Drawing.Point(8, 6); - this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size(232, 165); - this.label5.TabIndex = 9; - this.label5.Text = "从这里开始\r\n\r\n\r\n\r\n\r\n\r\n\r\n本工具仅支持SAK=08/18/28的\r\n卡片复制。\r\n若要复制S70卡片,请在高级界\r\n面上取消勾选“数据写入保护”。\r\n" + - ""; - // - // label6 - // - this.label6.AutoSize = true; - this.label6.Location = new System.Drawing.Point(574, 101); - this.label6.Name = "label6"; - this.label6.Size = new System.Drawing.Size(159, 15); - this.label6.TabIndex = 10; - this.label6.Text = ">>> 尝试一下是否成功"; - // - // checkBoxWriteProtect - // - this.checkBoxWriteProtect.AutoSize = true; - this.checkBoxWriteProtect.Checked = true; - this.checkBoxWriteProtect.CheckState = System.Windows.Forms.CheckState.Checked; - this.checkBoxWriteProtect.Location = new System.Drawing.Point(120, 55); - this.checkBoxWriteProtect.Name = "checkBoxWriteProtect"; - this.checkBoxWriteProtect.Size = new System.Drawing.Size(165, 19); - this.checkBoxWriteProtect.TabIndex = 11; - this.checkBoxWriteProtect.Text = "数据写入保护(建议)"; - this.checkBoxWriteProtect.UseVisualStyleBackColor = true; - this.checkBoxWriteProtect.CheckedChanged += new System.EventHandler(this.checkBoxWriteProtect_CheckedChanged); - // - // label7 - // - this.label7.AutoSize = true; - this.label7.ForeColor = System.Drawing.Color.Green; - this.label7.Location = new System.Drawing.Point(84, 50); - this.label7.Name = "label7"; - this.label7.Size = new System.Drawing.Size(37, 30); - this.label7.TabIndex = 11; - this.label7.Text = "请放\r\n原卡"; - // - // label8 - // - this.label8.AutoSize = true; - this.label8.ForeColor = System.Drawing.Color.Green; - this.label8.Location = new System.Drawing.Point(392, 9); - this.label8.Name = "label8"; - this.label8.Size = new System.Drawing.Size(37, 30); - this.label8.TabIndex = 12; - this.label8.Text = "请放\r\n新卡"; + this.checkBoxDefIsAdv.AutoSize = true; + this.checkBoxDefIsAdv.Location = new System.Drawing.Point(9, 24); + this.checkBoxDefIsAdv.Name = "checkBoxDefIsAdv"; + this.checkBoxDefIsAdv.Size = new System.Drawing.Size(179, 19); + this.checkBoxDefIsAdv.TabIndex = 0; + this.checkBoxDefIsAdv.Text = "自动转到高级操作模式"; + this.checkBoxDefIsAdv.UseVisualStyleBackColor = true; + this.checkBoxDefIsAdv.CheckedChanged += new System.EventHandler(this.checkBoxDefIsAdv_CheckedChanged); // // Form1 // @@ -912,7 +1038,6 @@ this.groupBox2.ResumeLayout(false); this.groupBox3.ResumeLayout(false); this.groupBox4.ResumeLayout(false); - this.groupBox4.PerformLayout(); this.tabControl1.ResumeLayout(false); this.tabPage2.ResumeLayout(false); this.tabPage2.PerformLayout(); @@ -923,8 +1048,16 @@ this.groupBox9.ResumeLayout(false); this.groupBox9.PerformLayout(); this.groupBox8.ResumeLayout(false); + this.tabPage3.ResumeLayout(false); + this.groupBox12.ResumeLayout(false); + this.groupBox12.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.numericCLIFontSize)).EndInit(); + this.groupBox6.ResumeLayout(false); + this.groupBox6.PerformLayout(); this.statusStrip1.ResumeLayout(false); this.statusStrip1.PerformLayout(); + this.groupBox13.ResumeLayout(false); + this.groupBox13.PerformLayout(); this.ResumeLayout(false); this.PerformLayout(); @@ -991,8 +1124,6 @@ private System.Windows.Forms.ToolStripSplitButton toolStripCheckUpdate; private System.Windows.Forms.Button buttonDictMfoc; private System.Windows.Forms.Button buttonnKeysMfoc; - private System.Windows.Forms.Button buttonSniffDev; - private System.Windows.Forms.CheckBox checkBoxAutoABN; private System.Windows.Forms.Button buttonEReadUID; private System.Windows.Forms.CheckBox checkBoxWriteProtect; private System.Windows.Forms.Label label6; @@ -1002,6 +1133,17 @@ private System.Windows.Forms.Label label5; private System.Windows.Forms.Label label8; private System.Windows.Forms.Label label7; + private System.Windows.Forms.CheckBox checkBoxAutoABN; + private System.Windows.Forms.TabPage tabPage3; + private System.Windows.Forms.GroupBox groupBox6; + private System.Windows.Forms.CheckBox checkBoxAutoLoadKey; + private System.Windows.Forms.GroupBox groupBox12; + private System.Windows.Forms.Button buttonCLIColor; + private System.Windows.Forms.Label label9; + private System.Windows.Forms.NumericUpDown numericCLIFontSize; + private System.Windows.Forms.Label label10; + private System.Windows.Forms.GroupBox groupBox13; + private System.Windows.Forms.CheckBox checkBoxDefIsAdv; } } diff --git a/MifareOneTool/Form1.cs b/MifareOneTool/Form1.cs index 1622120..b86b3c6 100644 --- a/MifareOneTool/Form1.cs +++ b/MifareOneTool/Form1.cs @@ -117,8 +117,17 @@ namespace MifareOneTool //GitHubUpdate ghu = new GitHubUpdate(Properties.Settings.Default.GitHubR); //ghu.Update(Properties.Settings.Default.GitHubR); //remoteVersionLabel.Text = "远程版本 " + ghu.remoteVersion; + Directory.CreateDirectory("auto_keys"); checkBoxAutoABN.Checked = Properties.Settings.Default.AutoABN; checkBoxWriteProtect.Checked = Properties.Settings.Default.WriteCheck; + checkBoxAutoLoadKey.Checked = Properties.Settings.Default.AutoLoadUidKey; + richTextBox1.ForeColor = Properties.Settings.Default.MainCLIColor; + buttonCLIColor.ForeColor = Properties.Settings.Default.MainCLIColor; + checkBoxDefIsAdv.Checked = Properties.Settings.Default.DefIsAdv; + if (Properties.Settings.Default.DefIsAdv) + { + tabControl1.SelectedIndex = 1; + } } private void buttonScanCard_Click(object sender, EventArgs e) @@ -154,12 +163,62 @@ namespace MifareOneTool string omfd = ""; + private string GetUID() + { + ProcessStartInfo psi = new ProcessStartInfo("nfc-bin/nfc-list.exe"); + psi.CreateNoWindow = true; + psi.UseShellExecute = false; + psi.RedirectStandardOutput = true; + psi.RedirectStandardError = true; + Process p = Process.Start(psi); + p.WaitForExit(); + string rawStr = p.StandardOutput.ReadToEnd(); + string uid; + string pattern = @"UID\s\(NFCID1\)\: ([0-9A-Fa-f]{2}\s\s[0-9A-Fa-f]{2}\s\s[0-9A-Fa-f]{2}\s\s[0-9A-Fa-f]{2})"; + if (Regex.IsMatch(rawStr, pattern)) + { + uid = Regex.Match(rawStr, pattern).Captures[0].Value.Replace(" ", "").Replace("UID(NFCID1):",""); ; + } + else + { + uid = ""; + } + return uid; + } + private void LoadUidKey(string uid) + { + if (!Directory.Exists("auto_keys")) + { + Directory.CreateDirectory("auto_keys"); + return; + } + if (uid.Length < 8) { return; } + logAppend("正在检索是否存在key.mfd…"); + List files = Directory.EnumerateFiles("auto_keys", "*.mfd").ToList(); + for (int i = 0; i < files.Count; i++) + { + if (files[i].StartsWith("auto_keys\\" + uid)) + { + logAppend("已找到!K=" + files[i]); + keymfd = files[i]; + buttonSelectKey.Text = "K=" + files[i]; + return; + } + } + return; + } + private void buttonMfRead_Click(object sender, EventArgs e) { if (lprocess) { MessageBox.Show("有任务运行中,不可执行。", "设备忙", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } Form1.ActiveForm.Text = "MifareOne Tool - 运行中"; string rmfd = "MfRead.tmp"; string kt = "A"; string nn = ""; + if (checkBoxAutoLoadKey.Checked) + { + string uid = GetUID(); + LoadUidKey(uid); + } if (checkBoxAutoABN.Checked && keymfd != "") { kt = "C"; @@ -906,7 +965,7 @@ namespace MifareOneTool private void buttonEAdv_Click(object sender, EventArgs e) { - tabControl1.SelectedIndex = tabControl1.TabPages.Count - 1; + tabControl1.SelectedIndex = 1; } private void buttonEnAcr122u_Click(object sender, EventArgs e) @@ -1160,5 +1219,34 @@ namespace MifareOneTool b.ReportProgress(100, "##运行出错##"); } } + + private void checkBoxAutoLoadKey_CheckedChanged(object sender, EventArgs e) + { + Properties.Settings.Default.AutoLoadUidKey = checkBoxAutoLoadKey.Checked; + } + + private void buttonCLIColor_Click(object sender, EventArgs e) + { + ColorDialog cd = new ColorDialog(); + cd.AllowFullOpen = true; + cd.AnyColor = true; + if (cd.ShowDialog() == DialogResult.OK) + { + richTextBox1.ForeColor = cd.Color; + buttonCLIColor.ForeColor = cd.Color; + Properties.Settings.Default.MainCLIColor = cd.Color; + } + } + + private void numericCLIFontSize_ValueChanged(object sender, EventArgs e) + { + richTextBox1.Font = new Font(richTextBox1.Font.FontFamily, (float)numericCLIFontSize.Value); + Properties.Settings.Default.MainCLIFontSize = (float)numericCLIFontSize.Value; + } + + private void checkBoxDefIsAdv_CheckedChanged(object sender, EventArgs e) + { + Properties.Settings.Default.DefIsAdv = checkBoxDefIsAdv.Checked; + } } } diff --git a/MifareOneTool/Properties/AssemblyInfo.cs b/MifareOneTool/Properties/AssemblyInfo.cs index 565ca6b..c19822e 100644 --- a/MifareOneTool/Properties/AssemblyInfo.cs +++ b/MifareOneTool/Properties/AssemblyInfo.cs @@ -11,7 +11,7 @@ using System.Runtime.InteropServices; [assembly: AssemblyCompany("XciCode")] [assembly: AssemblyProduct("MifareOneTool")] [assembly: AssemblyCopyright("Copyright © XciCode 2018")] -[assembly: AssemblyTrademark("")] +[assembly: AssemblyTrademark("M1T")] [assembly: AssemblyCulture("")] // 将 ComVisible 设置为 false 使此程序集中的类型 @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; // 可以指定所有这些值,也可以使用“内部版本号”和“修订号”的默认值, // 方法是按如下所示使用“*”: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.6.2.0")] -[assembly: AssemblyFileVersion("1.6.2.0")] +[assembly: AssemblyVersion("1.6.3.0")] +[assembly: AssemblyFileVersion("1.6.3.0")] diff --git a/MifareOneTool/Properties/Settings.Designer.cs b/MifareOneTool/Properties/Settings.Designer.cs index 4ec7d75..8ee28c2 100644 --- a/MifareOneTool/Properties/Settings.Designer.cs +++ b/MifareOneTool/Properties/Settings.Designer.cs @@ -55,5 +55,53 @@ namespace MifareOneTool.Properties { this["WriteCheck"] = value; } } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("False")] + public bool AutoLoadUidKey { + get { + return ((bool)(this["AutoLoadUidKey"])); + } + set { + this["AutoLoadUidKey"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("Lime")] + public global::System.Drawing.Color MainCLIColor { + get { + return ((global::System.Drawing.Color)(this["MainCLIColor"])); + } + set { + this["MainCLIColor"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("9")] + public float MainCLIFontSize { + get { + return ((float)(this["MainCLIFontSize"])); + } + set { + this["MainCLIFontSize"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("False")] + public bool DefIsAdv { + get { + return ((bool)(this["DefIsAdv"])); + } + set { + this["DefIsAdv"] = value; + } + } } } diff --git a/MifareOneTool/Properties/Settings.settings b/MifareOneTool/Properties/Settings.settings index cee5fe2..559f313 100644 --- a/MifareOneTool/Properties/Settings.settings +++ b/MifareOneTool/Properties/Settings.settings @@ -11,5 +11,17 @@ True + + False + + + Lime + + + 9 + + + False + \ No newline at end of file diff --git a/MifareOneTool/app.config b/MifareOneTool/app.config index 3365d21..42c64cd 100644 --- a/MifareOneTool/app.config +++ b/MifareOneTool/app.config @@ -23,6 +23,18 @@ True + + False + + + Lime + + + 9 + + + False + \ No newline at end of file