Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
panhao4812 committed Jun 5, 2017
1 parent d85d91e commit 61a3cc3
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 5 deletions.
Binary file modified .vs/Tinytools/v14/.suo
Binary file not shown.
Binary file modified Tinytools/bin/Debug/Tinytools.exe
Binary file not shown.
Binary file modified Tinytools/bin/Debug/Tinytools.pdb
Binary file not shown.
18 changes: 13 additions & 5 deletions Tinytools/libusbtool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@ public void Print(Object str)
private void libusbtool_Load(object sender, EventArgs e)
{
string str = Environment.CurrentDirectory + "\\tinytools.conf";
if (File.Exists(str)) { loadOptions(str); }
else
loadOptions(str);
str = Environment.CurrentDirectory + "\\avrdude.conf";
if (!File.Exists(str))
{
Driver.Enabled = false;
toolsToolStripMenuItem.Enabled = false;
Expand Down Expand Up @@ -354,7 +355,7 @@ private void openToolStripMenuItem_Click(object sender, EventArgs e)
}
private void uploadToolStripMenuItem1_Click(object sender, EventArgs e)
{
// try{
try{
if (textBox2.Text == "")
{
Clear();
Expand Down Expand Up @@ -387,14 +388,19 @@ private void uploadToolStripMenuItem1_Click(object sender, EventArgs e)
Thread.Sleep(5);
}
Print("Upload finished");
// }catch (Exception ex) { Print(ex.ToString()); }
}catch (Exception ex) { Print(ex.ToString()); }
}
private void openToolStripMenuItem1_Click(object sender, EventArgs e)
{
Clear();
try
{
HidDevice[] HidDeviceList = HidDevices.Enumerate(Convert.ToInt32(vid, 16), Convert.ToInt32(pid2, 16), (ushort)0xFF31).ToArray();
if (HidDeviceList == null|| HidDeviceList.Length==0)
{
Print("Connect usb device and install driver. Try open again");
return;
}
for (int i = 0; i < HidDeviceList.Length; i++)
{
Print(HidDeviceList[i].ToString());
Expand All @@ -416,6 +422,7 @@ private void openToolStripMenuItem1_Click(object sender, EventArgs e)
}
private void uploadToolStripMenuItem_Click(object sender, EventArgs e)
{
try {
if (textBox2.Text == "")
{
Clear();
Expand Down Expand Up @@ -475,7 +482,8 @@ private void uploadToolStripMenuItem_Click(object sender, EventArgs e)
outdata[1] = 0xFF; outdata[2] = 0xF2;
HidDevice.Write(outdata, 50); Thread.Sleep(50);
Print("Upload finished");
}
}catch (Exception ex) { Print(ex.ToString()); }
}
private void libusbToolStripMenuItem_Click(object sender, EventArgs e)
{
if (lisbusbdriver())
Expand Down
Binary file modified Tinytools/obj/Debug/Tinytools.exe
Binary file not shown.
Binary file modified Tinytools/obj/Debug/Tinytools.pdb
Binary file not shown.

0 comments on commit 61a3cc3

Please sign in to comment.