@@ -118,6 +118,7 @@ private void Form1_Load(object sender, EventArgs e)
118
118
//ghu.Update(Properties.Settings.Default.GitHubR);
119
119
//remoteVersionLabel.Text = "远程版本 " + ghu.remoteVersion;
120
120
checkBoxAutoABN . Checked = Properties . Settings . Default . AutoABN ;
121
+ checkBoxWriteProtect . Checked = Properties . Settings . Default . WriteCheck ;
121
122
}
122
123
123
124
private void buttonScanCard_Click ( object sender , EventArgs e )
@@ -251,6 +252,8 @@ private void buttonSelectKey_Click(object sender, EventArgs e)
251
252
252
253
bool writecheck ( string file )
253
254
{
255
+ if ( checkBoxWriteProtect . Checked == false )
256
+ { return true ; } //如果禁用,直接假装检查成功
254
257
S50 card = new S50 ( ) ;
255
258
try
256
259
{
@@ -1095,5 +1098,67 @@ private void checkBoxAutoABN_CheckedChanged(object sender, EventArgs e)
1095
1098
{
1096
1099
Properties . Settings . Default . AutoABN = checkBoxAutoABN . Checked ;
1097
1100
}
1101
+
1102
+ private void buttonEUIDWrite_Click ( object sender , EventArgs e )
1103
+ {
1104
+ buttonBmfWrite_Click ( sender , e ) ;
1105
+ }
1106
+
1107
+ private void buttonEReadUID_Click ( object sender , EventArgs e )
1108
+ {
1109
+ buttonBmfRead_Click ( sender , e ) ;
1110
+ }
1111
+
1112
+ private void checkBoxWriteProtect_CheckedChanged ( object sender , EventArgs e )
1113
+ {
1114
+ Properties . Settings . Default . WriteCheck = checkBoxWriteProtect . Checked ;
1115
+ }
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
+ }
1098
1163
}
1099
1164
}
0 commit comments