Beispiel #1
0
        private Epub LoadEpub(string fileName)
        {
            var epub = new Epub();

            epub.ReadFile(fileName);
            var errors = epub.Validate();

            if (0 < errors.Count)
            {
                var sb = new StringBuilder();
                sb.AppendLine($"Epub file '{fileName}' has the following errors:");
                foreach (var error in errors)
                {
                    sb.AppendLine(error);
                }
                System.Diagnostics.Trace.WriteLine(sb.ToString());
                MessageBox.Show(sb.ToString());
            }
            return(epub);
        }
Beispiel #2
0
        public static void CombineTwoEpubs()
        {
            var epub1 = new Epub();
            var epub2 = new Epub();

            try
            {
                epub1.ReadFile(@"E:\temp\work\zip\unpack\ccg\Cultivation Chat Group.c1313-1325.epub");
                epub2.ReadFile(@"E:\temp\work\zip\unpack\ccg\Cultivation Chat Group.c1326-c1331.epub");

                var combiner = new EpubCombiner(epub1);
                combiner.Add(epub2);

                epub1.WriteFile(@"E:\temp\work\zip\unpack\ccg\Cultivation Chat Group.c1313-c1331.epub");
            }
            catch (Exception ex)
            {
                System.Diagnostics.Trace.WriteLine(ex.ToString());
                MessageBox.Show(ex.ToString());
            }
        }