private void button1_Click(object sender, EventArgs e) { qdl = openBestDevice(); if (qdl == null || !qdl.isDeviceOpen) { MessageBox.Show("Unable to open device"); return; } qdl.PerformBootstrap(); var stream = new BufferedStream(File.Open(@"G:\Fastboot\cm-recovery.img", FileMode.Open)); qdl.WriteFile(0x7dc00000, stream); qdl.ResetDevice(); qdl.Close(); }
private QDL openBestDevice() { QDL myQDL = qdl; try { if (myQDL == null) { myQDL = new QDLUSB(); } if (!myQDL.isDeviceOpen) { myQDL.OpenDevice(); } } catch (QDLLib.Exceptions.QDLDeviceNotFoundException nex) { myQDL = null; } if (myQDL == null) { try { if (myQDL == null) { myQDL = new QDLSerial(); } if (!myQDL.isDeviceOpen) { myQDL.OpenDevice(); } } catch (QDLLib.Exceptions.QDLDeviceNotFoundException nex) { myQDL = null; } } return(myQDL); }