Пример #1
0
        public void NextVerse()
        {
            bool result = (showEmptyBooks) ? curRef.NextVerse() : curRef.NextVerse(booksPresentSet);

            if (result)
            {
                UpdateReference();
            }
        }
Пример #2
0
        /// <summary>
        /// Gets a single character/delivery object that represents the one known character expected to be the
        /// exclusive (implicit) speaker over the entire reference range represented by the given parameters.
        /// If there are conflicting implicit characters or an implicit character covers only part of the range,
        /// the returned object will be a "Needs Review" character.
        /// </summary>
        public virtual ICharacterDeliveryInfo GetImplicitCharacter(int bookId, int chapter, int startVerse, int endVerse = 0, ScrVers versification = null)
        {
            if (versification == null)
            {
                versification = ScrVers.English;
            }

            var verseRef = new VerseRef(bookId, chapter, startVerse, versification);

            verseRef.ChangeVersification(ScrVers.English);
            var implicitCv = m_lookupByRef[verseRef.BBBCCCVVV].SingleOrDefault(cv => cv.IsImplicit);

            if (endVerse == 0 || startVerse == endVerse || implicitCv == null)
            {
                return(implicitCv);
            }

            var initialEndRef = new VerseRef(bookId, chapter, endVerse, versification);

            initialEndRef.ChangeVersification(ScrVers.English);
            do
            {
                var cvNextVerse = m_lookupByRef[verseRef.BBBCCCVVV].SingleOrDefault(cv => cv.IsImplicit);
                // Unless all verses in the range have the same implicit character, we cannot say that there is an
                // implicit character for this range. Note that there is the slight possibility that the delivery may vary
                // from one verse to the next, but it doesn't seem worth it to fail to find the implicit character just
                // because of that. Especially since the delivery info is only of minor usefulness.
                if (cvNextVerse?.Character != implicitCv.Character)
                {
                    return(NeedsReviewCharacter.Singleton);
                }
                verseRef.NextVerse();
                // ReSharper disable once LoopVariableIsNeverChangedInsideLoop - NextVerse changes verseRef
            } while (verseRef <= initialEndRef);
            return(implicitCv);
        }