pull/66/head
Alexey Golub 6 years ago
parent 69088b83eb
commit 23f9331e4e

@ -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;
}

@ -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;

@ -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;

@ -61,6 +61,18 @@ namespace DiscordChatExporter.Core.Services
return new Role(id, name);
}
private Attachment ParseAttachment(JToken json)
{
var id = json["id"].Value<string>();
var url = json["url"].Value<string>();
var width = json["width"]?.Value<int>();
var height = json["height"]?.Value<int>();
var fileName = json["filename"].Value<string>();
var fileSize = json["size"].Value<long>();
return new Attachment(id, width, height, url, fileName, fileSize);
}
private EmbedAuthor ParseEmbedAuthor(JToken json)
{
var name = json["name"]?.Value<string>();
@ -79,24 +91,13 @@ namespace DiscordChatExporter.Core.Services
return new EmbedField(name, value, isInline);
}
private Attachment ParseAttachment(JToken json)
{
var id = json["id"].Value<string>();
var url = json["url"].Value<string>();
var isImage = json["width"] != null;
var fileName = json["filename"].Value<string>();
var fileSize = json["size"].Value<long>();
return new Attachment(id, isImage, url, fileName, fileSize);
}
private EmbedImage ParseEmbedImage(JToken json)
{
var url = json["url"]?.Value<string>();
var height = json["height"]?.Value<int>();
var width = json["width"]?.Value<int>();
var height = json["height"]?.Value<int>();
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);
}

Loading…
Cancel
Save