Skip to content

Commit b7bbf15

Browse files
committed
添加Hardnested
1 parent 35b1179 commit b7bbf15

File tree

6 files changed

+590
-4
lines changed

6 files changed

+590
-4
lines changed

MifareOneTool/Form1.Designer.cs

Lines changed: 30 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

MifareOneTool/Form1.cs

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1113,5 +1113,52 @@ private void checkBoxWriteProtect_CheckedChanged(object sender, EventArgs e)
11131113
{
11141114
Properties.Settings.Default.WriteCheck = checkBoxWriteProtect.Checked;
11151115
}
1116+
1117+
private void buttonHardNested_Click(object sender, EventArgs e)
1118+
{
1119+
if (lprocess) { MessageBox.Show("有任务运行中,不可执行。", "设备忙", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } Form1.ActiveForm.Text = "MifareOne Tool - 运行中";
1120+
FormHardNes fhn = new FormHardNes();
1121+
if (fhn.ShowDialog() == DialogResult.Yes)
1122+
{
1123+
string hardargs = fhn.GetArg();
1124+
BackgroundWorker bgw = new BackgroundWorker();
1125+
bgw.DoWork += new DoWorkEventHandler(Hardnest);
1126+
bgw.WorkerReportsProgress = true;
1127+
bgw.ProgressChanged += new ProgressChangedEventHandler(default_rpt);
1128+
bgw.RunWorkerAsync(hardargs);
1129+
}
1130+
else
1131+
{
1132+
Text = "MifareOne Tool - 已取消";
1133+
}
1134+
}
1135+
void Hardnest(object sender, DoWorkEventArgs e)
1136+
{
1137+
if (lprocess) { return; }
1138+
ProcessStartInfo psi = new ProcessStartInfo("nfc-bin/libnfc_hardnested.exe");
1139+
psi.Arguments = (string)e.Argument;
1140+
psi.CreateNoWindow = true;
1141+
psi.UseShellExecute = false;
1142+
psi.RedirectStandardOutput = true;
1143+
psi.RedirectStandardError = true;
1144+
lprocess = true;
1145+
BackgroundWorker b = (BackgroundWorker)sender;
1146+
process = Process.Start(psi); running = true;
1147+
process.OutputDataReceived += (s, _e) => b.ReportProgress(0, _e.Data);
1148+
process.ErrorDataReceived += (s, _e) => b.ReportProgress(0, _e.Data);
1149+
//StreamReader stderr = process.StandardError;
1150+
process.BeginOutputReadLine();
1151+
process.BeginErrorReadLine();
1152+
process.WaitForExit();
1153+
lprocess = false; running = false;
1154+
if (process.ExitCode == 0)
1155+
{
1156+
b.ReportProgress(100, "##运行完毕##");
1157+
}
1158+
else
1159+
{
1160+
b.ReportProgress(100, "##运行出错##");
1161+
}
1162+
}
11161163
}
11171164
}

0 commit comments

Comments
 (0)