/// <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); }
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); }
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); }