private void tsButton_save_Click(object sender, EventArgs e) { StreamWriter log = null; ErrorForm error; FileDialog saveFileDialog = new System.Windows.Forms.SaveFileDialog(); saveFileDialog.Title = "Save file"; saveFileDialog.Filter = "Text file (*.txt)|*.txt"; if (saveFileDialog.ShowDialog() == DialogResult.OK) { try { log = new StreamWriter(saveFileDialog.FileName); log.Write(txtDebug.Text); } catch (Exception ex) { error = new ErrorForm(); error.txtError.Text = "Exception while trying to save file!" + Environment.NewLine; error.txtError.Text = ex.Message; error.Show(); } log.Close(); } }
private void loadConfigToolStripMenuItem_Click(object sender, EventArgs e) { XmlSerializer s; TextReader r; openFile.Title = "Load settings"; openFile.InitialDirectory = currentDir; openFile.FileName = "config.xml"; openFile.Filter = "Config (*.xml)|*.xml"; if (openFile.ShowDialog() == DialogResult.OK) { try { s = new XmlSerializer(typeof(Data)); r = new StreamReader(openFile.FileName); data = (Data)s.Deserialize(r); LoadSettings(); this.Text += " - " + openFile.FileName; } catch (Exception ex) { ErrorForm error = new ErrorForm(); error.txtError.Text = "Error Ocourred while loading settings! Exception Information:"; error.txtError.Text += ex.Message; error.txtError.Text += Environment.NewLine + "Your settings file may be corrupt."; error.Show(); } } }
private void PipeErrorHandler(object sender, PipeErrorEventArgs args) { ErrorForm err = new ErrorForm(); err.txtError.Text += "PipeErrorHandler:" + Environment.NewLine; err.txtError.Text += args.ErrorDesc; err.Show(); }
public bool StartQemu(Platforms Platform) { switch (Platform) { case Platforms.x86: case Platforms.x86_ISA: p.StartInfo.FileName = data.Paths.Qemu + "\\qemu.exe"; break; case Platforms.x64: case Platforms.x64_ISA: p.StartInfo.FileName = data.Paths.Qemu + "\\qemu-system-x86_64.exe"; break; case Platforms.ARM_integratorcp1026: case Platforms.ARM_integratorcp926: case Platforms.ARM_versatileab: case Platforms.ARM_versatilepb: p.StartInfo.FileName = data.Paths.Qemu + "\\qemu-system-arm.exe"; break; case Platforms.PPC_g3bw: case Platforms.PPC_mac99: case Platforms.PPC_prep: p.StartInfo.FileName = data.Paths.Qemu + "\\qemu-system-ppc.exe"; break; case Platforms.Sparc_sun4m: p.StartInfo.FileName = data.Paths.Qemu + "\\qemu-system-sparc.exe"; break; } if (!File.Exists(p.StartInfo.FileName)) { MessageBox.Show("Required qemu executable does not exist in path", "Error - Qemu path"); return(false); } try { p.StartInfo.WorkingDirectory = data.Paths.Qemu; p.StartInfo.Arguments = data.GetArgv(); } catch (Exception e) { MessageBox.Show("Invalid path or arguments. Your settings may be corrupt. \nException Information: " + e.Message, "Error"); return(false); } /* show the command line */ ErrBuffer = "Path:" + Environment.NewLine + p.StartInfo.FileName.ToString() + Environment.NewLine + "Arguments:" + Environment.NewLine + data.GetArgv(); try { p.Start(); if (data.Debug.SerialPort.SRedirect) { output = new DebugForm(); output.Listen(); } } catch (Exception e) { ErrBuffer += Environment.NewLine + "Exception: " + e.Message; ErrorForm error = new ErrorForm(); error.txtError.Text = ErrBuffer; error.Show(); return(false); } return(true); }