Exemple #1
0
        private static void ReadVerse(Book book, string line)
        {
            VerseToken vToken = new VerseToken(int.Parse(line.Substring(0, 3)), int.Parse(line.Substring(4, 3)));
            Verse      verse  = new Verse(line.Substring(8, line.Length - 8));

            book.VerseList.Add(vToken, verse);
        }
Exemple #2
0
        private static Book ConvertToBook(string name, int order, StreamReader reader, Stream stream)
        {
            Book book = new Book(name, order);

            string     verse  = null;
            VerseToken vToken = VerseToken.Empty;

            try
            {
                while (!reader.EndOfStream)
                {
                    int peek = reader.Peek();
                    if (peek == 'B' || peek == 'b')
                    {
                        return(book);
                    }

                    string line = reader.ReadLine();

                    if (line.StartsWith("        ") && !line.StartsWith("         "))
                    {
                        verse += " " + line.Trim();
                    }
                    else if (line.Length > 0)
                    {
                        if (verse != null)
                        {
                            book.VerseList.Add(vToken, new Verse(verse));
                        }

                        vToken = new VerseToken(int.Parse(line.Substring(0, 3)), int.Parse(line.Substring(4, 3)));
                        verse  = line.Substring(8, line.Length - 8);
                    }
                }
            }
            catch
            {
                // Skip
            }

            return(book);
        }