示例#1
0
        /// <summary>
        /// Clones the book instance by writing and reading it from memory.
        /// </summary>
        /// <param name="book"></param>
        /// <returns></returns>
        public static EpubBook MakeCopy(EpubBook book)
        {
            var stream = new MemoryStream();
            var writer = new EpubWriter(book);

            writer.Write(stream);
            stream.Seek(0, SeekOrigin.Begin);
            var epub = EpubReader.Read(stream, false);

            return(epub);
        }
示例#2
0
        public static void Write(EpubBook book, string filename)
        {
            if (book == null)
            {
                throw new ArgumentNullException(nameof(book));
            }
            if (string.IsNullOrWhiteSpace(filename))
            {
                throw new ArgumentNullException(nameof(filename));
            }

            var writer = new EpubWriter(book);

            writer.Write(filename);
        }
示例#3
0
        public static void Write(EpubBook book, Stream stream)
        {
            if (book == null)
            {
                throw new ArgumentNullException(nameof(book));
            }
            if (stream == null)
            {
                throw new ArgumentNullException(nameof(stream));
            }

            var writer = new EpubWriter(book);

            writer.Write(stream);
        }