Exemplo n.º 1
0
        /// <summary>
        /// A dumbed down implementation that is able to return a book with the BookInfo and set the book's FolderPath.
        /// </summary>
        /// <returns></returns>
        public override Bloom.Book.Book GetBookFromBookInfo(BookInfo bookInfo, bool forSelectedBook = false)
        {
            var collectionSettings = new Bloom.Collection.CollectionSettings();
            var fileLocator        = new Bloom.BloomFileLocator(collectionSettings, new XMatterPackFinder(Enumerable.Empty <string>()), Enumerable.Empty <string>(), Enumerable.Empty <string>(),
                                                                Enumerable.Empty <string>());

            // Setting storage is neeeded to get it to populate the book's FolderPath.
            var storage = new BookStorage(bookInfo.FolderPath, fileLocator, new Bloom.BookRenamedEvent(), collectionSettings);

            var book = new Bloom.Book.Book(bookInfo, storage);

            return(book);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Remove any Bloom Enterprise-only pages if Bloom Enterprise is not enabled.
 /// Also renumber the pages if any are removed.
 /// </summary>
 /// <returns><c>true</c>, if any pages were removed, <c>false</c> otherwise.</returns>
 public static bool RemoveEnterprisePagesIfNeeded(Bloom.Collection.CollectionSettings settings, HtmlDom dom, List <XmlElement> pageElts)
 {
     if (!settings.HaveEnterpriseFeatures)
     {
         var pageRemoved = false;
         foreach (var page in pageElts.ToList())
         {
             if (Book.Book.IsPageBloomEnterpriseOnly(page))
             {
                 page.ParentNode.RemoveChild(page);
                 pageElts.Remove(page);
                 pageRemoved = true;
             }
         }
         if (pageRemoved)
         {
             dom.UpdatePageNumberAndSideClassOfPages(settings.CharactersForDigitsForPageNumbers, settings.Language1.IsRightToLeft);
             return(true);
         }
     }
     return(false);
 }