private static StreamReader LoadXmi(string fileName) { EAModel model = EAModel.LoadXmi(Path.Combine(Deploy.TestDirectory, fileName)); MemoryStream ms = null; try { ms = new MemoryStream(); using (CsvDoorsTreePlainExport export = new CsvDoorsTreePlainExport(ms)) { export.ExportTree(model.Root, false); } ms.Flush(); ms.Seek(0, SeekOrigin.Begin); return(new StreamReader(ms)); } catch { if (ms != null) { ms.Dispose(); } throw; } }
private void mnuFileExportCsvPlain_Click(object sender, EventArgs e) { Model.EATree element = GetElement(); if (element == null) { return; } string fileName = GetFileName("csv", "CSV (*.csv)|*.csv", "Save As CSV Plain Text File"); if (fileName == null) { return; } try { using (Model.ITreeExport exportFormat = new Model.CsvDoorsTreePlainExport(fileName)) { exportFormat.ExportTree(element, false); } } catch (System.Exception exception) { EATrace.XmiImport(System.Diagnostics.TraceEventType.Warning, "EAExport CSV Export Failure: {0}", exception.Message); MessageBox.Show(exception.Message, "EAExport CSV Export Failure"); } }