Adds book reading support with EPUB and PDF reader plugins

This commit is contained in:
BinaryAlley committed 2026-09-02 04:45:11 -07:00
1 parent 275fd83ff2
commit f7ccdf3d1c
271 files changed
+11501 -361

No files matched your search

@@ -0,0 +1,27 @@
#region ========================================================================= USING =====================================================================================
using System.Collections.Generic;
using System.Diagnostics;
#endregion
namespace Lumina.Contracts.DTO.MediaLibrary.WrittenContentLibrary.BookLibrary.Reading;
/// <summary>
/// Data transfer object for the normalized document model of a book, produced by a reader plugin.
/// </summary>
/// <param name="Title">The title of the book.</param>
/// <param name="Author">The author of the book, if known.</param>
/// <param name="CoverResourceKey">The resource key of the cover image of the book, if applicable.</param>
/// <param name="TableOfContents">The hierarchical table of contents of the book.</param>
/// <param name="Spine">The ordered spine of the reading sections of the book.</param>
/// <param name="Resources">The resources of the book, keyed by their resource key.</param>
/// <param name="HasTextContent">Whether the book has extractable text content. A scanned book, whose pages are only images, has no text content.</param>
[DebuggerDisplay("Title: {Title}")]
public sealed record ReadingDocumentDto(
string Title,
string? Author,
string? CoverResourceKey,
IReadOnlyList<ReadingTocEntryDto> TableOfContents,
IReadOnlyList<ReadingSpineItemDto> Spine,
IReadOnlyDictionary<string, ReadingResourceInfoDto> Resources,
bool HasTextContent
);
@@ -0,0 +1,16 @@
#region ========================================================================= USING =====================================================================================
using System.Diagnostics;
#endregion
namespace Lumina.Contracts.DTO.MediaLibrary.WrittenContentLibrary.BookLibrary.Reading;
/// <summary>
/// Data transfer object for the binary data of a reading resource.
/// </summary>
/// <param name="Data">The binary data of the resource.</param>
/// <param name="MimeType">The MIME type of the resource.</param>
[DebuggerDisplay("MimeType: {MimeType}")]
public sealed record ReadingResourceDataDto(
byte[] Data,
string MimeType
);
@@ -0,0 +1,16 @@
#region ========================================================================= USING =====================================================================================
using System.Diagnostics;
#endregion
namespace Lumina.Contracts.DTO.MediaLibrary.WrittenContentLibrary.BookLibrary.Reading;
/// <summary>
/// Data transfer object for the file information of a resource of a reading document.
/// </summary>
/// <param name="RelativeFilePath">The path of the resource file, relative to the extraction directory of the book.</param>
/// <param name="MimeType">The MIME type of the resource.</param>
[DebuggerDisplay("RelativeFilePath: {RelativeFilePath}")]
public sealed record ReadingResourceInfoDto(
string RelativeFilePath,
string MimeType
);
@@ -0,0 +1,18 @@
#region ========================================================================= USING =====================================================================================
using System.Diagnostics;
#endregion
namespace Lumina.Contracts.DTO.MediaLibrary.WrittenContentLibrary.BookLibrary.Reading;
/// <summary>
/// Data transfer object for the content of a reading section.
/// </summary>
/// <param name="LocationRef">The opaque location reference of the reading section.</param>
/// <param name="Title">The title of the reading section, if known.</param>
/// <param name="ContentHtml">The sanitized HTML content of the reading section, ready to be rendered by the client.</param>
[DebuggerDisplay("LocationRef: {LocationRef}")]
public sealed record ReadingSectionDto(
string LocationRef,
string? Title,
string ContentHtml
);
@@ -0,0 +1,18 @@
#region ========================================================================= USING =====================================================================================
using System.Diagnostics;
#endregion
namespace Lumina.Contracts.DTO.MediaLibrary.WrittenContentLibrary.BookLibrary.Reading;
/// <summary>
/// Data transfer object for an item of the spine of a reading document.
/// </summary>
/// <param name="LocationRef">The opaque location reference of the reading section.</param>
/// <param name="Title">The title of the reading section, if known.</param>
/// <param name="RelativeSectionFilePath">The path of the section content file, relative to the extraction directory of the book.</param>
[DebuggerDisplay("LocationRef: {LocationRef}")]
public sealed record ReadingSpineItemDto(
string LocationRef,
string? Title,
string RelativeSectionFilePath
);
@@ -0,0 +1,19 @@
#region ========================================================================= USING =====================================================================================
using System.Collections.Generic;
using System.Diagnostics;
#endregion
namespace Lumina.Contracts.DTO.MediaLibrary.WrittenContentLibrary.BookLibrary.Reading;
/// <summary>
/// Data transfer object for an entry of the table of contents of a reading document.
/// </summary>
/// <param name="Label">The label of the table of contents entry.</param>
/// <param name="LocationRef">The opaque location reference of the reading section the entry points to.</param>
/// <param name="Children">The child entries of the table of contents entry.</param>
[DebuggerDisplay("Label: {Label}")]
public sealed record ReadingTocEntryDto(
string Label,
string LocationRef,
IReadOnlyList<ReadingTocEntryDto> Children
);