Skip to content

Commit

Permalink
v1.6.1 commit (ct beta)
Browse files Browse the repository at this point in the history
  • Loading branch information
XAS-712 committed Jan 30, 2019
1 parent 8bb465e commit 54c02ed
Show file tree
Hide file tree
Showing 8 changed files with 186 additions and 104 deletions.
161 changes: 89 additions & 72 deletions MifareOneTool/Form1.Designer.cs

Large diffs are not rendered by default.

96 changes: 67 additions & 29 deletions MifareOneTool/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ private void Form1_Load(object sender, EventArgs e)
//GitHubUpdate ghu = new GitHubUpdate(Properties.Settings.Default.GitHubR);
//ghu.Update(Properties.Settings.Default.GitHubR);
//remoteVersionLabel.Text = "远程版本 " + ghu.remoteVersion;
checkBoxAutoABN.Checked = Properties.Settings.Default.AutoABN;
}

private void buttonScanCard_Click(object sender, EventArgs e)
Expand Down Expand Up @@ -158,15 +159,23 @@ private void buttonMfRead_Click(object sender, EventArgs e)
string rmfd = "MfRead.tmp";
string kt = "A";
string nn = "";
switch (MessageBox.Show("使用KeyA(是)或KeyB(否),还是不使用(用于全新白卡)(取消)?", "KeyA/B/N", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Information))
if (checkBoxAutoABN.Checked && keymfd != "")
{
case DialogResult.No:
kt = "B";
break;
kt = "C";
logAppend("正在使用智能KeyABN…");
}
else
{
switch (MessageBox.Show("使用KeyA(是)或KeyB(否),还是不使用(用于全新白卡)(取消)?", "KeyA/B/N", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Information))
{
case DialogResult.No:
kt = "B";
break;

case DialogResult.Cancel:
nn = "x";
break;
case DialogResult.Cancel:
nn = "x";
break;
}
}
BackgroundWorker bgw = new BackgroundWorker();
bgw.DoWork += new DoWorkEventHandler(mf_read);
Expand Down Expand Up @@ -282,15 +291,23 @@ private void buttonMfWrite_Click(object sender, EventArgs e)
if (!writecheck(rmfd)) { MessageBox.Show("将要写入的文件存在错误,请用高级模式中的Hex工具打开查看。", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); return; }
string kt = "A";
string nn = "";
switch (MessageBox.Show("使用KeyA(是)或KeyB(否),还是不使用(用于全新白卡)(取消)?", "KeyA/B/N", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Information))
if (checkBoxAutoABN.Checked && keymfd != "")
{
kt = "C";
logAppend("正在使用智能KeyABN…");
}
else
{
case DialogResult.No:
kt = "B";
break;
switch (MessageBox.Show("使用KeyA(是)或KeyB(否),还是不使用(用于全新白卡)(取消)?", "KeyA/B/N", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Information))
{
case DialogResult.No:
kt = "B";
break;

case DialogResult.Cancel:
nn = "x";
break;
case DialogResult.Cancel:
nn = "x";
break;
}
}
BackgroundWorker bgw = new BackgroundWorker();
bgw.DoWork += new DoWorkEventHandler(mf_write);
Expand Down Expand Up @@ -674,15 +691,23 @@ private void buttonCmfWrite_Click(object sender, EventArgs e)
if (!writecheck(rmfd)) { MessageBox.Show("将要写入的文件存在错误,请用高级模式中的Hex工具打开查看。", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); return; }
string kt = "A";
string nn = "";
switch (MessageBox.Show("使用KeyA(是)或KeyB(否),还是不使用(用于全新白卡)(取消)?", "KeyA/B/N", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Information))
if (checkBoxAutoABN.Checked && keymfd != "")
{
case DialogResult.No:
kt = "B";
break;
kt = "C";
logAppend("正在使用智能KeyABN…");
}
else
{
switch (MessageBox.Show("使用KeyA(是)或KeyB(否),还是不使用(用于全新白卡)(取消)?", "KeyA/B/N", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Information))
{
case DialogResult.No:
kt = "B";
break;

case DialogResult.Cancel:
nn = "x";
break;
case DialogResult.Cancel:
nn = "x";
break;
}
}
BackgroundWorker bgw = new BackgroundWorker();
bgw.DoWork += new DoWorkEventHandler(cmf_write);
Expand Down Expand Up @@ -761,11 +786,19 @@ private void buttonMfFormat_Click(object sender, EventArgs e)
if (keymfd == "") { MessageBox.Show("未选择有效key.mfd。", "无密钥", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } Form1.ActiveForm.Text = "MifareOne Tool - 运行中";
string rmfd = keymfd;
string kt = "A";
switch (MessageBox.Show("使用KeyA(是)或KeyB(否)?", "KeyA/B", MessageBoxButtons.YesNo, MessageBoxIcon.Information))
if (checkBoxAutoABN.Checked && keymfd != "")
{
case DialogResult.No:
kt = "B";
break;
kt = "C";
logAppend("正在使用智能KeyABN…");
}
else
{
switch (MessageBox.Show("使用KeyA(是)或KeyB(否)?", "KeyA/B", MessageBoxButtons.YesNo, MessageBoxIcon.Information))
{
case DialogResult.No:
kt = "B";
break;
}
}
BackgroundWorker bgw = new BackgroundWorker();
bgw.DoWork += new DoWorkEventHandler(mf_format);
Expand Down Expand Up @@ -1000,7 +1033,7 @@ private void buttonnKeysMfoc_Click(object sender, EventArgs e)
private void buttonDictMfoc_Click(object sender, EventArgs e)
{
if (lprocess) { MessageBox.Show("有任务运行中,不可执行。", "设备忙", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } Form1.ActiveForm.Text = "MifareOne Tool - 运行中";
string cmd_mode="/k";
string cmd_mode = "/k";
//if (Control.ModifierKeys == Keys.Control)
//{
// cmd_mode="/k";
Expand All @@ -1013,7 +1046,7 @@ private void buttonDictMfoc_Click(object sender, EventArgs e)
ofd.Multiselect = false;
if (ofd.ShowDialog() == DialogResult.OK)
{
filename=ofd.FileName;
filename = ofd.FileName;
}
else
{
Expand All @@ -1033,15 +1066,15 @@ private void buttonDictMfoc_Click(object sender, EventArgs e)
[DllImport("user32.dll", EntryPoint = "SetWindowText")]
public static extern int SetWindowText(IntPtr hwnd, string lpString);
[DllImport("user32", SetLastError = true)]
public static extern int GetWindowText(IntPtr hWnd,StringBuilder lpString,int nMaxCount);
public static extern int GetWindowText(IntPtr hWnd, StringBuilder lpString, int nMaxCount);

void mfocCMD(object sender, DoWorkEventArgs e)
{
if (lprocess) { return; }
ProcessStartInfo psi = new ProcessStartInfo("cmd.exe");
string[] args = (string[])e.Argument;
psi.WorkingDirectory = "./";
psi.Arguments = "/T:0A "+ args[2] + @" nfc-bin\mfoc.exe " + args[1] + " -O \"" + args[0] + "\"";
psi.Arguments = "/T:0A " + args[2] + @" nfc-bin\mfoc.exe " + args[1] + " -O \"" + args[0] + "\"";
lprocess = true;
BackgroundWorker b = (BackgroundWorker)sender;
process = Process.Start(psi); running = true;
Expand All @@ -1057,5 +1090,10 @@ void mfocCMD(object sender, DoWorkEventArgs e)
File.Delete(args[0]);
}
}

private void checkBoxAutoABN_CheckedChanged(object sender, EventArgs e)
{
Properties.Settings.Default.AutoABN = checkBoxAutoABN.Checked;
}
}
}
3 changes: 3 additions & 0 deletions MifareOneTool/Form1.resx
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@
<metadata name="toolTipHelp.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="toolTipHelp.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="statusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>157, 17</value>
</metadata>
Expand Down
2 changes: 1 addition & 1 deletion MifareOneTool/FormDiff.cs
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ private string Compare()
}

}
return "共找到 " + diffCount.ToString() + " 处不同\n" + stb.ToString();
return "共找到 " + diffCount.ToString() + " 个扇区不同\n" + stb.ToString();
}
}
}
3 changes: 1 addition & 2 deletions MifareOneTool/MifareOneTool.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="ClassMfClassic.cs" />
<Compile Include="ClassMifareS50.cs" />
<Compile Include="Form1.cs">
<SubType>Form</SubType>
Expand Down Expand Up @@ -149,4 +148,4 @@
<Target Name="AfterBuild">
</Target>
-->
</Project>
</Project>
12 changes: 12 additions & 0 deletions MifareOneTool/Properties/Settings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions MifareOneTool/Properties/Settings.settings
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,8 @@
<Setting Name="GitHubR" Type="System.String" Scope="Application">
<Value Profile="(Default)">xcicode/MifareOneTool</Value>
</Setting>
<Setting Name="AutoABN" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
</Settings>
</SettingsFile>
10 changes: 10 additions & 0 deletions MifareOneTool/app.config
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="MifareOneTool.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</sectionGroup>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="MifareOneTool.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
</sectionGroup>
</configSections>
<applicationSettings>
<MifareOneTool.Properties.Settings>
Expand All @@ -12,4 +15,11 @@
</setting>
</MifareOneTool.Properties.Settings>
</applicationSettings>
<userSettings>
<MifareOneTool.Properties.Settings>
<setting name="AutoABN" serializeAs="String">
<value>True</value>
</setting>
</MifareOneTool.Properties.Settings>
</userSettings>
</configuration>

0 comments on commit 54c02ed

Please sign in to comment.