Exemple #1
0
        public void ProcessLine(string line)
        {
            if (string.IsNullOrEmpty(line.Trim()))
            {
                return;
            }

            // Look for Book
            if (line.Trim().StartsWith("Book"))
            {
                int    bookInt    = line.IndexOf("Book");
                int    bookIntEnd = line.IndexOf(" ", bookInt);
                int    bookNum    = int.Parse(line.Substring(bookIntEnd + 1, 2));
                string bookName   = line.Substring(bookIntEnd + 3).Trim();
                CurrentBook            = new Book();
                CurrentBook.BookNumber = bookNum;
                CurrentBook.Name       = bookName;
                Index.Books.Add(CurrentBook);
                return;
            }

            // Check for verse heading
            int chapter;

            if (int.TryParse(line.Substring(0, 3), out chapter))
            {
                int    verse      = int.Parse(line.Substring(4, 3));
                string verseStart = line.Substring(8).Trim();
                CurrentVerse          = new Verse();
                CurrentVerse.Chapter  = chapter;
                CurrentVerse.VerseNum = verse;
                CurrentVerse.Text     = verseStart;
                CurrentBook.Verses.Add(CurrentVerse);
                return;
            }

            if (CurrentVerse != null)
            {
                CurrentVerse.Text += " " + line.Trim();
            }
        }
Exemple #2
0
        public void ProcessLine(string line)
        {
            if (string.IsNullOrEmpty(line.Trim()))
                return;

            // Look for Book
            if (line.Trim().StartsWith("Book"))
            {
                int bookInt = line.IndexOf("Book");
                int bookIntEnd = line.IndexOf(" ", bookInt);
                int bookNum = int.Parse(line.Substring(bookIntEnd+1, 2));
                string bookName = line.Substring(bookIntEnd+3).Trim();
                CurrentBook = new Book();
                CurrentBook.BookNumber = bookNum;
                CurrentBook.Name = bookName;
                Index.Books.Add(CurrentBook);
                return;
            }

            // Check for verse heading
            int chapter;
            if (int.TryParse(line.Substring(0, 3), out chapter))
            {
                int verse = int.Parse(line.Substring(4, 3));
                string verseStart = line.Substring(8).Trim();
                CurrentVerse = new Verse();
                CurrentVerse.Chapter = chapter;
                CurrentVerse.VerseNum = verse;
                CurrentVerse.Text = verseStart;
                CurrentBook.Verses.Add(CurrentVerse);
                return;
            }

            if (CurrentVerse != null)
                CurrentVerse.Text += " " + line.Trim();
        }