diff --git a/DiscordChatExporter.Core/Models/Attachment.cs b/DiscordChatExporter.Core/Models/Attachment.cs index 87da0d1..ebf5f76 100644 --- a/DiscordChatExporter.Core/Models/Attachment.cs +++ b/DiscordChatExporter.Core/Models/Attachment.cs @@ -6,19 +6,24 @@ { public string Id { get; } - public bool IsImage { get; } - public string Url { get; } + public int? Width { get; } + + public int? Height { get; } + + public bool IsImage => Width != null; + public string FileName { get; } public long FileSize { get; } - public Attachment(string id, bool isImage, string url, string fileName, long fileSize) + public Attachment(string id, int? width, int? height, string url, string fileName, long fileSize) { Id = id; - IsImage = isImage; Url = url; + Width = width; + Height = height; FileName = fileName; FileSize = fileSize; } diff --git a/DiscordChatExporter.Core/Models/EmbedImage.cs b/DiscordChatExporter.Core/Models/EmbedImage.cs index edfc7ba..3382788 100644 --- a/DiscordChatExporter.Core/Models/EmbedImage.cs +++ b/DiscordChatExporter.Core/Models/EmbedImage.cs @@ -6,11 +6,11 @@ namespace DiscordChatExporter.Core.Models { public string Url { get; } - public int? Height { get; } - public int? Width { get; } - public EmbedImage(string url, int? height, int? width) + public int? Height { get; } + + public EmbedImage(string url, int? width, int? height) { Url = url; Height = height; diff --git a/DiscordChatExporter.Core/Resources/ExportTemplates/Html/Shared.css b/DiscordChatExporter.Core/Resources/ExportTemplates/Html/Shared.css index 0661949..2c7b393 100644 --- a/DiscordChatExporter.Core/Resources/ExportTemplates/Html/Shared.css +++ b/DiscordChatExporter.Core/Resources/ExportTemplates/Html/Shared.css @@ -35,10 +35,9 @@ img { } .emoji { - margin-left: 1px; - margin-right: 1px; width: 24px; height: 24px; + margin: 0 1px; vertical-align: middle; } @@ -61,9 +60,7 @@ img { .info { display: flex; max-width: 100%; - margin-bottom: 10px; - margin-left: 5px; - margin-right: 5px; + margin: 0 5px 10px 5px; } .info__guild-icon-container { @@ -108,10 +105,8 @@ img { .chatlog__message-group { display: flex; - margin-left: 10px; - margin-right: 10px; - padding-top: 15px; - padding-bottom: 15px; + margin: 0 10px; + padding: 15px 0; border-top: 1px solid; } @@ -154,8 +149,7 @@ img { } .chatlog__attachment { - margin-top: 5px; - margin-bottom: 5px; + margin: 5px 0; } .chatlog__attachment-thumbnail { @@ -180,10 +174,7 @@ img { .chatlog__embed-content-container { display: flex; flex-direction: column; - padding-left: 10px; - padding-top: 8px; - padding-right: 10px; - padding-bottom: 8px; + padding: 8px 10px; border: 1px solid; border-top-right-radius: 3px; border-bottom-right-radius: 3px; diff --git a/DiscordChatExporter.Core/Services/DataService.Parsers.cs b/DiscordChatExporter.Core/Services/DataService.Parsers.cs index 11ec971..35d2367 100644 --- a/DiscordChatExporter.Core/Services/DataService.Parsers.cs +++ b/DiscordChatExporter.Core/Services/DataService.Parsers.cs @@ -61,6 +61,18 @@ namespace DiscordChatExporter.Core.Services return new Role(id, name); } + private Attachment ParseAttachment(JToken json) + { + var id = json["id"].Value(); + var url = json["url"].Value(); + var width = json["width"]?.Value(); + var height = json["height"]?.Value(); + var fileName = json["filename"].Value(); + var fileSize = json["size"].Value(); + + return new Attachment(id, width, height, url, fileName, fileSize); + } + private EmbedAuthor ParseEmbedAuthor(JToken json) { var name = json["name"]?.Value(); @@ -79,24 +91,13 @@ namespace DiscordChatExporter.Core.Services return new EmbedField(name, value, isInline); } - private Attachment ParseAttachment(JToken json) - { - var id = json["id"].Value(); - var url = json["url"].Value(); - var isImage = json["width"] != null; - var fileName = json["filename"].Value(); - var fileSize = json["size"].Value(); - - return new Attachment(id, isImage, url, fileName, fileSize); - } - private EmbedImage ParseEmbedImage(JToken json) { var url = json["url"]?.Value(); - var height = json["height"]?.Value(); var width = json["width"]?.Value(); + var height = json["height"]?.Value(); - return new EmbedImage(url, height, width); + return new EmbedImage(url, width, height); } private EmbedFooter ParseEmbedFooter(JToken json) @@ -188,7 +189,6 @@ namespace DiscordChatExporter.Core.Services // Get mentioned users var mentionedUsers = json["mentions"].EmptyIfNull().Select(ParseUser).ToArray(); - return new Message(id, channelId, type, author, timestamp, editedTimestamp, content, attachments, embeds, reactions, mentionedUsers); }