/// ------------------------------------------------------------------------------------ /// <summary> /// Handle the File/Export/Xml menu command /// </summary> /// <param name="args"></param> /// <returns></returns> /// ------------------------------------------------------------------------------------ protected bool OnFileExportXml(object args) { AdjustScriptureAnnotations(); using (ExportXmlDialog dlg = new ExportXmlDialog(m_cache, m_bookFilter, GetReferenceToCurrentBook().Book, m_StyleSheet, FileType.OXES, m_app)) { if (dlg.ShowDialog() == DialogResult.OK) { string filename = Path.GetFileName(dlg.FileName); string directory = Path.GetDirectoryName(dlg.FileName); // REVIEW (TimS): What does this code accomplish? It seems to just re-create // dlg.FileName in parts. if (directory.EndsWith(Path.VolumeSeparatorChar.ToString())) directory += Path.DirectorySeparatorChar; ExportXml export = new ExportXml(Path.Combine(directory, filename), m_cache, m_bookFilter, m_app, dlg.ExportWhat, dlg.BookNumber, dlg.FirstSection, dlg.LastSection, dlg.Description); if (export.Run(this)) { // Validate the XML file. If it doesn't pass validation, display a // yellow error message box. string strError = Validator.GetAnyValidationErrors(export.FileName); if (!String.IsNullOrEmpty(strError)) throw new ContinuableErrorException(strError); } } } return true; }
/// ------------------------------------------------------------------------------------ /// <summary> /// Handle the File/Export/Xml menu command /// </summary> /// <param name="args"></param> /// <returns></returns> /// ------------------------------------------------------------------------------------ protected bool OnFileExportXml(object args) { AdjustScriptureAnnotations(); ScrReference refBook = GetReferenceToCurrentBook(); using (ExportXmlDialog dlg = new ExportXmlDialog(m_cache, m_bookFilter, refBook, m_StyleSheet, FileType.OXES)) { if (dlg.ShowDialog() == DialogResult.OK) { ExportXml export = new ExportXml(dlg.FileName, m_cache, m_bookFilter, dlg.ExportWhat, dlg.BookNumber, dlg.FirstSection, dlg.LastSection, dlg.Description); string filename = Path.GetFileName(dlg.FileName); string directory = Path.GetDirectoryName(dlg.FileName); if (directory.EndsWith(Path.VolumeSeparatorChar.ToString()) && !directory.EndsWith(Path.DirectorySeparatorChar.ToString())) { directory += Path.DirectorySeparatorChar.ToString(); } export.FileName = Path.Combine(directory, filename); if (export.Run()) { // Validate the XML file. If it doesn't pass validation, display a // yellow error message box. string strError = Validator.GetAnyValidationErrors(export.FileName); if (!String.IsNullOrEmpty(strError)) throw new SIL.Utils.ContinuableErrorException(strError); } } } return true; }