File size: 3,294 Bytes
fab29d7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
using System.Collections.Generic;

namespace VersOne.Epub.WpfDemo.ViewModels
{
    /// <summary>
    /// View model for the <see cref="Controls.BookHtmlContent" /> control.
    /// </summary>
    public class HtmlContentFileViewModel : ViewModel
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="HtmlContentFileViewModel" /> class using the specified relative file path in the EPUB manifest,
        /// absolute file path in the EPUB archive, HTML content, and dictionaries of images, stylesheets, and fonts.
        /// </summary>
        /// <param name="htmlFilePathInEpubManifest">The relative file path of the HTML content file as it is specified in the EPUB manifest.</param>
        /// <param name="htmlFilePathInEpubArchive">The absolute file path of the HTML content file in the EPUB archive.</param>
        /// <param name="htmlContent">The content of the HTML file that needs to be rendered in the <see cref="Controls.BookHtmlContent" /> control.</param>
        /// <param name="images">The dictionary of image files in the EPUB book keyed by their relative file paths in the EPUB manifest.</param>
        /// <param name="styleSheets">The dictionary of CSS stylesheet files in the EPUB book keyed by their relative file paths in the EPUB manifest.</param>
        /// <param name="fonts">The dictionary of font files in the EPUB book keyed by their relative file paths in the EPUB manifest.</param>
        public HtmlContentFileViewModel(string htmlFilePathInEpubManifest, string htmlFilePathInEpubArchive, string htmlContent, Dictionary<string, byte[]> images,
            Dictionary<string, string> styleSheets, Dictionary<string, byte[]> fonts)
        {
            HtmlFilePathInEpubManifest = htmlFilePathInEpubManifest;
            HtmlFilePathInEpubArchive = htmlFilePathInEpubArchive;
            HtmlContent = htmlContent;
            Images = images;
            StyleSheets = styleSheets;
            Fonts = fonts;
        }

        /// <summary>
        /// Gets the relative file path of the HTML content file as it is specified in the EPUB manifest.
        /// </summary>
        public string HtmlFilePathInEpubManifest { get; }

        /// <summary>
        /// Gets the absolute file path of the HTML content file in the EPUB archive.
        /// </summary>
        public string HtmlFilePathInEpubArchive { get; }

        /// <summary>
        /// Gets the content of the HTML file to be rendered in the <see cref="Controls.BookHtmlContent" /> control.
        /// </summary>
        public string HtmlContent { get; }

        /// <summary>
        /// Gets the dictionary of image files in the EPUB book keyed by their relative file paths in the EPUB manifest.
        /// </summary>
        public Dictionary<string, byte[]> Images { get; }

        /// <summary>
        /// Gets the dictionary of CSS stylesheet files in the EPUB book keyed by their relative file paths in the EPUB manifest.
        /// </summary>
        public Dictionary<string, string> StyleSheets { get; }

        /// <summary>
        /// Gets the dictionary of font files in the EPUB book keyed by their relative file paths in the EPUB manifest.
        /// </summary>
        public Dictionary<string, byte[]> Fonts { get; }
    }
}