コード例 #1
0
        public bool CheckAndCorrectVerse(VersePointer versePointer)
        {
            if (versePointer.Chapter == 0)
            {
                return(false);
            }

            ChangeIfOneChapterBook(versePointer);

            if (!string.IsNullOrEmpty(versePointer.ModuleShortName))
            {
                if (!ConvertToMainModuleVerse(versePointer))
                {
                    return(false);
                }
            }

            ExpandVerse(versePointer, null);
            if (versePointer.SubVerses.Verses.Count == 0)
            {
                return(false);
            }

            versePointer.UpdateTopVerseNumber(versePointer.SubVerses.Verses);

            return(true);
        }
コード例 #2
0
        private bool ConvertToMainModuleVerse(VersePointer versePointer)
        {
            ExpandVerse(versePointer, versePointer.ModuleShortName);
            if (versePointer.SubVerses.Verses.Count == 0)
            {
                return(false);
            }

            var parallelVersePointers = _bibleParallelTranslationConnectorManager.GetParallelVersePointer(
                versePointer.SubVerses.Verses.First(), versePointer.ModuleShortName);

            versePointer.OriginalVerseNumber    = versePointer.VerseNumber;
            versePointer.OriginalTopVerseNumber = versePointer.TopVerseNumber;

            versePointer.VerseNumber = parallelVersePointers.First().VerseNumber;

            if (versePointer.SubVerses.Verses.Count == 1)
            {
                versePointer.UpdateTopVerseNumber(parallelVersePointers);
            }
            else
            {
                parallelVersePointers = _bibleParallelTranslationConnectorManager.GetParallelVersePointer(
                    versePointer.SubVerses.Verses.Last(), versePointer.ModuleShortName);

                versePointer.TopVerseNumber = parallelVersePointers.Last().VerseNumber;
            }

            versePointer.SubVerses.Clear();
            return(true);
        }