public IndexBuilder DeSerializeObject(string filename, bible_data.Bible Bible)
 {
     IndexBuilder objectToSerialize;
     Stream stream = File.Open(filename, FileMode.Open);
     BinaryFormatter bFormatter = new BinaryFormatter();
     objectToSerialize = (IndexBuilder)bFormatter.Deserialize(stream);
     stream.Close();
     objectToSerialize.Bible = Bible;
     return objectToSerialize;
 }
        public OpenXML_Zefania_XML_Bible_Markup_Language(string fileLocation, bible_data.BookManipulator manipulator)
        {
            _fileLocation = fileLocation;
            _reader = new XmlTextReader(_fileLocation);
            _bible = manipulator;

            // Create an XmlReader for <format>Zefania XML Bible Markup Language</format>
            using (_reader)
            {
                _reader.ReadToFollowing("title");
                String title = _reader.ReadElementContentAsString();
                _bible.SetVersion(title);

                String book;
                int verseNumber;
                int chapterNumber;
                string verseString;

                while (_reader.ReadToFollowing("BIBLEBOOK")) // read each book name
                {
                    _reader.MoveToAttribute(1);
                    book = _reader.Value;
                    _reader.ReadToFollowing("CHAPTER");
                    while (_reader.Name == "CHAPTER") // read each chapter
                    {
                        _reader.MoveToFirstAttribute();
                        chapterNumber = Convert.ToInt32(_reader.Value);

                        _reader.ReadToFollowing("VERS");
                        while (_reader.Name == "VERS") // read each verse
                        {
                            _reader.MoveToFirstAttribute();
                            verseNumber = Convert.ToInt32(_reader.Value);
                            _reader.Read();
                            verseString = _reader.Value;

                            sendToDataTree(book, verseNumber, chapterNumber, verseString);

                            _reader.Read();
                            _reader.Read();
                            _reader.Read();
                        }//end verse while

                        _reader.Read();
                        _reader.Read();
                    } //end chapter while
                } // end book while
            } //end using statement
        }
 // allows for serialization of bible index
 private data_index.IndexBuilder loadIndex(bible_data.Bible Bible)
 {
     string indexFileName = Bible.BibleVersion + ".index";
     data_index.IndexReaderWriter indexStorage = new data_index.IndexReaderWriter();
     data_index.IndexBuilder index = new data_index.IndexBuilder(Bible);
     return index;
 }
Beispiel #4
0
 public IndexBuilder(bible_data.Bible bible)
 {
     _bible = bible;
     buildIndex();
 }