示例#1
0
        private void BringBookUpToDate(HtmlDom bookDOM /* may be a 'preview' version*/, IProgress progress)
        {
            progress.WriteStatus("Gathering Data...");

            //by default, this comes from the collection, but the book can select one, inlucing "null" to select the factory-supplied empty xmatter
            var nameOfXMatterPack = OurHtmlDom.GetMetaValue("xMatter", _collectionSettings.XMatterPackName);

            var helper = new XMatterHelper(bookDOM, nameOfXMatterPack, _storage.GetFileLocator());
            XMatterHelper.RemoveExistingXMatter(bookDOM);
            Layout layout = Layout.FromDom(bookDOM, Layout.A5Portrait);			//enhance... this is currently just for the whole book. would be better page-by-page, somehow...
            progress.WriteStatus("Injecting XMatter...");

            helper.InjectXMatter(_bookData.GetWritingSystemCodes(), layout);
            TranslationGroupManager.PrepareElementsInPageOrDocument(bookDOM.RawDom, _collectionSettings);
            progress.WriteStatus("Updating Data...");

            //hack
            if(bookDOM == OurHtmlDom)//we already have a data for this
            {
                _bookData.SynchronizeDataItemsThroughoutDOM();
            }
            else //used for making a preview dom
            {
                var bd = new BookData(bookDOM, _collectionSettings, UpdateImageMetadataAttributes);
                bd.SynchronizeDataItemsThroughoutDOM();
            }

            bookDOM.RenameMetaElement("bookLineage", "bloomBookLineage");
        }