using System;
using System.IO;
namespace VersOne.Epub.Options
{
///
/// Provides data for the event.
///
public class ContentFileMissingEventArgs : EventArgs
{
///
/// Initializes a new instance of the class with a specified file name, an absolute file path, a content type of the file,
/// and a MIME type of the file's content.
///
/// Relative file path of the missing content file (as it is specified in the EPUB manifest).
/// Absolute file path of the missing content file in the EPUB archive.
/// The type of the content of the missing file.
/// The MIME type of the content of the missing file.
public ContentFileMissingEventArgs(string fileKey, string filePath, EpubContentType contentType, string contentMimeType)
{
FileKey = fileKey;
FilePath = filePath;
ContentType = contentType;
ContentMimeType = contentMimeType;
SuppressException = false;
ReplacementContentStream = null;
}
///
/// Gets the relative file path of the missing content file (as it is specified in the EPUB manifest).
///
public string FileKey { get; }
///
/// Gets the absolute file path of the missing content file in the EPUB archive.
///
public string FilePath { get; }
///
/// Gets the type of the content of the missing file.
///
public EpubContentType ContentType { get; }
///
/// Gets the MIME type of the content of the missing file.
///
public string ContentMimeType { get; }
///
/// Gets or sets a value indicating whether the EPUB content reader should suppress the exception for the missing file. If it is set to true
/// and the replacement content stream is not provided (via the property), then the EPUB content reader will treat
/// the missing file as an existing but empty file.
/// Default value is false.
///
public bool SuppressException { get; set; }
///
/// Gets or sets the replacement content stream. This property allows the application to provide a replacement content for the missing file in the form of
/// a . When the content stream is provided, the EPUB content reader will not throw an exception for the missing file,
/// regardless of the value of the property. The content of the stream is read only once, after which it will be cached
/// in the EPUB content reader. The stream will be closed after its content is fully read.
///
public Stream? ReplacementContentStream { get; set; }
}
}