Skip to content

Commit

Permalink
show number of tonies in database
Browse files Browse the repository at this point in the history
add manual JSON downloading
  • Loading branch information
g3gg0 committed Jan 3, 2024
1 parent caa2957 commit d429f7c
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 32 deletions.
64 changes: 37 additions & 27 deletions TeddyBench/TeddyMain.Designer.cs

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

35 changes: 30 additions & 5 deletions TeddyBench/TeddyMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,11 @@ public int Compare(object a, object b)
}
}

public void LoadJson()
public void LoadJson(bool force = false)
{
try
{
if (Settings.DownloadJson)
if (Settings.DownloadJson || force)
{
try
{
Expand Down Expand Up @@ -212,7 +212,6 @@ public TeddyMain()
LoadJson();
StartThreads();


UpdateCheckThread = new SafeThread(UpdateCheck, "UpdateCheckThread");
UpdateCheckThread.Start();

Expand Down Expand Up @@ -350,22 +349,43 @@ private void Proxmark3_DeviceFound(object sender, string e)

private void UpdateStatusBar()
{
string text = "";

if (RfidReader != null && RfidReader.Connected)
{
if (!statusStrip1.Visible)
{
statusStrip1.Show();
}
string voltageString = Settings.DebugWindow ? ", " + RfidReader.AntennaVoltage.ToString("0.00", CultureInfo.InvariantCulture) + " V" : "";
statusLabel.Text = RfidReader.HardwareType + " (FW: " + (RfidReader.UnlockSupported ? "SLIX-L enabled" : "stock") + voltageString + ") found at " + RfidReader.CurrentPort + ". The UID of the tag will be automatically used where applicable.";

text += " | " + RfidReader.HardwareType + " (FW: " + (RfidReader.UnlockSupported ? "SLIX-L enabled" : "stock") + voltageString + ") found at " + RfidReader.CurrentPort + ". The UID of the tag will be automatically used where applicable.";
}
else

if(TonieInfos.Length == 0)
{
text += " | No tonies.json, consider downloading it";
}
else
{
text += " | tonies.json has " + TonieInfos.Length + " entries";
}

if (text == "")
{
if (statusStrip1.Visible)
{
statusStrip1.Hide();
}
}
else
{
if (!statusStrip1.Visible)
{
statusStrip1.Show();
}
statusLabel.Text = text.Trim().Trim('|').Trim();
}
}

private void Proxmark3_UidFound(object sender, string e)
Expand Down Expand Up @@ -2365,5 +2385,10 @@ private void downloadToniesjsonOnStartupToolStripMenuItem_Click(object sender, E
Settings.DownloadJson = downloadToniesjsonOnStartupToolStripMenuItem.Checked;
SaveSettings();
}

private void downloadToniesjsonNowToolStripMenuItem_Click(object sender, EventArgs e)
{
LoadJson(true);
}
}
}

0 comments on commit d429f7c

Please sign in to comment.