internal XElement ReplaceNavMap(XElement newNavMap)
        {
            OpfDocument doc = new OpfDocument();

            //TOC File does not exist or is not Present in manifest
            if (fileExtractStream == null || fileExtractStream.Length == 0 || string.IsNullOrEmpty(Variables.NCXFile))
            {
                //System.Windows.Forms.MessageBox.Show("No TOC file Present", Variables.BookName);
                //return;
                fileOutName = "toc.ncx";
                doc.AddTocEntry();
            }

            if (OldTOC != null)
            {
                NewTOC = new XElement(OldTOC);
                NewTOC.Element(ns + "navMap").ReplaceWith(newNavMap);
                SaveOpfFixToFile();
            } else
            {
                //Create a new TOC
                NewTOC =
                new XElement(ns + "ncx",
                    new XElement(ns + "head", ""),
                    new XElement(ns + "docTitle",
                        new XElement(ns + "text", Variables.BookName)),
                    new XElement(newNavMap));
            }
            return NewTOC;
        }
Beispiel #2
0
        internal XElement ReplaceNavMap(XElement newNavMap)
        {
            OpfDocument doc = new OpfDocument();

            //TOC File does not exist or is not Present in manifest
            if (fileExtractStream == null || fileExtractStream.Length == 0 || string.IsNullOrEmpty(Variables.NCXFile))
            {
                //System.Windows.Forms.MessageBox.Show("No TOC file Present", Variables.BookName);
                //return;
                fileOutName = "toc.ncx";
                doc.AddTocEntry();
            }


            if (OldTOC != null)
            {
                NewTOC = new XElement(OldTOC);
                NewTOC.Element(ns + "navMap").ReplaceWith(newNavMap);
                SaveOpfFixToFile();
            }
            else
            {
                //Create a new TOC
                NewTOC =
                    new XElement(ns + "ncx",
                                 new XElement(ns + "head", ""),
                                 new XElement(ns + "docTitle",
                                              new XElement(ns + "text", Variables.BookName)),
                                 new XElement(newNavMap));
            }
            return(NewTOC);
        }