/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes the scripture note import manager. /// </summary> /// ------------------------------------------------------------------------------------ public static void Initialize(IScripture scr, int bookNum, string alternateRfcWsDir) { s_scr = scr; if (!string.IsNullOrEmpty(alternateRfcWsDir)) s_alternateRfcWsDir = alternateRfcWsDir; CacheCheckIds(); if (s_rfcWs == null) s_rfcWs = new RfcWritingSystem(s_scr.Cache, false); if (bookNum != s_prevBookNum) { s_prevBookNum = bookNum; s_annotationList = (ScrBookAnnotations)scr.BookAnnotationsOS[bookNum - 1]; s_existingAnnotations = new Dictionary<ScrScriptureNote.ScrNoteKey, ScrScriptureNote>(); foreach (ScrScriptureNote ann in s_annotationList.NotesOS) s_existingAnnotations[ann.Key] = ann; } }
/// ------------------------------------------------------------------------------------ /// <summary> /// Cleanups the scripture note import manager. /// </summary> /// ------------------------------------------------------------------------------------ public static void Cleanup() { s_existingAnnotations = null; s_checkNamesToGuids = null; s_annotationList = null; s_rfcWs = null; s_prevBookNum = 0; s_scr = null; }
/// ----------------------------------------------------------------------------------- /// <summary> /// Constructor used with XML (OXES) based import. /// </summary> /// <param name="cache"></param> /// <param name="styleSheet"></param> /// <param name="sOXESFile">name of the XML (OXES) file</param> /// <param name="undoManager"></param> /// <param name="importCallbacks"></param> /// ----------------------------------------------------------------------------------- private TeXmlImporter(FdoCache cache, FwStyleSheet styleSheet, string sOXESFile, UndoImportManager undoManager, TeImportUi importCallbacks) { Debug.Assert(cache != null); Debug.Assert(styleSheet != null); Debug.Assert(sOXESFile != null && sOXESFile.Length > 0); m_cache = cache; m_styleSheet = styleSheet; m_sOXESFile = sOXESFile; // Allow tests to pass in a bogus filename. m_sOXESDir = (m_sOXESFile.Trim().Length > 0 ? Path.GetDirectoryName(m_sOXESFile) : null); m_undoManager = undoManager; m_importCallbacks = importCallbacks; m_importCallbacks.Importer = this; int cChapters = CountChapters(); if (cChapters > 0) m_importCallbacks.Maximum = cChapters; m_rfcWs = new RfcWritingSystem(cache, false); }