final commit

This commit is contained in:
XAS-712 2019-02-10 17:19:44 +08:00
parent f887577006
commit 12865bc975
6 changed files with 146 additions and 59 deletions

View File

@ -91,13 +91,15 @@
this.label1 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label();
this.groupBox8 = new System.Windows.Forms.GroupBox(); this.groupBox8 = new System.Windows.Forms.GroupBox();
this.tabPage3 = new System.Windows.Forms.TabPage(); this.tabPage3 = new System.Windows.Forms.TabPage();
this.groupBox13 = new System.Windows.Forms.GroupBox();
this.checkBoxDefIsAdv = new System.Windows.Forms.CheckBox();
this.groupBox12 = new System.Windows.Forms.GroupBox(); this.groupBox12 = new System.Windows.Forms.GroupBox();
this.numericCLIFontSize = new System.Windows.Forms.NumericUpDown(); this.numericCLIFontSize = new System.Windows.Forms.NumericUpDown();
this.label10 = new System.Windows.Forms.Label(); this.label10 = new System.Windows.Forms.Label();
this.buttonCLIColor = new System.Windows.Forms.Button(); this.buttonCLIColor = new System.Windows.Forms.Button();
this.label9 = new System.Windows.Forms.Label(); this.label9 = new System.Windows.Forms.Label();
this.checkBoxWriteProtect = new System.Windows.Forms.CheckBox();
this.groupBox6 = new System.Windows.Forms.GroupBox(); this.groupBox6 = new System.Windows.Forms.GroupBox();
this.checkBoxWriteProtect = new System.Windows.Forms.CheckBox();
this.checkBoxAutoLoadKey = new System.Windows.Forms.CheckBox(); this.checkBoxAutoLoadKey = new System.Windows.Forms.CheckBox();
this.checkBoxAutoABN = new System.Windows.Forms.CheckBox(); this.checkBoxAutoABN = new System.Windows.Forms.CheckBox();
this.statusStrip1 = new System.Windows.Forms.StatusStrip(); this.statusStrip1 = new System.Windows.Forms.StatusStrip();
@ -107,8 +109,7 @@
this.remoteVersionLabel = new System.Windows.Forms.ToolStripStatusLabel(); this.remoteVersionLabel = new System.Windows.Forms.ToolStripStatusLabel();
this.toolStripCheckUpdate = new System.Windows.Forms.ToolStripSplitButton(); this.toolStripCheckUpdate = new System.Windows.Forms.ToolStripSplitButton();
this.timer1 = new System.Windows.Forms.Timer(this.components); this.timer1 = new System.Windows.Forms.Timer(this.components);
this.groupBox13 = new System.Windows.Forms.GroupBox(); this.checkBoxAutoSave = new System.Windows.Forms.CheckBox();
this.checkBoxDefIsAdv = new System.Windows.Forms.CheckBox();
this.groupBox1.SuspendLayout(); this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout(); this.groupBox2.SuspendLayout();
this.groupBox3.SuspendLayout(); this.groupBox3.SuspendLayout();
@ -122,11 +123,11 @@
this.groupBox9.SuspendLayout(); this.groupBox9.SuspendLayout();
this.groupBox8.SuspendLayout(); this.groupBox8.SuspendLayout();
this.tabPage3.SuspendLayout(); this.tabPage3.SuspendLayout();
this.groupBox13.SuspendLayout();
this.groupBox12.SuspendLayout(); this.groupBox12.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.numericCLIFontSize)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.numericCLIFontSize)).BeginInit();
this.groupBox6.SuspendLayout(); this.groupBox6.SuspendLayout();
this.statusStrip1.SuspendLayout(); this.statusStrip1.SuspendLayout();
this.groupBox13.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
// groupBox1 // groupBox1
@ -732,8 +733,8 @@
this.label5.Name = "label5"; this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(232, 165); this.label5.Size = new System.Drawing.Size(232, 165);
this.label5.TabIndex = 9; 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" + this.label5.Text = "从这里开始\r\n\r\n\r\n\r\n\r\n\r\n\r\n本工具仅支持SAK=08/18/28的\r\n卡片复制。SAK28无一键解密。\r\n若要复制S70卡片请在高级界\r\n面上取消勾选" +
""; "“数据写入保护”。\r\n";
// //
// tabPage1 // tabPage1
// //
@ -825,6 +826,28 @@
this.tabPage3.Text = "软件设置"; this.tabPage3.Text = "软件设置";
this.tabPage3.UseVisualStyleBackColor = true; this.tabPage3.UseVisualStyleBackColor = true;
// //
// groupBox13
//
this.groupBox13.Controls.Add(this.checkBoxAutoSave);
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 = "偏好设置";
//
// checkBoxDefIsAdv
//
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);
//
// groupBox12 // groupBox12
// //
this.groupBox12.Controls.Add(this.numericCLIFontSize); this.groupBox12.Controls.Add(this.numericCLIFontSize);
@ -893,6 +916,18 @@
this.label9.TabIndex = 13; this.label9.TabIndex = 13;
this.label9.Text = "终端文字颜色"; this.label9.Text = "终端文字颜色";
// //
// 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 = "卡操作相关";
//
// checkBoxWriteProtect // checkBoxWriteProtect
// //
this.checkBoxWriteProtect.AutoSize = true; this.checkBoxWriteProtect.AutoSize = true;
@ -906,18 +941,6 @@
this.checkBoxWriteProtect.UseVisualStyleBackColor = true; this.checkBoxWriteProtect.UseVisualStyleBackColor = true;
this.checkBoxWriteProtect.CheckedChanged += new System.EventHandler(this.checkBoxWriteProtect_CheckedChanged); 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 // checkBoxAutoLoadKey
// //
this.checkBoxAutoLoadKey.AutoSize = true; this.checkBoxAutoLoadKey.AutoSize = true;
@ -999,26 +1022,16 @@
this.timer1.Enabled = true; this.timer1.Enabled = true;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick); this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
// //
// groupBox13 // checkBoxAutoSave
// //
this.groupBox13.Controls.Add(this.checkBoxDefIsAdv); this.checkBoxAutoSave.AutoSize = true;
this.groupBox13.Location = new System.Drawing.Point(3, 109); this.checkBoxAutoSave.Location = new System.Drawing.Point(9, 46);
this.groupBox13.Name = "groupBox13"; this.checkBoxAutoSave.Name = "checkBoxAutoSave";
this.groupBox13.Size = new System.Drawing.Size(200, 71); this.checkBoxAutoSave.Size = new System.Drawing.Size(173, 19);
this.groupBox13.TabIndex = 13; this.checkBoxAutoSave.TabIndex = 1;
this.groupBox13.TabStop = false; this.checkBoxAutoSave.Text = "自动以UID名保存文件";
this.groupBox13.Text = "偏好设置"; this.checkBoxAutoSave.UseVisualStyleBackColor = true;
// this.checkBoxAutoSave.CheckedChanged += new System.EventHandler(this.checkBoxAutoSave_CheckedChanged);
// checkBoxDefIsAdv
//
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 // Form1
// //
@ -1033,6 +1046,7 @@
this.MaximizeBox = false; this.MaximizeBox = false;
this.Name = "Form1"; this.Name = "Form1";
this.Text = "MifareOne Tool"; this.Text = "MifareOne Tool";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form1_FormClosing);
this.Load += new System.EventHandler(this.Form1_Load); this.Load += new System.EventHandler(this.Form1_Load);
this.groupBox1.ResumeLayout(false); this.groupBox1.ResumeLayout(false);
this.groupBox2.ResumeLayout(false); this.groupBox2.ResumeLayout(false);
@ -1049,6 +1063,8 @@
this.groupBox9.PerformLayout(); this.groupBox9.PerformLayout();
this.groupBox8.ResumeLayout(false); this.groupBox8.ResumeLayout(false);
this.tabPage3.ResumeLayout(false); this.tabPage3.ResumeLayout(false);
this.groupBox13.ResumeLayout(false);
this.groupBox13.PerformLayout();
this.groupBox12.ResumeLayout(false); this.groupBox12.ResumeLayout(false);
this.groupBox12.PerformLayout(); this.groupBox12.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.numericCLIFontSize)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.numericCLIFontSize)).EndInit();
@ -1056,8 +1072,6 @@
this.groupBox6.PerformLayout(); this.groupBox6.PerformLayout();
this.statusStrip1.ResumeLayout(false); this.statusStrip1.ResumeLayout(false);
this.statusStrip1.PerformLayout(); this.statusStrip1.PerformLayout();
this.groupBox13.ResumeLayout(false);
this.groupBox13.PerformLayout();
this.ResumeLayout(false); this.ResumeLayout(false);
this.PerformLayout(); this.PerformLayout();
@ -1144,6 +1158,7 @@
private System.Windows.Forms.Label label10; private System.Windows.Forms.Label label10;
private System.Windows.Forms.GroupBox groupBox13; private System.Windows.Forms.GroupBox groupBox13;
private System.Windows.Forms.CheckBox checkBoxDefIsAdv; private System.Windows.Forms.CheckBox checkBoxDefIsAdv;
private System.Windows.Forms.CheckBox checkBoxAutoSave;
} }
} }

View File

@ -47,33 +47,55 @@ namespace MifareOneTool
} }
else if (e.ProgressPercentage == 101) else if (e.ProgressPercentage == 101)
{ {
SaveFileDialog ofd = new SaveFileDialog(); if (lastuid != "")
ofd.AddExtension = true;
ofd.DefaultExt = ".mfd";
ofd.Title = "请选择MFD文件保存位置及文件名";
ofd.OverwritePrompt = true;
ofd.Filter = "MFD文件|*.mfd|DUMP文件|*.dump";
if (File.Exists(omfd) && new FileInfo(omfd).Length > 1)
{ {
if (ofd.ShowDialog() == DialogResult.OK) if (File.Exists(omfd) && new FileInfo(omfd).Length > 1)
{ {
if (File.Exists(ofd.FileName)) string filename = lastuid + "_" + DateTime.Now.ToString() + ".mfd";
if (File.Exists(filename))
{ {
File.Delete(ofd.FileName); File.Delete(filename);
} }
File.Move(omfd, ofd.FileName); File.Move(omfd, filename);
logAppend("##已保存-" + ofd.FileName + "##"); logAppend("##已自动保存-" + filename + "##");
} }
else else
{ {
File.Delete(omfd); File.Delete(omfd);
logAppend("##未保存##"); logAppend("##缓存文件异常##");
} }
lastuid = "";
} }
else else
{ {
File.Delete(omfd); SaveFileDialog ofd = new SaveFileDialog();
logAppend("##缓存文件异常##"); ofd.AddExtension = true;
ofd.DefaultExt = ".mfd";
ofd.Title = "请选择MFD文件保存位置及文件名";
ofd.OverwritePrompt = true;
ofd.Filter = "MFD文件|*.mfd|DUMP文件|*.dump";
if (File.Exists(omfd) && new FileInfo(omfd).Length > 1)
{
if (ofd.ShowDialog() == DialogResult.OK)
{
if (File.Exists(ofd.FileName))
{
File.Delete(ofd.FileName);
}
File.Move(omfd, ofd.FileName);
logAppend("##已保存-" + ofd.FileName + "##");
}
else
{
File.Delete(omfd);
logAppend("##未保存##");
}
}
else
{
File.Delete(omfd);
logAppend("##缓存文件异常##");
}
} }
omfd = ""; omfd = "";
Text = "MifareOne Tool - 运行完毕"; Text = "MifareOne Tool - 运行完毕";
@ -177,7 +199,7 @@ namespace MifareOneTool
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})"; 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)) if (Regex.IsMatch(rawStr, pattern))
{ {
uid = Regex.Match(rawStr, pattern).Captures[0].Value.Replace(" ", "").Replace("UID(NFCID1):",""); ; uid = Regex.Match(rawStr, pattern).Captures[0].Value.Replace(" ", "").Replace("UID(NFCID1):", ""); ;
} }
else else
{ {
@ -208,17 +230,24 @@ namespace MifareOneTool
return; return;
} }
string lastuid = "";
private void buttonMfRead_Click(object sender, EventArgs e) private void buttonMfRead_Click(object sender, EventArgs e)
{ {
if (lprocess) { MessageBox.Show("有任务运行中,不可执行。", "设备忙", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } Form1.ActiveForm.Text = "MifareOne Tool - 运行中"; if (lprocess) { MessageBox.Show("有任务运行中,不可执行。", "设备忙", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } Form1.ActiveForm.Text = "MifareOne Tool - 运行中";
string rmfd = "MfRead.tmp"; string rmfd = "MfRead.tmp";
string kt = "A"; string kt = "A";
string nn = ""; string nn = "";
string uid;
if (checkBoxAutoLoadKey.Checked) if (checkBoxAutoLoadKey.Checked)
{ {
string uid = GetUID(); uid = GetUID();
LoadUidKey(uid); LoadUidKey(uid);
} }
if (checkBoxAutoSave.Checked)
{
lastuid = GetUID();
}
if (checkBoxAutoABN.Checked && keymfd != "") if (checkBoxAutoABN.Checked && keymfd != "")
{ {
kt = "C"; kt = "C";
@ -425,6 +454,10 @@ namespace MifareOneTool
} }
} }
} }
if (checkBoxAutoSave.Checked)
{
lastuid = GetUID();
}
BackgroundWorker bgw = new BackgroundWorker(); BackgroundWorker bgw = new BackgroundWorker();
bgw.DoWork += new DoWorkEventHandler(mfoc); bgw.DoWork += new DoWorkEventHandler(mfoc);
bgw.WorkerReportsProgress = true; bgw.WorkerReportsProgress = true;
@ -551,7 +584,10 @@ namespace MifareOneTool
{ {
if (lprocess) { MessageBox.Show("有任务运行中,不可执行。", "设备忙", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } Form1.ActiveForm.Text = "MifareOne Tool - 运行中"; if (lprocess) { MessageBox.Show("有任务运行中,不可执行。", "设备忙", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } Form1.ActiveForm.Text = "MifareOne Tool - 运行中";
string rmfd = "BmfRead.tmp"; string rmfd = "BmfRead.tmp";
if (checkBoxAutoSave.Checked)
{
lastuid = GetUID();
}
BackgroundWorker bgw = new BackgroundWorker(); BackgroundWorker bgw = new BackgroundWorker();
bgw.DoWork += new DoWorkEventHandler(bmf_read); bgw.DoWork += new DoWorkEventHandler(bmf_read);
bgw.WorkerReportsProgress = true; bgw.WorkerReportsProgress = true;
@ -1084,6 +1120,10 @@ namespace MifareOneTool
} }
} }
} }
if (checkBoxAutoSave.Checked)
{
lastuid = GetUID();
}
BackgroundWorker bgw = new BackgroundWorker(); BackgroundWorker bgw = new BackgroundWorker();
bgw.DoWork += new DoWorkEventHandler(mfoc); bgw.DoWork += new DoWorkEventHandler(mfoc);
bgw.WorkerReportsProgress = true; bgw.WorkerReportsProgress = true;
@ -1117,6 +1157,10 @@ namespace MifareOneTool
} }
string rmfd = "Mfoc.tmp"; string rmfd = "Mfoc.tmp";
string key = "-f " + filename + " "; string key = "-f " + filename + " ";
if (checkBoxAutoSave.Checked)
{
lastuid = GetUID();
}
BackgroundWorker bgw = new BackgroundWorker(); BackgroundWorker bgw = new BackgroundWorker();
bgw.DoWork += new DoWorkEventHandler(mfocCMD); bgw.DoWork += new DoWorkEventHandler(mfocCMD);
bgw.WorkerReportsProgress = true; bgw.WorkerReportsProgress = true;
@ -1248,5 +1292,15 @@ namespace MifareOneTool
{ {
Properties.Settings.Default.DefIsAdv = checkBoxDefIsAdv.Checked; Properties.Settings.Default.DefIsAdv = checkBoxDefIsAdv.Checked;
} }
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
Properties.Settings.Default.Save();
}
private void checkBoxAutoSave_CheckedChanged(object sender, EventArgs e)
{
Properties.Settings.Default.AutoSave = checkBoxAutoSave.Checked;
}
} }
} }

View File

@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// 可以指定所有这些值,也可以使用“内部版本号”和“修订号”的默认值, // 可以指定所有这些值,也可以使用“内部版本号”和“修订号”的默认值,
// 方法是按如下所示使用“*”: // 方法是按如下所示使用“*”:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.6.3.0")] [assembly: AssemblyVersion("1.6.4.0")]
[assembly: AssemblyFileVersion("1.6.3.0")] [assembly: AssemblyFileVersion("1.6.4.0")]

View File

@ -103,5 +103,17 @@ namespace MifareOneTool.Properties {
this["DefIsAdv"] = value; this["DefIsAdv"] = value;
} }
} }
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("False")]
public bool AutoSave {
get {
return ((bool)(this["AutoSave"]));
}
set {
this["AutoSave"] = value;
}
}
} }
} }

View File

@ -23,5 +23,8 @@
<Setting Name="DefIsAdv" Type="System.Boolean" Scope="User"> <Setting Name="DefIsAdv" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value> <Value Profile="(Default)">False</Value>
</Setting> </Setting>
<Setting Name="AutoSave" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
</Settings> </Settings>
</SettingsFile> </SettingsFile>

View File

@ -35,6 +35,9 @@
<setting name="DefIsAdv" serializeAs="String"> <setting name="DefIsAdv" serializeAs="String">
<value>False</value> <value>False</value>
</setting> </setting>
<setting name="AutoSave" serializeAs="String">
<value>False</value>
</setting>
</MifareOneTool.Properties.Settings> </MifareOneTool.Properties.Settings>
</userSettings> </userSettings>
</configuration> </configuration>