SonicAudioTools/Source/CsbBuilder/ExceptionForm.cs

43 lines
1.3 KiB
C#
Raw Permalink Normal View History

2017-01-26 21:40:46 +01:00
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace CsbBuilder
{
public partial class ExceptionForm : Form
{
private Exception exception;
public ExceptionForm(Exception exception)
{
InitializeComponent();
this.exception = exception;
if (this.exception == null)
{
this.exception = new Exception("The exception reference is for some reason set to null! Please don't forget to report what you were doing before this happened.");
}
richTextBox1.Text = exception.Message;
richTextBox2.Text = exception.StackTrace;
}
private void CopyReport(object sender, EventArgs e)
{
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.AppendLine($"Application: {Program.ApplicationTitle}");
2017-01-26 21:40:46 +01:00
stringBuilder.AppendLine($"Exception Message: {exception.Message}");
stringBuilder.AppendLine($"Exception Details:");
stringBuilder.AppendLine(exception.StackTrace);
Clipboard.SetText(stringBuilder.ToString());
}
}
}