Пример #1
0
        private BookInfo(string f, Core.DocumentStore ds,
			 Core.TableOfContents toc)
        {
            Filename = f;
            BookText = ds;
            Contents = toc;

            Anchors = new Core.AnchorIndex();
            BookText.Replay(Anchors);

            SectIndex = new Core.SectionIndex(Anchors, Contents);
        }
Пример #2
0
        public static BookInfo GetHelp()
        {
            Core.DocumentStore helpDoc = new Core.DocumentStore();
            Core.TableOfContents toc;

            using (Stream s = helpHTML())
            toc = Core.HeadingScan.Scan(s);

            using (Stream s = helpHTML())
            Core.XHTMLParser.ParseStream(s,
            new Core.NormalizeWhitespace(helpDoc));

            return new BookInfo(null, helpDoc, toc);
        }
Пример #3
0
        public static BookInfo TryCreate(string path)
        {
            try
            {
            path = Path.GetFullPath(path);

            using (Core.EPubFile file = new Core.EPubFile(path))
            {
            Core.DocumentStore newDoc = new Core.DocumentStore();

            file.ProduceBook(newDoc);
            return new BookInfo(path, newDoc, file.Toc);
            }
            }
            catch (Exception ex)
            {
            StatusMessage.Say(string.Format("Can't open {0}: {1}",
            path, ex.Message));
            return null;
            }
        }
Пример #4
0
        void openToc(int depth)
        {
            if (currentBook == null)
            return;

            Core.DocumentStore doc = new Core.DocumentStore();
            Core.TocPrinter.PrintToc(currentBook.Contents, doc, depth);

            docView.Document = doc;
        }