diff --git a/.vs/Tinytools/v14/.suo b/.vs/Tinytools/v14/.suo index f67d299..5aaa22e 100644 Binary files a/.vs/Tinytools/v14/.suo and b/.vs/Tinytools/v14/.suo differ diff --git a/Tinytools/bin/Debug/Tinytools.exe b/Tinytools/bin/Debug/Tinytools.exe index 36bf28d..655e314 100644 Binary files a/Tinytools/bin/Debug/Tinytools.exe and b/Tinytools/bin/Debug/Tinytools.exe differ diff --git a/Tinytools/bin/Debug/Tinytools.pdb b/Tinytools/bin/Debug/Tinytools.pdb index dd6899d..509fbd9 100644 Binary files a/Tinytools/bin/Debug/Tinytools.pdb and b/Tinytools/bin/Debug/Tinytools.pdb differ diff --git a/Tinytools/libusbtool.cs b/Tinytools/libusbtool.cs index a2b19e2..f12aefa 100644 --- a/Tinytools/libusbtool.cs +++ b/Tinytools/libusbtool.cs @@ -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; @@ -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(); @@ -387,7 +388,7 @@ 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) { @@ -395,6 +396,11 @@ private void openToolStripMenuItem1_Click(object sender, EventArgs e) 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()); @@ -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(); @@ -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()) diff --git a/Tinytools/obj/Debug/Tinytools.exe b/Tinytools/obj/Debug/Tinytools.exe index 36bf28d..655e314 100644 Binary files a/Tinytools/obj/Debug/Tinytools.exe and b/Tinytools/obj/Debug/Tinytools.exe differ diff --git a/Tinytools/obj/Debug/Tinytools.pdb b/Tinytools/obj/Debug/Tinytools.pdb index dd6899d..509fbd9 100644 Binary files a/Tinytools/obj/Debug/Tinytools.pdb and b/Tinytools/obj/Debug/Tinytools.pdb differ