private void coverToolStripMenuItem_Click(object sender, EventArgs e) { MyNode node = treeView1.SelectedNode.Tag as MyNode; NavDetails nav = node.Tag as NavDetails; OpfDocument doc = new OpfDocument(); doc.AddCoverRef(nav.File); }
private void ExportNewCover(object sender, CoverChangedArgs e) { using (new HourGlass()) { if (e.Cover != null && ImageNode != null) { bool ChangedCoverFile = false; #region Replace Existing File with the New One if it is different if (!ImageCompare(e.Cover, BookImage)) { fileOutName = Zip.GetFilePathInsideZip(ImageURL); fileOutStream = e.Cover.ToStream(GetImageType(BookImage)); UpdateZip(); SaveOpfFixToFile(); e.Message = SaveMessage; ChangedCoverFile = true; } else { e.Message = "File has not changed, Aborting"; } #endregion //Make sure it is scaled to fit bool FixedCoverWidth = FixHtml(e); if (FixedCoverWidth) { MyHtmlDoc.fileOutStream = MyHtmlDoc.TidyHtml(ImageNode.OwnerDocument.DocumentNode.OuterHtml).ToStream(); MyHtmlDoc.UpdateZip(); if (PreserveAspectRatio) { e.Message = !ChangedCoverFile ? "File has not changed, But Fixing the dimensions" : e.Message; } else { e.Message = !ChangedCoverFile ? "File has not changed, But making sure that it is scaled to fit" : e.Message; } } #region If guide is empty add it if (IsGuideEmpty) { MyOPFDoc.AddCoverRef(CoverFile); e.Message = !ChangedCoverFile && !FixedCoverWidth ? "File has not changed, But fixing missing Cover Tag in guide" : e.Message; } #endregion //Check to see if the cover file is the first if (!Variables.MassUpdate) { CheckPositionOfCover(); } //Update the stream and BookImage with the new default GetImage(); e.ChangedCoverFile = ChangedCoverFile; } else { e.Message = "Cover is Empty, Aborting"; } } }