Пример #1
0
        /// <summary>
        /// Build by project by reference array of verse text for this term
        /// </summary>
        internal void ReadVerseText(Term myTerm, StoryProjectData theSPD, ProgressBar progressBarLoadingKeyTerms)
        {
            mapReferenceToVerseTextList = new Dictionary <string, List <string> >();

            ArrayList vrefs = new ArrayList();

            foreach (var vref in myTerm.VerseRefs())
            {
                vrefs.Add(vref.BBBCCCVVVS());
            }

            // List<VerseRef> vrefs = new List<VerseRef>(myTerm.VerseRefs());

            // get the current stories only (not the obsolete ones)
            StoriesData theStories = theSPD[Properties.Resources.IDS_MainStoriesSet];

            progressBarLoadingKeyTerms.Maximum = theStories.Count;
            progressBarLoadingKeyTerms.Value   = 0;

            for (int nStoryNumber = 0; nStoryNumber < theStories.Count; nStoryNumber++)
            {
                StoryData aStory = theStories[nStoryNumber];
                for (int nVerseNumber = 0; nVerseNumber < aStory.Verses.Count; nVerseNumber++)
                {
                    VerseData aVerse = aStory.Verses[nVerseNumber];
                    for (int nAnchorNumber = 0; nAnchorNumber < aVerse.Anchors.Count; nAnchorNumber++)
                    {
                        AnchorData anAnchor    = aVerse.Anchors[nAnchorNumber];
                        VerseRef   theVerseRef = new VerseRef(anAnchor.AnchorAsVerseRef);
                        int        nIndex      = vrefs.BinarySearch(theVerseRef.BBBCCCVVVS());
                        if (nIndex < 0)
                        {
                            continue;
                        }

                        string strVerseReference = String.Format("Story: '{0}' line: {1} anchor: {2}",
                                                                 aStory.Name, nVerseNumber + 1, anAnchor.JumpTarget);

                        List <string> astrVerseText = new List <string>(projectVariablesList.Count);
                        if (theSPD.ProjSettings.Vernacular.HasData)
                        {
                            astrVerseText.Add(aVerse.VernacularText.ToString());
                        }
                        if (theSPD.ProjSettings.NationalBT.HasData)
                        {
                            astrVerseText.Add(aVerse.NationalBTText.ToString());
                        }
                        if (theSPD.ProjSettings.InternationalBT.HasData)
                        {
                            astrVerseText.Add(aVerse.InternationalBTText.ToString());
                        }

                        // keep track of this verse and it's reference
                        if (!mapReferenceToVerseTextList.ContainsKey(strVerseReference))
                        {
                            mapReferenceToVerseTextList.Add(strVerseReference, astrVerseText);
                        }

                        // we don't need to do any more anchors with this same line of the same story
                        //  so set the anchor # to the number of anchors so the next outer for loop
                        //  will think it's finished
                        nAnchorNumber = aVerse.Anchors.Count;
                        break;
                    }
                }
                progressBarLoadingKeyTerms.Value++;
            }
        }