static void Main(string[] args) { /* Testing only * args = new string[2]; * args[0] = "test.bin"; * args[1] = "GUI"; */ if (args.Length == 0) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new MainForm()); } else { if (args.Length > 1 && args[1] == "GUI") { FrmProgress frmProgress = new FrmProgress(); frmProgress.SetLabel(""); frmProgress.SetProgressPercentage(0); frmProgress.Show(); FirmwareLoader.UploadFirmare(args[0], frmProgress); frmProgress.Close(); } else { FirmwareLoader.UploadFirmare(args[0]); } } // Console.WriteLine("Usage GD77_FirmwareLoader filename"); }
private void btnOpenFile_Click(object sender, EventArgs e) { OpenFileDialog openFileDialog1 = new OpenFileDialog(); openFileDialog1.Filter = "binary files (*.bin)|*.bin|firmware files (*.sgl)|*.sgl|All files (*.*)|*.*"; openFileDialog1.RestoreDirectory = true; if (openFileDialog1.ShowDialog() == DialogResult.OK) { try { FrmProgress frmProgress = new FrmProgress(); frmProgress.SetLabel(""); frmProgress.SetProgressPercentage(0); frmProgress.Show(); FirmwareLoader.UploadFirmare(openFileDialog1.FileName, frmProgress); frmProgress.Close(); } catch (Exception) { } } }