Bloom.Book.BookServer.GetBookFromBookInfo C# (CSharp) Method

GetBookFromBookInfo() public method

public GetBookFromBookInfo ( BookInfo bookInfo ) : Book
bookInfo BookInfo
return Book
        public Book GetBookFromBookInfo(BookInfo bookInfo)
        {
            //Review: Note that this isn't doing any caching yet... worried that caching will just eat up memory, but if anybody is holding onto these, then the memory won't be freed anyhow
            if(bookInfo is ErrorBookInfo)
            {
                return new ErrorBook(((ErrorBookInfo)bookInfo).Exception, bookInfo.FolderPath, true );
            }
            var book = _bookFactory(bookInfo, _storageFactory(bookInfo.FolderPath));
            return book;
        }

Usage Example

Example #1
0
        public static Book MakeDeviceXmatterTempBook(Book book, BookServer bookServer, string tempFolderPath)
        {
            BookStorage.CopyDirectory(book.FolderPath, tempFolderPath);
            var bookInfo = new BookInfo(tempFolderPath, true);

            bookInfo.XMatterNameOverride = "Device";
            var modifiedBook = bookServer.GetBookFromBookInfo(bookInfo);

            modifiedBook.BringBookUpToDate(new NullProgress());
            modifiedBook.AdjustCollectionStylesToBookFolder();
            modifiedBook.Save();
            modifiedBook.Storage.UpdateSupportFiles();
            // Copy the possibly modified stylesheets after UpdateSupportFiles so that they don't
            // get replaced by the factory versions.
            BookStorage.CopyCollectionStyles(book.FolderPath, tempFolderPath);
            return(modifiedBook);
        }
All Usage Examples Of Bloom.Book.BookServer::GetBookFromBookInfo