Update Form1.cs
This commit is contained in:
parent
e777de4afb
commit
06208d344f
@ -58,7 +58,8 @@ namespace MifareOneTool
|
||||
}
|
||||
}
|
||||
|
||||
private void logAppend(string msg){
|
||||
private void logAppend(string msg)
|
||||
{
|
||||
richTextBox1.AppendText(msg + "\n");
|
||||
richTextBox1.ScrollToCaret();
|
||||
}
|
||||
@ -138,15 +139,22 @@ namespace MifareOneTool
|
||||
return;
|
||||
}
|
||||
string kt = "a";
|
||||
if (MessageBox.Show("使用KeyA(是)或KeyB(否)?", "KeyA/B", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.No)
|
||||
string nn = "";
|
||||
switch (MessageBox.Show("使用KeyA(是)或KeyB(否),还是不使用(用于全新白卡)(取消)?", "KeyA/B/N", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Information))
|
||||
{
|
||||
case DialogResult.No:
|
||||
kt = "b";
|
||||
break;
|
||||
|
||||
case DialogResult.Cancel:
|
||||
nn = "x";
|
||||
break;
|
||||
}
|
||||
BackgroundWorker bgw = new BackgroundWorker();
|
||||
bgw.DoWork += new DoWorkEventHandler(mf_read);
|
||||
bgw.WorkerReportsProgress = true;
|
||||
bgw.ProgressChanged += new ProgressChangedEventHandler(default_rpt);
|
||||
bgw.RunWorkerAsync(new string[] {rmfd,kt});
|
||||
bgw.RunWorkerAsync(new string[] { rmfd, kt,nn });
|
||||
}
|
||||
|
||||
void mf_read(object sender, DoWorkEventArgs e)
|
||||
@ -155,7 +163,7 @@ namespace MifareOneTool
|
||||
ProcessStartInfo psi = new ProcessStartInfo("nfc-bin/nfc-mfclassic.exe");
|
||||
string[] args = (string[])e.Argument;
|
||||
psi.Arguments = "r " + args[1] + " u \"" + args[0] + "\"";
|
||||
if (keymfd != "")
|
||||
if (keymfd != "" && args[2]=="")
|
||||
{
|
||||
psi.Arguments += " \"" + keymfd + "\" f";
|
||||
}
|
||||
@ -215,15 +223,22 @@ namespace MifareOneTool
|
||||
return;
|
||||
}
|
||||
string kt = "a";
|
||||
if (MessageBox.Show("使用KeyA(是)或KeyB(否)?", "KeyA/B", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.No)
|
||||
string nn = "";
|
||||
switch (MessageBox.Show("使用KeyA(是)或KeyB(否),还是不使用(用于全新白卡)(取消)?", "KeyA/B/N", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Information))
|
||||
{
|
||||
case DialogResult.No:
|
||||
kt = "b";
|
||||
break;
|
||||
|
||||
case DialogResult.Cancel:
|
||||
nn="x";
|
||||
break;
|
||||
}
|
||||
BackgroundWorker bgw = new BackgroundWorker();
|
||||
bgw.DoWork += new DoWorkEventHandler(mf_write);
|
||||
bgw.WorkerReportsProgress = true;
|
||||
bgw.ProgressChanged += new ProgressChangedEventHandler(default_rpt);
|
||||
bgw.RunWorkerAsync(new string[] { rmfd, kt });
|
||||
bgw.RunWorkerAsync(new string[] { rmfd, kt,nn });
|
||||
}
|
||||
|
||||
void mf_write(object sender, DoWorkEventArgs e)
|
||||
@ -232,7 +247,7 @@ namespace MifareOneTool
|
||||
ProcessStartInfo psi = new ProcessStartInfo("nfc-bin/nfc-mfclassic.exe");
|
||||
string[] args = (string[])e.Argument;
|
||||
psi.Arguments = "w " + args[1] + " u \"" + args[0] + "\"";
|
||||
if (keymfd != "")
|
||||
if (keymfd != "" && args[2]=="")
|
||||
{
|
||||
psi.Arguments += " \"" + keymfd + "\" f";
|
||||
}
|
||||
@ -512,7 +527,8 @@ namespace MifareOneTool
|
||||
RNGCryptoServiceProvider rng = new RNGCryptoServiceProvider();
|
||||
rng.GetNonZeroBytes(buid);
|
||||
string uid = Interaction.InputBox("请输入需要写入的UID卡号,共8位十六进制数,如E44A3BF1。", "请输入UID号", hex(buid), -1, -1).Trim();
|
||||
if(!Regex.IsMatch(uid, pat)){
|
||||
if (!Regex.IsMatch(uid, pat))
|
||||
{
|
||||
MessageBox.Show("输入的UID号不合法", "InputError", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user