public void ExportToEPUB(string location) { statusUpdate(ti, $"{metaData?.name} Exporting to EPUB"); Epub.Epub e = new Epub.Epub(metaData.name, metaData.author, new Image() { bytes = metaData.cover }, new Uri(metaData.url)); foreach (Chapter chp in chapters) { statusUpdate(ti, $"{metaData?.name} Generating page for {chp.name.Replace('_', ' ')}"); e.AddPage(Page.AutoGenerate(chp.image == null ? chp.text : null, chp.name.Replace('_', ' '), chp.image != null ? new Image[] { Image.GenerateImageFromByte(chp.image, "IMG_" + chp.name) } : null)); } e.CreateEpub(new OPFMetaData(this.metaData.name, this.metaData.author, "Chay#3670", "null", DateTime.Now.ToString())); statusUpdate(ti, $"{metaData?.name} EPUB Created!"); e.ExportToEpub(location); }
public void ExportToEPUB(string location) { //SORT if (sortedTrustFactor) { statusUpdate?.Invoke(ti, "Trust Lost, Sorting Chapters."); ADLCore.Alert.ADLUpdates.CallLogUpdate("Trust Lost, discrepancy in chapter numbering. Sorting Chapters.", ADLUpdates.LogLevel.High); for (int id = 0; id < chapters.Length; id++) { for (int idx = 0; idx < chapters.Length; idx++) { if (chapters[idx].chapterNum > chapters[id].chapterNum) { Chapter a = chapters[id]; chapters[id] = chapters[idx]; chapters[idx] = a; } } } } statusUpdate?.Invoke(ti, $"{metaData?.name} Exporting to EPUB"); Epub.Epub e = new Epub.Epub(metaData.name, metaData.author, new Image() { bytes = metaData.cover }, new Uri(metaData.url)); e.AddPage(CreditsPage()); foreach (Chapter chp in chapters) { statusUpdate?.Invoke(ti, $"{metaData?.name} Generating page for {chp.name.Replace('_', ' ')}"); ADLUpdates.CallLogUpdate($"{metaData?.name} Generating page for {chp.name.Replace('_', ' ')}"); e.AddPage(Page.AutoGenerate(chp.image == null ? chp.text : null, chp.name.Replace('_', ' '), chp.image != null ? new Image[] { Image.GenerateImageFromByte(chp.image, "IMG_" + chp.name) } : null)); } e.CreateEpub(new OPFMetaData(this.metaData.name, this.metaData.author, "Chay#3670", "null", DateTime.Now.ToString())); statusUpdate?.Invoke(ti, $"{metaData?.name} EPUB Created!"); ADLUpdates.CallLogUpdate($"{metaData?.name} EPUB Created!", ADLUpdates.LogLevel.Middle); e.ExportToEpub(location); }