Example #1
0
        private void HandleVerseFetchEvent(object sender, VerseExtraction.Models.VerseAndText e)
        {
            var modifiedVerse = _verseEditorService.Get(_optionsService.EpubPath, e.BookNumber, e.ChapterNumber, e.VerseNumber);

            if (!string.IsNullOrEmpty(modifiedVerse))
            {
                VerseTextIsModified = true;
                e.Text = modifiedVerse.Trim();
            }
        }
        public void Init(int bookNumber, string chapterAndVersesString)
        {
            Verses.Clear();

            using (var reader = new BibleTextReader(_optionsService.EpubPath))
            {
                var formattingOptions = new FormattingOptions
                {
                    IncludeVerseNumbers = false,
                    ShowBreakInVerses   = false,
                    TrimPunctuation     = _optionsService.TrimPunctuation,
                    TrimQuotes          = _optionsService.TrimQuotes,
                    UseTildeSeparator   = _optionsService.UseTildeMarker
                };

                var verses = reader.ExtractVerseTextArray(
                    bookNumber,
                    chapterAndVersesString,
                    formattingOptions);

                var epubPath = _optionsService.EpubPath;

                foreach (var vs in verses)
                {
                    var modifiedText = _verseEditorService.Get(epubPath, vs.BookNumber, vs.ChapterNumber, vs.VerseNumber);

                    var verseText = new EditVerseTextViewModel
                    {
                        EpubPath          = epubPath,
                        BookNumber        = vs.BookNumber,
                        Chapter           = vs.ChapterNumber,
                        Verse             = vs.VerseNumber,
                        OriginalVerseText = vs.Text,
                        ModifiedVerseText = modifiedText ?? vs.Text
                    };

                    Verses.Add(verseText);
                }
            }
        }