/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes a new instance of the <see cref="SCTextEnum"/> class. /// </summary> /// <param name="settings">The import settings</param> /// <param name="domain">The source domain</param> /// <param name="startRef">first reference to retrieve</param> /// <param name="endRef">last reference to retrieve</param> /// <param name="encConverters">The encoding converters repository</param> /// ------------------------------------------------------------------------------------ public SCTextEnum(IScrImportSet settings, ImportDomain domain, BCVRef startRef, BCVRef endRef, IEncConverters encConverters) { m_settings = settings; m_domain = domain; m_startRef = new BCVRef(startRef); m_endRef = new BCVRef(endRef); m_mappingSet = m_settings.GetMappingSetForDomain(domain); // Gets the set of encoding converters m_encConverters = encConverters; // make a list of all of the begin and end markers for inline markers // Also build the map of encoding converters m_InlineBeginAndEndMarkers = new List <string>(); foreach (ImportMappingInfo mapping in m_settings.GetMappingListForDomain(domain)) { if (mapping.IsInline || m_settings.ImportTypeEnum == TypeOfImport.Paratext5) { m_InlineBeginAndEndMarkers.Add(mapping.BeginMarker); if (mapping.IsInline) { m_InlineBeginAndEndMarkers.Add(mapping.EndMarker); } } } m_InlineBeginAndEndMarkers.Sort(new StrLengthComparer(false)); // Build a list of all of the characters that inline markers start with Set <char> tempCharList = new Set <char>(); foreach (string marker in m_InlineBeginAndEndMarkers) { tempCharList.Add(marker[0]); // Set ignores duplicates. } m_InlineMarkerStartChars = tempCharList.ToArray(); // Get the import file source that will provide the files to import. m_importSource = settings.GetImportFiles(domain); m_importSourceEnum = m_importSource.GetEnumerator(); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Determine if the file list has any accessible files and get a list of any /// inaccessible ones. /// </summary> /// <param name="source"></param> /// <param name="filesNotFound">A list of files that couldn't be found.</param> /// <returns>true if any SFM files are accessible. Otherwise, false.</returns> /// ------------------------------------------------------------------------------------ private static bool FilesAreAccessible(ImportFileSource source, ref StringCollection filesNotFound) { bool found = false; foreach (IScrImportFileInfo info in source) { if (info.RecheckAccessibility()) found = true; else filesNotFound.Add(info.FileName); } return found; }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes a new instance of the <see cref="SCTextEnum"/> class. /// </summary> /// <param name="settings">The import settings</param> /// <param name="domain">The source domain</param> /// <param name="startRef">first reference to retrieve</param> /// <param name="endRef">last reference to retrieve</param> /// <param name="encConverters">The encoding converters repository</param> /// ------------------------------------------------------------------------------------ public SCTextEnum(IScrImportSet settings, ImportDomain domain, BCVRef startRef, BCVRef endRef, IEncConverters encConverters) { m_settings = settings; m_domain = domain; m_startRef = new BCVRef(startRef); m_endRef = new BCVRef(endRef); m_mappingSet = m_settings.GetMappingSetForDomain(domain); // Gets the set of encoding converters m_encConverters = encConverters; // make a list of all of the begin and end markers for inline markers // Also build the map of encoding converters m_InlineBeginAndEndMarkers = new List<string>(); foreach (ImportMappingInfo mapping in m_settings.GetMappingListForDomain(domain)) { if (mapping.IsInline || m_settings.ImportTypeEnum == TypeOfImport.Paratext5) { m_InlineBeginAndEndMarkers.Add(mapping.BeginMarker); if (mapping.IsInline) m_InlineBeginAndEndMarkers.Add(mapping.EndMarker); } } m_InlineBeginAndEndMarkers.Sort(new StrLengthComparer(false)); // Build a list of all of the characters that inline markers start with Set<char> tempCharList = new Set<char>(); foreach (string marker in m_InlineBeginAndEndMarkers) tempCharList.Add(marker[0]); // Set ignores duplicates. m_InlineMarkerStartChars = tempCharList.ToArray(); // Get the import file source that will provide the files to import. m_importSource = settings.GetImportFiles(domain); m_importSourceEnum = m_importSource.GetEnumerator(); }