예제 #1
0
        public void ExportToEpub(string location, ref ZipArchive zapive)
        {
            Epub.Epub e = new Epub.Epub(metaData.name, metaData.author, new Epub.Image()
            {
                bytes = metaData.cover
            });
            e.InitExport(location);
            int id = 0;

            foreach (MangaChapter chapter in Chapters)
            {
                using (StreamReader sr = new StreamReader(zapive.GetEntry("Chapters/" + chapter.ChapterName).Open()))
                {
                    string            b;
                    List <Epub.Image> images = new List <Epub.Image>();
                    while ((b = sr.ReadLine()) != null)
                    {
                        images.Add(Epub.Image.GenerateImageFromByte(Convert.FromBase64String(b), id++.ToString()));
                    }

                    chapter.Images = images.ToArray();
                }
                e.AddPage(Epub.Page.AutoGenerate(null, chapter.ChapterName, chapter.Images));
                chapter.Images = null;
                GC.Collect();
            }
            e.ExportFinal();
        }
예제 #2
0
        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);
        }
예제 #3
0
파일: Book.cs 프로젝트: Alken123/anime-dl
 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);
 }