private void btnDebugExport_Click(object sender, EventArgs e) { //I'm not sure if this function also relies on the same goalPath textbox. //If it doesn't, please remove the ifelse statement and keep the catch function as it was missing and causing a crash. if (String.IsNullOrEmpty(goalPath.Text)) { MessageBox.Show("Please specify output file path first!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { try { string filePath = Path.Combine(goalPath.Text, "debug.json"); using (var debugFileStream = new FileStream(filePath, FileMode.Create)) { var sev = new StoryDebugExportVisitor(debugFileStream); sev.Visit(_story); } } catch (Exception exc) { MessageBox.Show($"Internal error!{exc}", "Export Failed", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void btnDebugExport_Click(object sender, EventArgs e) { string filePath = Path.Combine(goalPath.Text, "debug.json"); using (var debugFileStream = new FileStream(filePath, FileMode.Create)) { var sev = new StoryDebugExportVisitor(debugFileStream); sev.Visit(_story); } }